How to flip an image (add a mirror effect) with CSS?

Following is the code to flip and image using CSS −


 Live Demo

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
img:hover {
   transform: scaleX(-1);
   width: 400;
   height: 400;
<h1>Flipping an Image Example</h1>
<img src="">
<h1>Hover over the above image to see it mirrored</h1>


The above code will produce the following output −

On hovering the image the image will be mirrored as follows −