Rotating Card
Home
Snippets
Rotating Card
HTML
CSS
JS
<div class="card"> <div class="card-inner"> <div class="card-front"> <div> <h2>Front Side</h2> <p>Hover to see the back!</p> </div> </div> <div class="card-back"> <div> <h2>Back Side</h2> <p>Surprise! This is the other side.</p> </div> </div> </div> </div>
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background: linear-gradient(120deg, #1e3c72, #2a5298); font-family: Arial, sans-serif; } .card { width: 300px; height: 200px; perspective: 1000px; } .card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.8s; } .card:hover .card-inner { transform: rotateY(180deg); } .card-front, .card-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; justify-content: center; align-items: center; border-radius: 10px; box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3); } .card-front { background: #ffffff; color: #333; } .card-back { background: #f76c6c; color: #ffffff; transform: rotateY(180deg); } h2 { margin: 0; font-size: 1.5em; } p { margin: 10px 0 0; font-size: 1em; }
//javascript
Ad #1
Ad #2
Scroll to Top