When using a DIV element with a style of clear:both to clear a previous float, is it necessary to use a start and end tag to the DIV element? Here is an example ...
Is this OK?
or should it be this?
Answer
You need the closing tag, or browsers will not think the tag is closed.
However, why would you even want to use ? That involves adding an extra unsemantic div for no reason.
There are better ways to contain/clear floats:
- Use
overflow: hiddenon the the element that contains your floats. - Or, use a clearfix such as the "micro clearfix".
No comments:
Post a Comment