How to wrap a text around a centered (round) image like this:
I
As already noted, shape wrapping currently only works for float
ed elements, so this exact situation isn't do-able with CSS only, because only wrapping on one side of a shape is permitted (expected). Once the CSS Shapes 2 and/or CSS Exclusions specs) are adopted, we will be able to do this with not only shapes but also image transparency.
I ran into this same problem while trying to figure out how shapes and CSS columns interact (spoiler: decent, but not organically). The problem seems to be that the layout algorithm looks for the farthest edge (ignoring the possiblity of multiple sides), then starts content layout from that coordinate. For elements in the middle, this means you get text only on one side. For CSS columns (which is how I figured this out), the layout again starts from the farthest edge, but then continues straight down instead of wrapping to the shape on each line (see fiddle), so protrusions on shapes (like a star polygon
) can actually force wrapping content to end up below the entire shape instead of squished to one side or flowing down into the protrusion.
(note there are 3 sets of 2 columns on 2nd example)
However, there are a couple options that may work for similar situations. I have adapted the following from the other answers/comments, but had to make several changes to get them working (and several of the CSS attributes were experimental and are no longer valid), so I felt this was better as a new answer than as edits/comments:
Use shape-outside
on a left
float
ed div to create a wrapping circle, then use margin-left
to push it away from the left side. I added a circle inside the div for illustration (your image URL is 404), but had to tweak the location as Chrome did not calculate its position the way one would expect once margins were added.
http://jsfiddle.net/brichins/50h20kxa/1/
If columns are acceptable, manually (see above CSS column discussion) creating 2 containers for columns and placing a shape
d element on the side of each gives the following:
http://jsfiddle.net/brichins/gvhpfccu/
The disadvantage here is columns where you may have wanted a single block (not necessarily bad for readability), as well has having to compute an appropriate split for your content.
Intro and walkthrough on HTML5 Rocks: https://www.html5rocks.com/en/tutorials/shapes/getting-started/
Creating Non-Rectangular Layouts With CSS Shapes: https://sarasoueidan.com/blog/css-shapes/
CSS Tricks article: https://css-tricks.com/almanac/properties/s/shape-outside/
D3plus workaround plugin (for similar SVG solutions): https://d3plus.org/examples/utilities/a39f0c3fc52804ee859a/