【问题标题】:IE9 not rendering background-imageIE9 不呈现背景图像
【发布时间】:2012-10-20 19:21:25
【问题描述】:

我发现很多关于 IE9 不呈现背景图像的问题,但找不到适合我需要的解决方案。

我使用 CSS3 渐变生成器作为背景,它适用于除 IE9 之外的所有现代浏览器。

我使用的代码是:

body {
 background-size: cover;
 background-repeat: no-repeat;
 background-image: linear-gradient(bottom, rgb(184,190,227) 49%, rgb(118,135,250) 80%);
 background-image: -o-linear-gradient(bottom, rgb(184,190,227) 49%, rgb(118,135,250) 80%);
 background-image: -moz-linear-gradient(bottom, rgb(184,190,227) 49%, rgb(118,135,250) 80%);
 background-image: -webkit-linear-gradient(bottom, rgb(184,190,227) 49%, rgb(118,135,250) 80%);
 background-image: -ms-linear-gradient(bottom, rgb(184,190,227) 49%, rgb(118,135,250) 80%);
 background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0.49, rgb(184,190,227)),color-stop(0.8, rgb(118,135,250)));
}

我设置了一个jsFiddle页面:http://jsfiddle.net/nUA98/

所以,如果有人知道为什么它在 IE9 中不起作用,将不胜感激评论/回答。

谢谢。

【问题讨论】:

  • caniuse.com 是一个非常有用的资源:@​​987654322@
  • @Stefan 好像很完整的资源,放到我的收藏夹里,太好了!

标签: internet-explorer css internet-explorer-9 background-image


【解决方案1】:

不是IE9不渲染背景图片,只是如果要在IE9中使用渐变,就必须使用SVG。使用ColorZilla 创建渐变,并确保最后选中“IE9 支持”选项。它会自动生成一个 data-uri SVG 供您使用,而无需实际使用图像文件。

【讨论】:

    【解决方案2】:
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff', endColorstr='#f2f2f2'); 
    

    【讨论】:

      【解决方案3】:

      ie9 不支持 rgba 格式所以试试这个
      filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8cbd6', endColorstr='#edeeec',GradientType=0 ); /* IE6-9 */

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-08-10
        • 2018-11-16
        • 2020-01-15
        • 1970-01-01
        • 2018-03-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多