搜索文档
首页
HTML/CSS
JavaScript
服务端开发
Java教程
移动端
数据库
当前位置:
首页
HTML/CSS
CSS 教程
CSS 基础教程
源代码
清空
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>CSS3 抖动动画示例- div.cn 基础教程</title> <style> .box { margin: 50px; width:120px; height:110px; background: url("/run/images/star-fish-transparent.png") no-repeat; position: relative; left: 0; /* Chrome, Safari, Opera */ -webkit-animation-name: shakeit; -webkit-animation-duration: 2s; /* Standard syntax */ animation-name: shakeit; animation-duration: 2s; } /* Chrome, Safari, Opera */ @-webkit-keyframes shakeit { 12.5% {left: -50px;} 25% {left: 50px;} 37.5% {left: -25px;} 50% {left: 25px;} 62.5% {left: -10px;} 75% {left: 10px;} } /* Standard syntax */ @keyframes shakeit { 12.5% {left: -50px;} 25% {left: 50px;} 37.5% {left: -25px;} 50% {left: 25px;} 62.5% {left: -10px;} 75% {left: 10px;} } </style> </head> <body> <p><strong>Note:</strong> Click the "Show Output" button to repeat the animation.</p> <div class="box"></div> </body> </html>
运行结果