Text wrap around image
Trying to achieve this(image attached)
Tried this:
and also float: right, didn't work
12 Replies
The one great use for
float
and shape-outside
https://codepen.io/b1mind/pen/qBbrqgj ignore the first example
Yeah, you're looking for the
float
property not position
I'm doing something wrong there
Float only works within the parent element. You had the image in a different element entirely so it couldn't float with the heading
In addition, floats need to come before the element that you want it to float around, b/c otherwise the block level element will take up the entire width
Ah, now I get it
done
WOO!
If you'd like to learn more about floating:
https://developer.mozilla.org/en-US/docs/Web/CSS/float
should i approach all these with float
float
is designed to allow images to float alongside text (IE have text wrap around the image). If that's what you want, then yes
But if the images are supposed to be on their own then flex or grid would be more appropriateOkay, I'll use grid and flex, will update you once done. Thanks, mate.
I can also use
clip-path
right? instead of shape-outside
.
it gives more control