简体   繁体   中英

IE background fixed resize to cover browser window

code below works in firefox, chrome, etc., but not in Internet Explorer. How to make background to cover browser window, even if there is not much text.

body {
background: -ms-linear-gradient(top, #e5e5e5 0%, #c0bfbf 100%) center center fixed; /* IE10 Consumer Preview */
background: -moz-linear-gradient(top, #e5e5e5 0%, #c0bfbf 100%) center center fixed; /* Mozilla Firefox */
background: -o-linear-gradient(top, #e5e5e5 0%, #c0bfbf 100%) center center fixed; /* Opera */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #e5e5e5), color-stop(1, #c0bfbf)) center center fixed; /* Webkit (Safari/Chrome 10) */
background: -webkit-linear-gradient(top, #e5e5e5 0%, #c0bfbf 100%) center center fixed; /* Webkit (Chrome 11+) */
background: linear-gradient(to bottom, #e5e5e5 0%, #c0bfbf 100%) center center fixed; /* W3C Markup, IE10 Release Preview */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e5e5e5', endColorstr='#c0bfbf',GradientType=0, sizingMethod='scale'); /* IE6-8 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#e5e5e5', endColorstr='#c0bfbf',GradientType=0, sizingMethod='scale')"; /* IE6-8 */

color:#393939;
font:12px/18px Arial,sans-serif;
margin:0;
padding:0px;
}

When you replace the hex codes with rgb values in the linear-gradient tag without the ms-prefix it works in IE10 on windows 8 at least

Here's what I used:

background: linear-gradient(to bottom, rgb(255,255,0) 0%, rgb(0,255,255) 100%) center center fixed; /* W3C Markup, IE10 Release Preview */

Edit, here's the example with your actual color values in it:

background: linear-gradient(to bottom, rgb(229,229,229) 0%, rgb(192,191,191) 100%) center center fixed;

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