所以Chrome和FF都没问题,只是IE9无法显示html背景 - 它显示了它的颜色,但没有图像。我怎么能让它在属性上工作?
在here
上测试<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
html {
width:100%;
height:100%;
background-color: #ffeacd;
background-image: url(bg.png);
background-position: 0px 0px;
background-repeat: repeat-x;
margin: 0px;
padding: 0px;
}
body {
background-position: center top;
width:100%;
height:100%;
margin: 0px;
padding: 0px;
background-image: url(bg_overlay.png);
background-repeat: no-repeat;
}
.content {
width:1020px;
height: 100%;
padding: 0px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
</style>
</head>
<body>
<div class="content"></div>
</body>
</html>
答案 0 :(得分:3)
似乎IE不允许html元素上的背景图片标记。尝试做这样的事情。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
body {
width:100%;
height:100%;
background-color: #ffeacd;
background-image: url(header-ad.png);
background-position: 0px 0px;
background-repeat: repeat-x;
margin: 0px;
padding: 0px;
}
#wrapper {
background-position: center top;
width:100%;
height:100%;
margin: 0px;
padding: 0px;
background-image: url(hdr_GSA_lp.jpg);
background-repeat: no-repeat;
}
.content {
width:1020px;
height: 100%;
padding: 0px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="content">
</div>
</div>
</body>