繁体   English   中英

拉伸IE7的div背景图片

[英]Stretching div background image for IE7

我被困在为div制作IE7拉伸背景图像,它不支持CSS3 background-size
基本上我需要图像拟合红色区域

Div的高度可能会有所不同,具体取决于内容。 这就是为什么我没有img伪造背景的运气,我不知道如何设置高度。

有人可以帮我吗?

谷歌进行了快速搜索(我还没有测试过,但是谷歌是一个很好的好朋友):

<style type="text/css">
  html, body {
    height: 100%;
    margin: 0;
    padding: 0;
  }
  img#bg{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
  }
  #content {
    position:relative;
    z-index:1;
  }
</style>

编辑:德普。 忘记了示例HTML

</head>

  <body>

     <img src="size-bg.jpg" alt="background image" id="bg" />
     <div id="content">Your website content.</div>

  </body>
</html>

链接自: http : //dipaksblogonline.blogspot.com/2011/01/ie-78-stretching-background-image-to.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM