471,073 Members | 1,142 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

Text wrap around positioned float

I'm using relative positioning to move a right-floated image 10px upwards..
Text wrapping around the image should go underneath it once it reaches the
bottom of the image, yet it acts as if the image is still in it's original
position and doesn't start wrapping until it's 10px below the bottom of the
image. How can I work around this?

TIA,
Aaron
Jul 20 '05 #1
1 3252
"Aaron" <ag********@comcast.net> wrote in
news:AL********************@comcast.com:
I'm using relative positioning to move a right-floated image 10px
upwards.. Text wrapping around the image should go underneath it once
it reaches the bottom of the image, yet it acts as if the image is
still in it's original position and doesn't start wrapping until it's
10px below the bottom of the image. How can I work around this?


Use a negative margin (margin-top: -10px) rather than relative positioning.
With relative positioning, all layout is done as if the positioned element
were in its static position (i.e. where it would have been if it hadn't
been positioned) and then the positioned element is moved *without*
reflowing anything. Negative margins, OTOH, *are* taken into account
during layout.

So in this case, the rendering engine correctly refuses to flow text into
the space that will be vacated when the image is moved by relative
positioning since that space won't be vacant until after the move is done.
With the negative margin, however, the space becomes available at the time
the text-flowing is being done and therefore the rendering engine, again
correctly, flows text into the space.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Xerxes | last post: by
2 posts views Thread by Suzanne Boyle | last post: by
1 post views Thread by laura.paterson | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.