我的CSS有一个简单的样式,它在Firefox和Chrome中很漂亮地拉伸了我的背景,但是在这个代码中,IE将背景居中,而不是相应地拉伸。
html{
background: url(images/bg4.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
} 我认为IE不能识别标签2到5,但是有没有办法通过额外的代码来实现同样的效果,或者我只是停留在IE的中心而不是拉伸它?
谢谢
(另外,我会在我的普通账号上发帖,但openID现在让我大发雷霆)
发布于 2011-04-01 02:48:56
编写仅以IE为目标的规则
html{
background: url(images/bg4.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background:url(images/bg4.jpg) no-repaeat center center\9; // this rule will affect all IE verisons but other browsers
} 如果你不能用同一张图片来实现你想要的效果,你可能想要为IE制作一个自定义的图片。例如,使bg5.jpg具有已拉伸的背景。
https://stackoverflow.com/questions/5504706
复制相似问题