<div class="flip-card-container">
<div class="flip-card">
<div class="flip-card-inner">
<div class="flip-card-front">
<img src="https://placehold.co/300x200/007bff/ffffff?text=Front+Side" alt="Front">
</div>
<div class="flip-card-back">
<p>This is the back side of the card. More details here!</p>
</div>
</div>
</div>
</div>
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #e0e0e0;
font-family: Arial, sans-serif;
margin:0;
}
.flip-card-container {
background-color: transparent;
width: 300px; /* Width of the card */
height: 200px; /* Height of the card */
perspective: 1000px; /* Creates the 3D space */
}
.flip-card {
width: 100%;
height: 100%;
position: relative;
border-radius: 10px;
}
.flip-card-inner {
position: relative;
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.8s;
transform-style: preserve-3d;
}
.flip-card-container:hover .flip-card-inner {
transform: rotateY(180deg);
}
.flip-card-front,
.flip-card-back {
position: absolute;
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}
.flip-card-front {
background-color: #007bff;
color: white;
}
.flip-card-front img {
width: 100%;
height: 100%;
object-fit: cover;
}
.flip-card-back {
background-color: #28a745;
color: white;
transform: rotateY(180deg);
padding: 20px;
box-sizing: border-box;
}