IE8背景大小问题

时间:2013-01-14 10:53:35

标签: css3 internet-explorer-8 parallax css

我目前正在构建一个视差网站,除了IE8之外,它适用于所有浏览器,因为使用了背景大小。

我已经尝试了ms过滤器,只是想知道其他人是否有解决方案。

section {
width: 100%;
position: relative;
overflow-x: hidden;
z-index: 0;

}

.parallax__one {
background: url("../Images/parallex__bg__1.png") 0px 0 no-repeat fixed;
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(     src='../Images/parallex__bg__1.png', sizingMethod='scale');
    -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader( src='../Images/parallex__bg__1.png', sizingMethod='scale')";
    /* background size */
    -webkit-background-size: 100% 100%;
-moz-background-size: 100% 100%;
-ms-background-size: 100% 100%;
-o-background-size: 100% 100%;
background-size: 100% 100%; 

}

1 个答案:

答案 0 :(得分:0)

IE8

中的

background-size does not work

您必须使用类似polyfill的内容。

https://github.com/louisremi/background-size-polyfill


自述文件中的说明:

backgroundsize.min.htc上传到您的网站,以及将发送IE所需的mime类型的.htaccess(仅限Apache - 它内置于nginx,节点和IIS)。

在CSS中使用background-size的任何地方,添加对此文件的引用。

.selector { 
    background-size: cover;
    /* The url is relative to the document, not to the css file! */
    /* Prefer absolute urls to avoid confusion. */
    -ms-behavior: url(/backgroundsize.min.htc);
}

以这种方式设置的元素应该有position: relative;position: fixed;和z-index。如果没有,他们将获得position: relative;z-index: 0;