CSS Flippable 3D Card Effect on Hover
In this tutorial, we aim to achieve a 3D card flip effect using solely CSS. The card will rotate smoothly from its front to its back face upon hovering over it.
Code Implementation:
<code class="css">.card { position: relative; width: 50vh; height: 80vh; perspective: 500px; margin: 10vh auto 50vh; } .front, .back { position: absolute; width: 100%; height: 100%; transition: transform 1s; backface-visibility: hidden; transform-style: preserve-3d; } .front { background-color: #66ccff; } .back { background-color: #dd8800; transform: rotateY(180deg); } .card:hover .front { transform: rotateY(180deg); } .card:hover .back { transform: rotateY(360deg); }</code>
Explanation:
The above is the detailed content of How to Rotate a 3D CSS Card on Hover Using Only CSS?. For more information, please follow other related articles on the PHP Chinese website!