<!DOCTYPE html><html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> <style type="text/css"> .outer{ width: 320px; height: 320px; position: relative; } .outer>div{ position: absolute; transition: all 2s; backface-visibility: hidden; } .outer:hover .front{ transform: rotateY(180deg); } .outer:hover .back{ transform: rotateY(0deg); } .back{ width: 320px; height: 320px; background-color: blue; transform: rotateY(180deg); } .front{ width: 320px; height: 320px; background-color: red; } </style> </head> <body> <div class="outer"> <div class="back"> </div> <div class="front"> </div> </div> </body></html>