【问题标题】:background-size is not working in IE8背景大小在 IE8 中不起作用
【发布时间】:2013-11-22 07:41:38
【问题描述】:

参考本站:http://css3pie.com/documentation/supported-css3-features/

“背景尺寸(将始终使用图像的固有尺寸)- 从 PIE 2.0 beta 开始支持”

根据文档,PIE 2.0 beta 现在支持背景大小,但是,我不清楚如何使其在 IE8 上运行。

进行更改之前:

.navbar-inverse {
background:url('header_images/menu_bg.png');
background-size: 100% 50px;
}

代码适用于 IE9 和 IE10;但我希望它也适用于 IE8,所以我添加了两行:

.navbar-inverse {
background:url('header_images/menu_bg.png');
background-size: 100% 50px;
-pie-background: url('header7/header_images/menu_bg.png') no-repeat 100% 100% / 100% 50px;
behavior: url(header7/pie/PIE.php);

}

背景尺寸仍然不起作用。我的代码有什么问题吗?

【问题讨论】:

标签: css internet-explorer-8 css3pie


【解决方案1】:

我遇到了与 CSS3PIE 类似的问题。

我找到了我的修复here

.pie_bg{
  background: url("../images/background.jpg") left top no-repeat; 
  background-size: 100% auto;
  -pie-background: url("../images/background.jpg") left top / 100% auto no-repeat;
}

/* NB Image path must be relative to the html doc, not the css file. Alternatively, it can be an absolute path e.g. url("http://mywebsite.com/images/background.jpg")*/

【讨论】:

    【解决方案2】:

    IE8 不支持 background-size 属性。

    试试这个polyfill from github

    使用它应该可以让您在 IE8 中使用 background-size 属性而不会出现任何问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-16
      • 2013-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多