Element assuming height of floating element?
March 14, 2005 2:20 PM   Subscribe

CSSFilter: How do I get a container element to adopt the height of a floating list?

I have a list contained in a div, the list and the list items are all floating elements. IE seems, for the div, to adopt the height of the floating element, but how can I get firefox to assume the div height as the height of the floating list?
posted by dflemingdotorg to Computers & Internet (5 answers total)
If I understand correctly, you seem to need this nifty clearing technique. It has its problems (doesn't everything to do with CSS layouts?) but it seems to be a nice way to clear a float within an enclosing div, without adding unnecessary extra markup.
posted by Ridge at 2:25 PM on March 14, 2005

Thanks ridge. I had seen this before but wasn't sure exactly what it did until now. Kudos!
posted by dflemingdotorg at 2:29 PM on March 14, 2005

ooo! thanks for that!
posted by andrew cooke at 2:29 PM on March 14, 2005

Funny you should ask. There are actually a few ways to do this, and one was just recently discovered that might be called the "overflow hack." Here's a good discussion of the state of the art.

The basic problem is that floats are considered as having no height from the perspective of the containing element.

Actually, now that I read your query more closely, I'm not sure this will answer your question--a pointer to a test page might help.
posted by adamrice at 2:30 PM on March 14, 2005

Cool! My first "marked as best answer". I feel warm and special. Glad to have helped.
posted by Ridge at 2:35 PM on March 14, 2005

« Older Easy-entry engineering bachelor's?   |   Streaming music Newer »
This thread is closed to new comments.