This is a general question and something that dawned on me and seemed to make sense. I have seen many people use clearing divs <div class="clear" />and know this is sometimes frowned upon as it is extra markup. I recently started using <hr class="clear" /> as it seams representative of its actual purpose.
Both referencing of course: .clear{clear:both;}
I am looking to get some opinions if an hr tag makes more sense than a div to clear content
According to the HTML5 spec, the
hrelement represents a paragraph-level thematic break (a scene change in a story, or a transition to another topic within a section of a reference book) while thedivelement is a generic container for flow content that by itself does not represent anything. So I don’t see any justification for choosing one over the other for containing floats.However, there’s something you should keep in mind. Read the following excerpt from Eric Meyer’s article Containing Floats:
If this didn’t make sense to you, see this fiddle and notice the space below the floated
div(IE8).That said, there are other ways to contain floats and avoid using structural hacks at the same time:
.container { overflow: auto; }: If the content exceeds the boundaries of the container, you will see a scrollbar..container { overflow: hidden; }: If the content exceeds the boundaries of the container, it will be hidden.