好的,我有这个例子:
它适用于Chrome,但在Firefox中却不行。谁知道为什么?
HTML只使用一个带.front类的div。这是CSS的代码:
.front {
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
position: static;
-webkit-animation: fading 3s infinite;
animation: fading 3s infinite;
-webkit-animation-direction: alternate;
animation-direction: alternate;
font-size: 1em;
-webkit-font-smoothing: subpixel-antialiased;
text-shadow: 0 0 1px rgba(0,0,0,0.3);
-webkit-text-stroke: 1px transparent;
}
@-webkit-keyframes fading {
0%, 35% { background-image: url('http://khongthe.com/wallpapers/people/pretty-woman-65379.jpg'); }
65%, 100% { background-image: url('http://www.inspiringwomen.co.za/wp-content/uploads/2010/08/happy-woman-hd-1080p-wallpapers-download.jpg'); }
}
@keyframes fading {
0%, 35% { background-image: url('http://khongthe.com/wallpapers/people/pretty-woman-65379.jpg'); }
65%, 100% { background-image: url('http://www.inspiringwomen.co.za/wp-content/uploads/2010/08/happy-woman-hd-1080p-wallpapers-download.jpg'); }
}
@-moz-keyframes fading {
0%, 35% { background-image: url('http://khongthe.com/wallpapers/people/pretty-woman-65379.jpg'); }
65%, 100% { background-image: url('http://www.inspiringwomen.co.za/wp-content/uploads/2010/08/happy-woman-hd-1080p-wallpapers-download.jpg'); }
}
答案 0 :(得分:0)
不幸的是,Firefox无法转换背景图像..所以你必须采取另一种方式。
这是另一个与您的问题相关的stackoverfow问题,有一些替代方案。 : CSS3 background image transition