Flip an Image on Mouse Over with CSS



Use the transform CSS property to flip an image. You can try to run the following code to flip an image on mouseover:

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         .myimg:hover {
            transform: scaleX(-1);
         }
      </style>
   </head>
   <body>
      <h2>Heading One</h2>
      <p>Let's flip the image on mouse over:</p>
      <img class = "myimg" src = "https://www.tutorialspoint.com/python/images/python_data_science.jpg"
         alt = "Python Data Science" width = "300" height = "200">
   </body>
</html>

Updated on: 2020-06-24T08:01:49+05:30

398 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements