【发布时间】:2013-09-06 23:03:52
【问题描述】:
我正在测试一些 css 动画,但无法获取这些元素:在旋转之前,有什么帮助吗?
http://jsfiddle.net/gespinha/hZjkp/5/
CSS
.footerLink{
padding:20px;
background:#000;
color:#fff;
}
.footerLink:before{
content:'ABC';
margin-right:15px;
-webkit-animation: footerHoverOff .5s ease both;
-moz-animation: footerHoverOff .5s ease both;
animation: footerHoverOff .5s ease both;
}
.footerLink:hover:before{
-webkit-animation: footerHoverOn .5s ease both;
-moz-animation: footerHoverOn .5s ease both;
animation: footerHoverOn .5s ease both;
}
@-webkit-keyframes footerHoverOn{ to { -webkit-transform: scale(1.5) rotate(360deg); } }
@-moz-keyframes footerHoverOn{ to { -moz-transform: scale(1.5) rotate(360deg); } }
@keyframes footerHoverOn{ to { transform: scale(1.5) rotate(360deg); } }
@-webkit-keyframes footerHoverOff{ from { -webkit-transform: scale(1.5) rotate(360deg); } }
@-moz-keyframes footerHoverOff{ from { -moz-transform: scale(1.5) rotate(360deg); } }
@keyframes footerHoverOff{ from { transform: scale(1.5) rotate(360deg); } }
【问题讨论】:
-
它不是重复的,如果你看到有问题的代码,你会注意到我的方法是在关键帧上而不是在简单的 css 动画上。
-
尝试将
display:inline-block;添加到.footerLink:before选择器。 -
如果 simple 动画不起作用,为什么关键帧动画会起作用?
-
我已经得到了上面的答案,你应该阅读它以了解这两个问题之间的区别,因为它不是你所说的重复的帖子。
标签: css