子元素浮動後如何撐開父元素的問題

如題,解決方法有兩個。spa

方法一:code

<div>
    <div style="float: left;"></div>
    <div style="float: left;"></div>
    <div style="clear: both;"></div>
</div>

方法二:blog

<div style="overflow: hidden;">
    <div style="float: left;"></div>
    <div style="float: left;"></div>
</div>
相關文章
相關標籤/搜索