CSS 3动画在Chrome中运行,而不是在FF和IE中

时间:2015-04-03 19:12:04

标签: html css css3 css-animations

我有一个背景图片动画可以在Chrome中运行,但在Firefox和IE中没有。你知道为什么吗?

我的CSS看起来像

#banner {
    background-attachment: fixed;
    background-color: #666;
    background-image: url("../images/banner-1.jpg");
    background-position: top center;
    background-repeat: no-repeat;
    background-size: cover;
    animation-name: banner;
    animation-duration: 15s;
    animation-iteration-count: infinite;
    -webkit-animation-name: banner; 
    -webkit-animation-duration: 20s;
    -webkit-animation-iteration-count: infinite;
    -moz-animation-name: banner;
    -moz-animation-duration: 20s;
    -moz-animation-iteration-count: infinite;
}

@keyframes banner {
    0%  { background-image: url(../images/banner-1.jpg); }
    33% { background-image: url(../images/banner-2.jpg); }
    60% { background-image: url(../images/banner-2.jpg); }
    93% { background-image: url(../images/banner-3.jpg); }
}
@-moz-keyframes banner {
    0%  { background-image: url(../images/banner-1.jpg); }
    33% { background-image: url(../images/banner-2.jpg); }
    60% { background-image: url(../images/banner-2.jpg); }
    93% { background-image: url(../images/banner-3.jpg); }
}
@-webkit-keyframes banner {
    0%  { background-image: url("../images/banner-1.jpg"); }
    33% { background-image: url("../images/banner-2.jpg"); }
    60% { background-image: url("../images/banner-2.jpg"); }
    93% { background-image: url("../images/banner-3.jpg"); }
}

HTML部分是一个简单的内容

1 个答案:

答案 0 :(得分:3)

您可以在mozilla documentation中看到属性背景图片不是动画素材