firefox中的min-height无法正常工作

时间:2012-06-06 03:54:50

标签: firefox height css

我在firefox中遇到了min-height的问题,我试图将它设置为100%,但它无法正常工作。在Chrome中它完美运行。

我的代码是:

   <html>
    <head>
        <link rel="stylesheet" type="text/css" media="all" href="../css/main.css"/>
    </head>
    <body>
        <div class="main">
            <div class="header">Here is the header</div>
            <div class="content ">Here is the content</div>
            <div class="footer">Here is the footer</div>
        </div>
    </body>
   </html>

css文件是

.header {
    height:160px;
}

.content{
    min-height: 100%;
    height: auto !important;
    height: 100%;   
}

.footer{
    margin: -215px auto 0 0; 
    height: 55px;
}

我所要做的就是将页脚保持在页面底部,在Chrome中它正常工作,但在Firefox中,内容没有任何高度。 我一直在寻找解决方案,很多人都说要放

#page{min-height:100%;} 
html, body{min-height:100%;}

但它也是如此,它仍然适用于chrome但不适用于Firefox。

有人能帮助我吗?

由于

1 个答案:

答案 0 :(得分:1)

如果您只是想将页脚保持在底部,则可以使用

 .footer{
 position:fixed; /*or absolute, or whatever*/
 bottom:0px;
 height: 55px;
 }