Home >Web Front-end >CSS Tutorial >How to set the image to rotate in css
How to set the image to rotate continuously in css: You can set it by using the animation attribute and transform attribute, such as [-webkit-transform: rotate(360deg); animation: rotation;].
The operating environment of this tutorial: Windows 10 system, CSS3 version. This method is suitable for all brands of computers.
(Learning video sharing: css video tutorial)
How to set the image to rotate continuously in css:
Related attributes :
animation animation attribute
animation: name duration timing-function delay iteration-count direction fill-mode play-state;
Attribute value:
animation-name Specifies the name of the keyframe to be bound to the selector
animation-duration Specifies how many seconds or milliseconds the animation takes to complete
transform: none|transform-functions;Attribute value:
<div class="demo"> <img class="an img" src="/test/img/2.png" style="max-width:90%" style="max-width:90%"/ alt="How to set the image to rotate in css" > </div>Rotation code:
.demo{ text-align: center; margin-top: 100px; } @-webkit-keyframes rotation{ from {-webkit-transform: rotate(0deg);} to {-webkit-transform: rotate(360deg);} } .an{ -webkit-transform: rotate(360deg); animation: rotation 3s linear infinite; -moz-animation: rotation 3s linear infinite; -webkit-animation: rotation 3s linear infinite; -o-animation: rotation 3s linear infinite; } .img{border-radius: 250px;}Realization effect: Related recommendations:
The above is the detailed content of How to set the image to rotate in css. For more information, please follow other related articles on the PHP Chinese website!