【问题标题】:ie7 float div heightie7浮动div高度
【发布时间】:2023-03-08 03:24:01
【问题描述】:

我有这个代码 代码:

<div id="container">
    <div id="products_content">
        <div id="products_page_header">
            <div id="products_page">
                <div class="post">
                    <div class="entrytext">
                        some text
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="clear">
    </div>
    <div id="siteinfo">
        <p>
            some content
        </p>
    </div>
</div>

这个CSS:

代码:

div#container {
    margin: 0 auto;
    width: 960px;
    height: auto;
    border-left: thin solid #6b5c57;
    border-right: thin solid #6b5c57;
}


div#products_page_header {
    width: 960px;
    height: 50px;
    background-image: url(images/products_page_header.png);
    background-repeat: no-repeat;
    margin: 10px 0 0 0;
}

div#products_page {
    width: 950px;
    float: right;
    margin: 50px 0 0 0;
}

div.post {
    float: right;
    border: 1px solid #6b5c57;
    width: 200px;
    height: 350px;
    margin: 10px;
}
div#siteinfo {
    height: 280px;
    position:relative;
    background-image: url(images/footer.jpg);
}

问题在于它可以在除 IE7 之外的所有新浏览器上运行! 产品容器的高度不起作用,页脚 div 与它重叠! 我该怎么办?

【问题讨论】:

    标签: css internet-explorer html height css-float


    【解决方案1】:

    罪魁祸首是height: 50px;#products_page_header css规则..

    它的内容漂浮在它之外,它不会伸展以容纳它们..

    【讨论】:

    • 您能提出解决此问题的方法吗?
    • @kfiroo,如果您希望父元素展开以包含其浮动的子元素,则它不能有固定的高度...将其设置为 auto..
    猜你喜欢
    • 1970-01-01
    • 2013-10-06
    • 2013-06-27
    • 1970-01-01
    • 1970-01-01
    • 2014-03-21
    • 2014-07-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多