css 圖片/元素旋轉程式碼
阿新 • • 發佈:2019-01-02
程式碼示例:
<span style="font-size:18px;"><!DOCTYPE html> <html lang="zh-cn"> <head> <style> @keyframes wml { from { transform:rotate(0); -ms-transform:rotate(0); -webkit-transform:rotate(0); -o-transform:rotate(0); -moz-transform:rotate(0) } to { transform:rotate(360deg); -ms-transform:rotate(360deg); -webkit-transform:rotate(360deg); -o-transform:rotate(360deg); -moz-transform:rotate(360deg) } }.asd { animation:wml 3s linear infinite; -moz-animation:wml 3s linear infinite; -webkit-animation:wml 3s linear infinite; -o-animation:wml 3s linear infinite } </style> </head> <body> <img class="asd" src="http://avatar.csdn.net/5/5/7/1_u013372487.jpg"> </body> </html> </span>
from 0 to 360 表示順時針旋轉
from 360 to 0 表示逆時針旋轉
3s 表示旋轉速度