Background fixed & cover - Internet explorer 11

Robb picture Robb · Feb 12, 2014 · Viewed 7.2k times · Source

http://apolytos.com/new/img/test.html

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
    background:url("background.jpg");
    background-repeat:no-repeat;
    background-attachment:fixed;
    background-size: cover;
    background-position:top center;
    margin:0;
}
</style>
</head>
<body>
</body>
</html>

Internet Explorer 11 is NOT covering; view the link provided. If I remove the :fixed, it covers as it's supposed to, however the bg scrolls with content on page which is not desired. There appears to be a conflict with these 2 lines of code in IE.

Answer

Eldwin Eldwin picture Eldwin Eldwin · Feb 12, 2014

try this code, it should work well.

html { 
  background: url(images/bg.jpg) no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}