Page is a not externally linkable
- Code, Content, and Presentation
-- CSS
---- Float Issue ¦ CSS Layout


Fotiman - 1:41 pm on Jul 8, 2008 (gmt 0)


"an issue"? You will likely get better replies if you can be more specific as to what your problem is.

In this case, I'm guessing you are expecting a gray background to extend the height of both the floated items. However, when you float an element, you take it out of the flow, so your parent div doesn't contain anything to give it height.

There are many ways to fix this. You could add an element below that floated elements that clears them. Or you could float the parent div as well. Or you could give overflow: hidden to the parent... just to name a few.

Lastly, (and not related to your issue) I recommend you read Why most of us should NOT use XHTML [webmasterworld.com].


Thread source:: http://www.webmasterworld.com/css/3693162.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com