且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么我的图像背景消失在float:left?

更新时间:2022-06-19 00:29:07

我建议添加overflow:hidden; (和zoom:1;为了保持IE6的跨浏览器兼容性)到容器div,而不是添加一个清除div。 Clear为您的源代码添加了膨胀。

I'd recommend adding overflow:hidden; (and zoom: 1; to maintain cross browser compatability for IE6) to the container div rather than adding a clearing div. Clear adds bloat to your source code.

#container #header-usernav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    margin-left: 10px;
    overflow: hidden;
    zoom: 1;
    height: 28px; /* This is needed to ensure that the height of the rounded corners matches up with the rest of the bg.
}