Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I wrap text around a non rectangular image?

Tags:

html

css

Is it possible to wrap text around a non rectangular image?

I want text around maps of different countries to wrap around the country's shape in such a way that the text always keeps the same distance from the country's border even though the border itself isn't straight.

Is this possible?

like image 680
Che Kofif Avatar asked Feb 03 '12 14:02

Che Kofif


People also ask

How do I wrap text around a picture in Excel?

When you insert a picture its layout is set to In Line with Text. To change that, select the picture and then select Layout Options. From here, there a number of options With Text Wrapping. Choose Square and the text now wraps around the picture even when you move it.

How do I wrap text around an image in HTML?

Use the markup code <BR CLEAR=”left” /> to flow text around images on opposite sides of your Web pages. One of the first things you may want to do is place an image on the page.


2 Answers

You can use this method, where you float divs to block off the shape's area.

So - the answer is "Yes - it can be done". But as far as I know there's no "easy" way like a CSS "text-wrap" option.

like image 186
Dave Avatar answered Oct 24 '22 10:10

Dave


It looks like that kind of support is on the horizon.

As Dave said, there is CSSTextWrapper, which is probably the best way to do it at the moment, but a relatively recent W3C working draft outlines a method to use more complex shapes using SVGs, and perhaps raster images with outline detection.

How long it will take for it to be implemented in major browsers, let alone finished, is anyone's guess.

At the moment, it can be done, with difficulty. With luck, it will be much easier in the future.

like image 30
cpmsmith Avatar answered Oct 24 '22 10:10

cpmsmith