Home  >  Article  >  Web Front-end  >  How to rotate an image in HTML

How to rotate an image in HTML

coldplay.xixi
coldplay.xixiOriginal
2021-03-03 15:12:2529270browse

How to rotate pictures in HTML: First add pictures in the file, and add a div with class anim in the html file; then set the style of anim and add a background image; then add a mouse hover event ;Finally set [rot_test] to loop the rotation animation.

How to rotate an image in HTML

The operating environment of this tutorial: windows7 system, html5 version, DELL G3 computer.

How to rotate pictures in HTML:

1. Create a test html file in the folder and place it as an img picture.

How to rotate an image in HTML

#2. Add a div with class anim in the html file.

How to rotate an image in HTML

3. Set the anim style and add a background image.

How to rotate an image in HTML

4. Then add the mouse hover event and play the rot_test loop rotation animation when the mouse moves to the div image.

animation:rot_test 3s infinite linear

How to rotate an image in HTML

5, rot_test’s rotation animation is implemented through transform:rotate(), looping from 0 to 360 degrees Rotation animation.

How to rotate an image in HTML

#6. Now open the test page in the browser, and the picture will rotate when you move the mouse up.

How to rotate an image in HTML

Related learning recommendations: html video tutorial

The above is the detailed content of How to rotate an image in HTML. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn