Georg already has provided a very practical answer. I interpreted your question as a question about understanding containing
blocks and floats.
Chris Morse schrieb:
I just want an image floated left so the text that goes along with it is to the right. However, I want the image completely inside the div that contains the text. I would think, since the image is inside a div that the div would grow to match the size of the image (after all, it is the CONTAINING BLOCK) but it just doesn't seem to work that way. ...http://tvr.palindromesys.com/article.htm
http://www.w3.org/TR/CSS21/visuren.html#containing-block: "Each box is given a position with respect to its containing block, but it is not confined by this containing block; it may overflow." Floats do not expand their containing block because they are taken out of the flow of elements: A "containing block" does not "contain" floats. A clearing element can fix this, because it will not allow any float besides of it, it will move under the float and expand the "containing block" this way to make sure the float is "contained". see this article http://www.complexspiral.com/publications/containing-floats/
... my right sidebar on the same page is floated right. ... the text plays nice by respecting the margins of the sidebar. However, if I am foolish enough to put a top and/or bottom border on this other div, the borders go all the way across the page. Is there a way to tell this other div to stop at the margins of the floated div?
http://www.w3.org/TR/CSS21/visuren.html#floats: "Since a float is not in the flow, non-positioned block boxes created before and after the float box flow vertically as if the float didn't exist. However, line boxes created next to the float are shortened to make room for margin box of the float." So your observation is the expected behavior, and you'll have to set a right /margin/, otherwise, the block box and it's border is drawn as if there was no float. Ingo ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
