This page shows you how to use CSS so that text wraps around image.
Here's a example:
The Time Traveller (for so it will be convenient to speak of him) was expounding a recondite matter to us. His grey eyes shone and twinkled, and his usually pale face was flushed and animated. The fire burned brightly, and the soft radiance of the incandescent lights in the lilies of silver caught the bubbles that flashed and passed in our glasses. Our chairs, being his patents, embraced and caressed us rather than submitted to be sat upon, and there was that luxurious after-dinner atmosphere when thought runs gracefully free of the trammels of precision. And he put it to us in this way—marking the points with a lean forefinger—as we sat and lazily admired his earnestness over this new paradox (as we thought it) and his fecundity. (from Time Machine.)
You can see the text flowing around a image. This is done using CSS with
The HTML code is this:
<p> <img class="floatMe" src="lilies.png" alt="lilies" width="167" height="106"> The Time Traveller … </p>
The CSS code is this:
float can have a value of
right. When it's left, it floats starting from left.
If any ancestor tag doesn't have any
width set, then the bounding box is the window.
When a tag is floating, anything will go around it to avoid collision or overlap.
(except tags that have their own layer with
position. See: CSS Layout ＆ Layers.)
You can have multiple tags that are all floating. If they all have
float:right, then they'll behave as a sequence of
<img …> tags, flowing from left to right.
For a example, see: Flowing List Items.
If you have many floating items, the position of the last item will be the position the next non-floating item begin. For example, you might have:
floatElement floatElement floatElement … <h2>…</h2>
<h2> will be shown at the position right after the last flow.
If you don't want that, you need to stop the flow with
clear:left in the tag that comes after the float. Like this:
<h2 style="clear:both">A New Beginning</h2>
clear can have values of
Usually, it is best to use this tag to clear the floats:
<hr style="visibility:hidden; clear:both">