我需要用CSS3动画制作一个下降盒子。该框应该在屏幕中间。它应该从顶部开始,离开屏幕并从底部到25px。我试过这个:用CSS3制作动画盒子
.box {
width : 112px;
height : 112px;
background : url(images/gift_box_small.png) no-repeat;
margin : auto;
z-index : 4;
position : relative;
/* Chrome, Safari, Opera */
-webkit-animation : box_fall 8s linear 1;
/* Standard syntax */
animation: box_fall 8s linear 1;
}
/* Chrome, Safari, Opera */
@-webkit-keyframes box_fall {
0% {top:-112px;}
100% {bottom:25px}
}
/* Standard syntax */
@keyframes box_fall {
0% {top:-112px;}
100% {bottom:25px}
}
但动画没有开始。这可能是什么原因,我该如何使它工作?这里有一个jsFiddle:http://jsfiddle.net/hpsxrjzL/
谢谢!
的'animation'确实为我工作(虽然开始和结束位置不完全匹配您的需求)没有任何变化。 – Harry 2014-10-18 07:06:37
@Harry这很奇怪......我在FF中测试它,它不会从那里开始。 – Igal 2014-10-18 07:25:09
我在Chrome中测试。也许你需要'-moz-keyframes'和'-moz-animation'。其他云动画是否有效? – Harry 2014-10-18 07:28:26