More actions
No edit summary |
No edit summary |
||
Line 20: | Line 20: | ||
overflow: hidden; | overflow: hidden; | ||
transform-style: preserve-3d; | transform-style: preserve-3d; | ||
} | } | ||
Line 84: | Line 79: | ||
} | } | ||
/* Add flip effect when hovered */ | /* Add flip effect when the hovered class is active */ | ||
.card | .card.hovered .card-front { | ||
transform: rotateY(180deg); /* Flip the front side */ | transform: rotateY(180deg); /* Flip the front side */ | ||
} | } | ||
/* Ensure | /* Ensure smooth flip back transition */ | ||
.card .card-front { | .card .card-front { | ||
transition: transform 0.6s ease-in-out; | transition: transform 0.6s ease-in-out; | ||
} | } | ||
/* | /* Ensure the back side is hidden when flipped */ | ||
.card .card-back { | |||
transition: transform 0.6s ease-in-out; | |||
transform | transform: rotateY(180deg); /* Keep back rotated when flipped */ | ||
transform: rotateY(180deg); /* | |||
} | } |
Revision as of 18:56, 22 December 2024
/* Container for the card */
.card-container {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
gap: 20px;
margin: 20px;
}
/* The main card */
.card {
width: 300px;
height: 200px;
position: relative;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: transform 0.6s ease-in-out; /* Smooth flip transition */
overflow: hidden;
transform-style: preserve-3d;
}
/* Front side of the card (before flip) */
.card-front, .card-back {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
box-sizing: border-box;
}
/* The back side of the card */
.card-back {
transform: rotateY(180deg);
display: flex;
flex-direction: row;
justify-content: space-around;
}
/* Sub-panels for the back of the card */
.sub-panel {
width: 45%;
height: 80%;
background-color: #f0f0f0;
border: 1px solid #ccc;
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
}
/* Front content of the card */
.card-content {
padding: 15px;
}
.card-content h3 {
margin: 0;
font-size: 1.25em;
color: #333;
}
.card-content p {
color: #777;
font-size: 0.95em;
margin-top: 10px;
}
/* Background image for the card */
.card-background {
background-image: url("https://www.chromengine.com/images/a/ac/ChromeEngine.png");
background-size: cover;
background-position: center;
}
/* Add flip effect when the hovered class is active */
.card.hovered .card-front {
transform: rotateY(180deg); /* Flip the front side */
}
/* Ensure smooth flip back transition */
.card .card-front {
transition: transform 0.6s ease-in-out;
}
/* Ensure the back side is hidden when flipped */
.card .card-back {
transition: transform 0.6s ease-in-out;
transform: rotateY(180deg); /* Keep back rotated when flipped */
}