后台大小在IE8中不起作用

时间:2013-11-22 07:41:39

标签: css3 internet-explorer-8 css3pie css

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

“background-size(将始终使用图像的内在大小) - 从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);

}

背景尺寸仍无法正常工作。我的代码有什么问题吗?

2 个答案:

答案 0 :(得分:2)

我遇到了与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")*/




答案 1 :(得分:0)

IE8不支持background-size属性。

试试这个polyfill from github

使用它应该允许你在IE8中使用background-size属性而没有任何问题。

相关问题