问题描述
有没有人听说过在使用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%
百分比高度基于其父元素的高度。如果父元素没有显式高度,则忽略百分比并将其设置为自动。您可以在上查看更多相关资讯。
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!