Method: 1. Use the animation attribute and "@keyframes" rule to define a rotation animation for the element; 2. Use the "animation-duration" attribute to set the rotation time of the control element. The syntax is "element {animation-duration" :time;}".
The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.
How to control rotation time in css3
In css, you can use the animation attribute to bind animation effects to elements and use the "@keyframes" rule Specify animation actions for elements.
Use the animation-duration attribute to define the time required for the animation to complete a cycle, in seconds or milliseconds.
The example is as follows:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> .div1{ width:100px; height:100px; background-color:pink; animation:fadenum; animation-duration:10s; } @keyframes fadenum{ 100%{transform:rotate(360deg);} } .div2{ width:100px; height:100px; background-color:pink; animation:fadenum1; animation-duration:5s; } @keyframes fadenum1{ 100%{transform:rotate(360deg);} } </style> </head> <body> <div class="div1"></div><br><br> <div class="div2"></div> </body> </html>
Output result:
(Learning video sharing: css video tutorial)
The above is the detailed content of How to control rotation time in css3. For more information, please follow other related articles on the PHP Chinese website!