第九节 css3动画之transform旋转

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>Document</title>
 6     <style type="text/css">
 7         .box{
 8             width: 100px;
 9             height: 100px;
10             background-color: gold;
11             margin: 50px auto 0;
12             transition: all 0.5s ease 0s;  /* 同时加入动画效果 */
13             transform-origin: left top;  /* 设置旋转中心 */
14             transform-origin: 50px 50px; 
15         }
16 
17         .box:hover{
18             /* transform位移比定位位移的性能更高,因为其不影响整体布局,建议使用transform位移 */
19             transform: rotate(30deg);  /* 旋转30度 */
20         }
21     </style>
22 </head>
23 <body>
24     <div class="box"></div>
25 </body>
26 </html>
原文地址:https://www.cnblogs.com/kogmaw/p/12492475.html