IE背景大小不起作用 [英] IE background size not working
本文介绍了IE背景大小不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使背景拉伸整个身体(仅宽度).这仅适用于 Chrome、Opera 和 Firefox.我怎样才能在 IE 上也能做到这一点?O_o
I'm trying to make a background stretch the entire body (width only). This works only on Chrome,Opera and Firefox. How can I make this work on IE too? O_o
background-size:100%;
-moz-background-size: auto 100%;
-o-background-size: auto 100%;
推荐答案
因为 background-size 是 CSS3 特定的,所以你必须使用类似的东西才能在 IE 中工作
since background-size is CSS3 specific your gonna have to use something like this for it to work in IE
将您的 html 和正文设置为
set your html and body to
html {overflow-y:hidden}
body {overflow-y:auto}
用 div #page-background 包裹你想要全屏显示的图像
wrap the image you want fullscreened with a div #page-background
#page-background {position:absolute; z-index:-1}
然后把它放到你的html文件中
then put this in your html file
<div id="page-background">
<img src="/path/to/your/image" width="100%" height="100%">
</div>
** 你将不得不使用某种重置来删除边距和填充,就像这样
** you will have to use some sort of reset to remove the margins and paddings, something like this
html, body {height:100%; margin:0; padding:0;}
这篇关于IE背景大小不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文