學習了css3動畫css
<!DOCTYPE html> <html> <head> <style> #test { width:100px; height:100px; background:red; position:relative; animation:mymove infinite; animation-duration:2s; /* Safari and Chrome */ -webkit-animation:mymove infinite; -webkit-animation-duration:2s; } @keyframes mymove { from {top:0px;} to {top:200px;} } @-webkit-keyframes mymove /* Safari and Chrome */ { from {top:0px;} to {top:200px;} } </style> </head> <body> <p><strong>註釋:</strong>Internet Explorer 9 以及更早的版本不支持 animation-name 屬性。</p> <div id="test"></div> <p><b>註釋:</b>始終規定 animation-duration 屬性,不然時長爲 0,就不會播放動畫了。</p> </body> </html>
效果:html
註釋:Internet Explorer 9 以及更早的版本不支持 animation-name 屬性。css3
註釋:始終規定 animation-duration 屬性,不然時長爲 0,就不會播放動畫了。git
具體應用:github
https://github.com/fengnovo/diary/blob/master/others/css3/a.html
演示:http://htmlpreview.github.io/?https://github.com/fengnovo/diary/blob/master/others/css3/a.htmlweb