Sometimes you will encounter the UL Li List of things will be used to float, this time the height of the UL will not be open, how to do?
1) The most stupid way is to set the height of UL, but this method is very rigid, highly not adaptive
2) Once I tried to add a clear floating div in the UL, this can achieve the effect, but this practice is wrong, does not conform to the specification, so absolutely can not write this.
<ul>
<li></li>
<div style= "Clear:both" ></div>
</ul>
Can't write like this!
3) One of the best ways to do this is: add it to the UL tag: Overflow:hidden;clear:both; These two styles can be properly made to keep the UL height open.
<ul style= "Overflow:hidden;clear:both;" >
<li></li>
</ul>
This can also be used for any DIV element that is highly adaptive after the internal content floats.
This method I feel more than add a <div style= "Clear:both" ></div> a little better
A good way to clear the float inside the UL Li and make UL adaptive height