I use clearfix to clear the float. But the problem is ,there is a different height in <li>
and <div>
. li.clearfix
height is 32px, but div.clearfix
height is 18px. when I delete .clearfix:before
, they are all the same.
But, when tried in bootstrap, it's failed.(I delete the .clearfix:before
in bootstrap, but there is still a difference in height.)
<style>
.pull-left{
float:left;
}
.clearfix {
*zoom: 1;
}
.clearfix:before,
.clearfix:after {
display: table;
line-height: 0;
content: "";
}
.clearfix:after {
clear: both;
}
</style>
<div class="clearfix">
<div class="pull-left">Hello</div>
</div>
<ul>
<li class="clearfix"><div class="pull-left">hello</div></li>
</ul>
Demo:http://jsfiddle.net/nevimop/p4HMS/
browsers (chrome safari ie10 , no problem in ff)
add this ul{list-style: none;}
the heights same.