CSS Card Animation Effect
Welcome to our tutorial on creating a simple and stylish card animation effect using CSS. This effect flips the card to reveal its backside when you hover over it, making it perfect for enhancing your website's interactivity.
Here’s the code you can use to create the effect:
<div class="card-container">
<div class="card">
<div class="front">Front Side</div>
<div class="back">Back Side</div>
</div>
</div>
To style this card, use the following CSS:
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
}
.card-container {
perspective: 1000px;
}
.card {
width: 300px;
height: 200px;
position: relative;
transform-style: preserve-3d;
transition: transform 0.6s;
}
.card:hover {
transform: rotateY(180deg);
}
.card .front,
.card .back {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
display: flex;
justify-content: center;
align-items: center;
font-size: 1.5rem;
color: #fff;
}
.card .front {
background-color: #007bff;
}
.card .back {
background-color: #28a745;
transform: rotateY(180deg);
}
Here’s a live demo of the card animation effect:
Front Side
Back Side
Isn't that amazing? You can easily implement this effect on your website or blog to make it more visually appealing. Stay tuned for more tutorials!