在IE中看不到背景图像/颜色

时间:2013-01-07 02:17:35

标签: css internet-explorer background background-image

我正在使用此方案用于桌面背景。对于主页,我使用body标签和#34; gd",因此背景在主页上给出。给定的css在FF,Chrome,Safari中工作正常,但是我遇到了IE浏览器的问题。

body{  
color:#0066cc;  
background:white;  
padding-top:20px;  
min-width:500px;  
height:100%;  
}

和主页的这种风格

body.gd{  
background:#87ceeb url("../images/bg.jpg") bottom center no-repeat !important;  
background-color:#87ceeb !important;  /*P.S. This line just added for testing */  
}

.gd类中的最后一行甚至没有显示背景颜色,IE可能不接受带有 gd 类的body标签,但是在这个类中如何可以克服这种行为

  

P.S。我使用的是IE9,IE8和IE7。其中三个没有出现。

1 个答案:

答案 0 :(得分:0)

感谢@ 7th comment的帮助。 这里的问题是使用html标记。

之前是

html{  
background-color:#ffffff;  
zoom:1;  
**background-color:transparent\9;**  
-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffffff, endColorstr=#ffffffff)";  
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffffff, endColorstr=#ffffffff);  
padding:0;  
margin:0;  
}

之后

html{  
background-color:#ffffff;  
padding:0;  
margin:0;  
}

然后我意识到 background-color:transparent 正在出错。我不知道为什么IE将它继承到后台,甚至我为body标签添加了单独的样式定义。无论如何,现在,它对我来说很好。

  

<强> P.S。对此的解释将非常感谢

相关问题