簡體   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