IE8身体没有采取100%的身高

时间:2012-04-07 19:03:56

标签: html internet-explorer-8 height document-body

在我的应用程序中,我无法完全覆盖IE8中的浏览器窗口页面。

HTML:

<body class="body">
    <div class="wrapper">
        <div class="main-holder">
            <form id="Form1" runat="server">

            </form>
        </div>
    </div>
</body>

CSS:

.body {
    background: -webkit-gradient(linear, left top, right top, from(#2F2727), color-stop(0.25, #1a82f7), color-stop(0.5, #2F2727), color-stop(0.75, #1a82f7), to(#2F2727));
    background: -webkit-linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727);
    background: -moz-linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727);
    background: -ms-linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727);
    background: -o-linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727);
    background: linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727);
    -pie-background: linear-gradient(left, #2F2727, #1a82f7, #2F2727, #1a82f7, #2F2727);
    behavior: url(PIE.htc);
    height: 100%;
}
.main-holder {
    width: 1000px;
    min-height: 600px;
    margin: 10px auto;
    -moz-border-radius: 20px;
    -webkit-border-radius: 20px;
    -khtml-border-radius: 20px;
    border-radius: 10px;
    -moz-box-shadow: 10px 10px 10px #000;
    -webkit-box-shadow: 10px 10px 10px #000;
    box-shadow: 10px 10px 10px #000;
    background: -webkit-gradient(linear, left bottom, left top, from(#F8AC25), color-stop(0.05, #FFF999), color-stop(0.5, #F8AC25), color-stop(0.95, #FFF999), to(#F8AC25));
    background: -webkit-linear-gradient(top, #F8AC25, #FFF999 5%, #F8AC25, #FFF999 95%, #F8AC25);
    background: -moz-linear-gradient(top, #F8AC25, #FFF999 5%, #F8AC25, #FFF999 95%, #F8AC25);
    background: -ms-linear-gradient(top, #F8AC25, #FFF999 5%, #F8AC25, #FFF999 95%, #F8AC25);
    background: -o-linear-gradient(top, #F8AC25, #FFF999 5%, #F8AC25, #FFF999 95%, #F8AC25);
    background: linear-gradient(top, #F8AC25, #FFF999 5%, #F8AC25, #FFF999 95%, #F8AC25);
    -pie-background: linear-gradient(top, #F8AC25, #FFF999 5%, #F8AC25, #FFF999 95%, #F8AC25);
    behavior: url(PIE.htc);
}

* {
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial Sans-Serif;
}

但在IE8中,页面顶部和底部有两个白色条带。由于这个原因,正文并没有完全覆盖页面,但在Firefox中却是如此。

截图IE8:

enter image description here

屏幕截图Firefox:

enter image description here

在IE8中,它们是包装器的偏移量:

enter image description here

任何信息都对我很有帮助。

感谢。


enter image description here

3 个答案:

答案 0 :(得分:7)

问题可能是由html或body元素引起的。试试这个:

html, body {
padding: 0;
margin: 0;
height: 100%;
}

请注意,当网站流出画布以显示滚动条时,将高度设置为100%可能会给您带来问题。然后高度仍然是100%,可能会导致溢出的内容出现问题。

答案 1 :(得分:2)

您需要将100%的高度应用于HTML和BODY标记:

html, body { height: 100%; }

Here's some more information!

答案 2 :(得分:1)

试试这个

body
{
    overflow: scroll;
}