Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>CSS 3D Rotation Effect</title> <style> .flip-container { margin: 50px; perspective: 1000; display: inline-block; } .flip-container:hover .back { transform: rotateY(180deg); } .flip-container:hover .front { transform: rotateY(0deg); } .flip-container, .front, .back { width: 130px; height: 195px; } .card { transition: 0.6s; transform-style: preserve-3d; position: relative; } .front, .back { position: absolute; backface-visibility: hidden; transition: 0.6s; transform-style: preserve-3d; } .front { z-index: 1; transform: rotateY(-180deg); background: url("/examples/images/card-front.jpg") no-repeat; } .back { z-index: 2; transform: rotateY(0deg); background: url("/examples/images/card-back.jpg") no-repeat; } </style> </head> <body> <div class="flip-container"> <div class="card"> <div class="front"> <!-- front content --> </div> <div class="back"> <!-- back content --> </div> </div> </div> </body> </html>