
也许你在做网页的时候发现,发一个区块内的元素被应用了float之后,那么整个box的高度对就不以被浮动对象的高度为标准了。
如图中的城市导航内的城市列表中采用了float之后,那个外框的高度并不是内容元素的高度:
怎么解决这个问题呢?经发现可以采用overflow来解决!方法是在父元素加上如下代码即可
overflow:hidden; zoom:1;
overflow:hidden;是让高度自适应, zoom:1;是为了兼容IE6,也可以用height:1%;的方式来解决。
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
These cookies are needed for adding comments on this website.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: policies.google.com
You can find more information in our Cookie Policy and Cookie Policy.