Issue with class clearfix in bootstrap

user1740381 picture user1740381 · Apr 28, 2013 · Viewed 43.2k times · Source

I am using twitter bootstrap, i have an issue with clearfix class in bootstrap. My html is :

<div class="pull-left">This is a text</div>
<hr class="clearfix" />

What i am expecting is horizontal line should come in next line of displayed text but it renders at right side of the text. And if when i use style='clear: both;' in hr than it works fine. Why clearfix not doing the same as clear: both does ?

Answer

Arun P Johny picture Arun P Johny · Apr 28, 2013

The class clearfix should be applied to the parent container element

<div class="clearfix">
    <div class="pull-left">This is a text</div>
</div>

Demo: Plunker