在css中,可以使用animation属性和@keyframes规则给img图片元素设置上下浮动动画效果来让图案上下浮动;动画的快慢速度可以通过元素高度与animation中的秒数去调整。
本教程操作环境:Windows7系统、HTML5&&CSS3版本,Dell G3电脑。
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
点我点我快点我
效果图:
更多编程相关知识,请访问:编程教学!!