Rotate And Flip Images Using CSS3
Last Updated : Jul 1, 2023
In this tutorial we will show you how to rotate and flip images using CSS3.You may also like Image Zoom In On Hover Using CSS3
CHECK OUT THIS TUTORIAL LIVE DEMO →
To Rotate And Flip Images It Takes Only One Step:-
- Make a HTML file and define markup and styling Images
Step 1. Make a HTML file and define markup and styling Images
We make a HTML file and save it with a name images.html
<html> <head> <style> body { width:100%; margin:0 auto; padding:0px; background-color:#CEE3F6; font-family:helvetica; } #wrapper { text-align:center; margin:0 auto; padding:0px; width:100%; } h1 { margin-top:50px; color:#2E9AFE; } h1 p { font-size:14px; color:white; } img { width:250px; margin:20px; -moz-transition: all 0.3s; -o-transition: all 0.3s; -webkit-transition: all 0.3s; transition: all 0.3s; } #img1:hover { -moz-transform: rotate(180deg); -o-transform: rotate(180deg); -webkit-transform: rotate(180deg); transform: rotate(180deg); } #img2:hover { -moz-transform: scaleX(-1); -o-transform: scaleX(-1); -webkit-transform: scaleX(-1); transform: scaleX(-1); } </style> </head> <body> <div id="wrapper"> <img src="images/image1.jpg" id="img1"> <img src="images/image2.jpg" id="img2"> </div> </body> </html>
In this step we create two images one is for rotating effect and another is for flip effect.In our CSS
we use CSS3 transform property to rotate and flip image.
transform:rotate() is used to rotate the image and transform:scaleX is used to flip the image. You may also like Animated Login and SignUp Form With Flip Animation using CSS3 and jQuery
Thats all, this is how to Rotate And Flip Images Using CSS3. You can customize this code further as per your requirement. And please feel free to give comments on this tutorial.
I hope this tutorial on rotate image using css and flip image using CSS helps you and the steps and method mentioned above are easy to follow and implement.