在css中,可以使用animation属性和@keyframes规则给img图片元素设置上下浮动动画效果来让图案上下浮动;动画的快慢速度可以通过元素高度与animation中的秒数去调整。
css3实现一个上下浮动的动画效果(animation)
CSS
@keyframes movepoint {
25% {
top: 16px
}
100%,
{
top: 50px
}
}
.shade-button-point {
display: inline-block;
position: absolute;
top: 50px;
left: 30%;
animation: movepoint 2s infinite;
-webkit-animation: movepoint 2s infinite;
}HTML
效果图:

上一篇:css行内样式是什么
下一篇:css让背景图片不重复的方法