IE背景大小不工作 [英] IE background size not working

查看:97
本文介绍了IE背景大小不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让一个后台伸展整个身体(仅宽度)。这只能在Chrome,Opera和Firefox。我怎样才能让IE的这项工作呢? O_O

 背景尺寸:100%;
-moz-背景大小:汽车100%;
-o-背景大小:汽车100%;


解决方案

由于背景大小CSS3具体你要去不得不使用这样的事情为它工作在IE

您的HTML和身体设置为

  HTML {溢出-Y:隐藏}
身体{溢出-Y:汽车}

封装图像你想进入全屏模式用一个div#页面背景

 #页面背景{立场:绝对的;的z-index:-1}

那么把它放进你的HTML文件

 < D​​IV ID =页面背景>
  < IMG SRC =/路径/到/你/图片WIDTH =100%HEIGHT =100%>
< / DIV>

**,你将不得不使用某种复位去除边距和补,这样的事情

  HTML,车身高度{:100%;保证金:0;填充:0;}

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%;

解决方案

since background-size is CSS3 specific your gonna have to use something like this for it to work in IE

set your html and body to

html {overflow-y:hidden}
body {overflow-y:auto}

wrap the image you want fullscreened with a div #page-background

#page-background {position:absolute; z-index:-1}

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆