【问题标题】:Height doesn't work in Firefox高度在 Firefox 中不起作用
【发布时间】:2013-11-04 05:20:22
【问题描述】:

我有 Firefox 25.0,我的 div 没有得到正确的高度。 在我的 CSS 中:

#page {
    background-color: rgba(255,255,255,0.9);
    width: 98%;
    height: 87%;
    position: absolute;
    left: 1%;
    top: 12%;
    display: table;
    padding-bottom: 1px;
}

窗口变小时,高度超过87%

我尝试了一个 jQuery 替代方案:

$(document).ready(function() {
    var contentheight = $("#most").height();
    var contentheightt = contentheight * .87;
    contentheightt = contentheightt+"px";
    $("#page").css("height",contentheightt);
});

在 Firefox 中都无法使用,但在 Safari 和 Chrome 中可以使用。

这是我的页面:http://sdgr.comule.com/sd/

【问题讨论】:

    标签: jquery css firefox height


    【解决方案1】:

    对于Firefox,您需要在#page.txt 类中添加以下css -

    position: absolute; 
    overflow-y: scroll; 
    left: 500px;
    

    根据需求改变左值。

    【讨论】:

    • 感谢您的帮助。添加这几个可以让我出于某种原因使用 jQuery 修改高度。
    【解决方案2】:

    以百分比表示的 CSS 高度无法正常工作 尝试使用最小高度而不是百分比 您也可以在 jquery 中尝试 $(window).height () 问候

    【讨论】:

      【解决方案3】:

      #page div 与包含您的内容的内部 div 一起扩展。如果您将以下 div 设置为 position: absolute; 您的问题应该得到解决。

      <div id="desc" class="col txt"></div>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-10-06
        • 1970-01-01
        • 1970-01-01
        • 2014-01-24
        • 1970-01-01
        • 1970-01-01
        • 2018-11-25
        • 2014-07-31
        相关资源
        最近更新 更多