简体   繁体   中英

Background Image being cropped in Internet Explorer

I have set a background that I am expecting to be the width of the screen behind some other divs.

I have set the z-index to -1 so it appears behind 2 divs which works fine in Chrome however, IE seems to cut the background off at the width of the containers before and after (980px)

My Code:

.container { 
  width: 980px; 
  background: transparent; 
}
.container-footer { 
  position: relative;
  background: url(images/footer-bg.png) no-repeat center top; 
  width: 100%;
  z-index: -1;
  margin-top: -100px;
  height: 200px;
}

<div class="container"> .. content .. </div>
<div class="container container-footer"></div>
<div class="container"> .. content .. </div>

Here is the effect in Chrome:

铬背景效果

Here is the effect in Internet Explorer 8:

即背景效果

The complete code can be found here: http://www.signatureblindsbrisbane.com.au/ (down the bottom (Signature Partners area)

You have a couple of issues with your Z-index.

First, DOM order originally dictates the Z-index, so the first DIV element is on the bottom (z-index: 1), second in the middle (2), and third on absolute top (3).

Second, z-index does not work at all unless you apply a specific position attribute (such as absolute or relative).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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