简体   繁体   中英

scaling background Image in IE

so, I got a bit of a problem here, I implemented my background image with this code

  <div style="
            background: url(http://oi57.tinypic.com/2wlyhd5.jpg) no-repeat center center fixed;    
            background-size:cover;
            width:100%; 
            position:fixed;
            height:100%;
            z-index:-1;">               
        </div>

problem is, when I scroll out in IE the image doesn't scale, same when zooming in, it works in the other browsers

As far as Internet Explorer is concerned you can only use Background Size from IE9+, luckily there's a workaround.

Background Size Polyfill

.selector { 
  background-size: cover;
  /* The url is relative to the document, not to the css file! */
  /* Prefer absolute urls to avoid confusion. */
  -ms-behavior: url(/backgroundsize.min.htc);
}

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