IE8高度100%Bug [英] IE8 Height 100% Bug

查看:135
本文介绍了IE8高度100%Bug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人听说过在使用CSS的html和body中应用高度作为百分比时发生的IE8错误?在应用图块模式时,我看到一个白色背景。

Has anyone heard of a bug that occurs with IE8 when applying height as a percentage to the html and body using CSS? I'm seeing a white background when a tile pattern should be applied.

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

body {
    background-color: #666;
    background-image: url('../images/body/bg_pattern.gif');
}


推荐答案

到标准比IE7做的。语句

IE8 interprets the height element closer to the standards than IE7 did. The statement

`Height:100%

`Height: 100%

百分比高度基于其父元素的高度。如果父元素没有显式高度,则忽略百分比并将其设置为自动。您可以在 w3.org 上查看更多相关资讯。

Is pretty much ignored. Percentage heights are based upon the height of their parent element. If the parent element doesn't have an explicit height, the percentage is ignored and set to Auto. You can see more about this on w3.org.

如果您要显示的页面为空,则正文的高度为0,您将看到默认背景。

If the page you are displaying is empty, body will have a height of 0 and you will see the default background.

这篇关于IE8高度100%Bug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆