height of wrapper div to inside floated items?
I have a div 'a' ( simple div)
and div 'b' which is float:left
;
I was wondering what is the correct method to set the height of 开发者_高级运维div 'a' to be a perfect wrapper for div 'b' ( in terms of height).
i know there are some options :
1)set 'a' : overflow:hidden ( it works).
2)set at the end of 'b' div with 'clear':both
) i would love to know more options ( besides fixed height to div 'a'...)
) and of course , what is the better way.
@Royi Namir; there others mades like clearfix like this
css:
.clearfix:after {
display: block;
content: " ";
clear: both;
}
as per the better way clearfix
& overflow:hidden
both are better because you no need to write any extra markup
in your html for every element.
精彩评论