Home > Article > Web Front-end > Why Isn\'t My CSS3 Spin Animation Working in Chrome?
In your provided HTML code, you have applied various CSS3 animation properties to a div element. However, the animation does not appear to be functioning despite using the latest stable release of Chrome.
To use CSS3 Animation effectively, you must adhere to a specific sequence of steps:
In your code, you have defined the animation properties but not the animation keyframes. To resolve this, add the following keyframes rule:
<code class="css">@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }</code>
This keyframes rule specifies that the element should rotate from 0 degrees to 360 degrees during the animation.
With the keyframes rule added, your code should now be as follows:
<code class="html"><div> </div></code>
<code class="css">div { ... (same animation properties as before) } @-ms-keyframes spin { from { -ms-transform: rotate(0deg); } to { -ms-transform: rotate(360deg); } } @-moz-keyframes spin { from { -moz-transform: rotate(0deg); } to { -moz-transform: rotate(360deg); } } @-webkit-keyframes spin { from { -webkit-transform: rotate(0deg); } to { -webkit-transform: rotate(360deg); } } @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }</code>
This code should produce a spin animation for the div element.
The above is the detailed content of Why Isn\'t My CSS3 Spin Animation Working in Chrome?. For more information, please follow other related articles on the PHP Chinese website!