tags:

views:

25

answers:

1

I am having an issue with collapsing divs in CSS! But not the normal issue. That would be too easy. I have a left floating div which contains two left floated divs. The first of the left floated divs contains text. If the second inner floated div's style is empty, everything works fine and the outer div encompasses the text and both inner divs. What i need to do is set the width of the second div to 10px. Instantly when I do this the outer div collapses to 10px, squishing the text div down. What!? I am able to find some reference to this behaviour existing, but nothing comprehensive about what it is really and now to work around it.

+2  A: 

Do you mean to clear the floats? you can overflow:hidden; zoom:1 if the element containing the floats isn't already a float, or if it already isn't somehow clearing them.

It would help if you jsfiddle.net it.

meder
up vote because I've never seen jsfiddle.net until now, nice
walnutmon
The outer container is, in fact, a float. If I can decipher jsfiddle I will report back.
conartist6
+1 it does sound like hes just trying to clear the floats in which case your solution is correct :)
Darko Z
Bug squashed. No idea how exactly what was happening was happening, I'd still be interested if anybody knows of the circumstances that make this sort of thing possible, but now that my code is what I thought it was, this all works fine. Thanks!
conartist6