Home > Article > Web Front-end > How to Create an Image Spin or Rotation Effect on Hover Using CSS?
To achieve the desired spinning or rotating effect on an image when hovered, CSS can be utilized with specific properties and transitions. Here's how it could be implemented:
<code class="css">img { border-radius: 50%; transition: transform .7s ease-in-out; } img:hover { transform: rotate(360deg); }</code>
In the provided HTML code, each image element is modified using the above CSS styles:
<code class="html"><img src="http://i.imgur.com/3DWAbmN.jpg" /> <img src="https://i.sstatic.net/BLkKe.jpg" width="100" height="100" /></code>
This CSS implementation allows the image to smoothly rotate around its center when the mouse hovers over it.
The above is the detailed content of How to Create an Image Spin or Rotation Effect on Hover Using CSS?. For more information, please follow other related articles on the PHP Chinese website!