alt131 - 2:58 pm on Sep 12, 2011 (gmt 0)
so about the containers, you are saying that if an element has an explicit height or a floating applied to it I shouldn't put it into a div?
Floats remove an element from the flow so the parent (container) of a floated element should not "expand" to contain the child element. See the introduction at 9.3 Positioning schemes [w3.org] for more detail. Second, an explicit height on a parent (container) should be obeyed, so the parent may not expand to contain child elements if the total height of those elements is taller than the height set on the parent. I say "should" and "may" as some legacy versions did.
However, I'd suggest the best question is whether "divs-as-containers" are required (or any other "container" element). Divs should "<div>-ide" sections of content (text/images) of the page. A common use is to create divisions for the heading, main content and footer if necessary to apply different styles to those parts of the page. (Note HTML5 deals with this by providing more elements than just the generic div.) However, another common coding issue is "div-itis" - where "every" HTML element is contained in a div, or div's are used instead of the semantically correct HTML elements. So, as with applying clear, I suggest ask if a container is really required - frequently styles can be applied directly to the appropriate html element itself.
- which can be confusing when starting. I just look to the recommendations, such as 2.4.1 Separate structure and presentation [w3.org], and 2.4 CSS design principles (Complementary to structured documents) [w3.org]. Otherwise: just because you can (insert an empty div) doesn't mean you should ;)
I have kind of noticed on the net, from my own research, that some developers really like the idea of an empty div, whereas others loathe it : - )