【发布时间】:2014-01-23 11:52:41
【问题描述】:
我试图在 css background-image 中添加多个背景来创建一个小的雪动画。我有 6 张图片:
snow_big、snow_medium、snow_small、snow_man、tree1 和 tree2
如果只使用 4 个图像来制作动画,我的动画效果很好,但是当我添加更多图像时。雪动画停止工作,它唯一的动画从左到右但不是从上到下,或者有时可能会停止。这仅在 IE10 中发生,但其他浏览器的工作我不知道我检查了序列,但它很好。 这是我使用的css代码:
.xmas_theme_animation {
background-color:navy;
height:115px;
width:345px;
background-image: url('../images/snow_big.png')
,url('../images/snow_medium.png')
,url('../images/snow_small.png')
,url('../images/snow1_snowman.png')
,url('../images/tree1.png')
,url('../images/tree2.png');
background-repeat: repeat, repeat, repeat, no-repeat, no-repeat, no-repeat;
background-position: 0 0, 0 0, 0 0, 6% bottom, 20% bottom, 40% bottom;
animation: snowfall 10s infinite linear;
}
@keyframes snowfall {
from {background-position: 0 -340px, 0 -172.5px, 0 0px, 6% bottom, 20% bottom, 40% bottom; }
to {background-position: 0 345px, 661px 172.5px, 0 345px, 6% bottom, 20% bottom, 40% bottom;}
}
那么在 css 中使用多个背景有什么限制吗??
谢谢
【问题讨论】:
-
作为一种解决方法,您可以在伪元素前后设置图像。