project demo
introduction
We’ve created a fully animated digital birthday card that flips open just like a real one, crafted carefully with clean HTML, CSS, and smooth 3D effects. The design is soft, elegant, and feels handwritten with love. Every detail, from the gradient colors to the flip animation, is made to give a warm and personal experience. This project is simple but made with real passion, just like how we usually create things with heart.
Source Code:
Scroll down to download the ZIP file of this project.
html code
The HTML code defines the full structure of the birthday card, including the front image, back image, and the message container. It organizes the card into clear sections so the styling and animations can work smoothly. Each element is placed inside a main card wrapper to keep everything aligned and centered.
Birthday Card - Dark CSS
Happy Birthday Mom
Your first digital birthday card
Handcrafted
Handcoded from scratch just for you.
Hope your day goes great
css code
The CSS code controls the entire look and feel of the birthday card, giving it colors, layout, and smooth 3D animations. It sets up gradients, shadows, and fonts to create a soft and elegant visual style. The flip animation is handled through transform properties, making the card open realistically when hovered. Each class is styled carefully to keep the design centered and aligned. Overall, the CSS brings life, movement, and personality to the structure built with HTML.
/* Style.css */
/* Import Google Font */
@import url("https://fonts.googleapis.com/css?family=Nobile:400italic,700italic");
body {
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
/* Soft pink gradient background */
background: #f7d2f1;
background: linear-gradient(90deg, rgba(247, 210, 241, 1) 0%, rgb(255, 198, 229) 50%);
height: 100vh;
}
/* Main card box */
.card {
position: relative;
width: 220px;
height: 325px;
background-color: #e6f0e6;
filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.5));
transform: rotate(-1deg);
}
/* Inner text container */
.card .container {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
width: 100%;
height: 100%;
/* Light gradient background */
background: linear-gradient(90deg, rgba(247, 210, 241, 1) 0%, rgb(250, 223, 238) 50%);
}
.strikethrough {
text-decoration: line-through;
}
/* Main header text */
.card .container #head {
font-family: 'Nobile', sans-serif;
font-size: 1em;
color: #000;
font-weight: 700;
margin-top: -30px;
margin-bottom: 20px;
}
/* Paragraph styling */
.card p {
font-size: .8em;
line-height: 1.5;
font-family: 'Nobile';
color: #6b079d;
font-style: italic;
text-align: center;
margin: 10px 20px;
}
/* Front side of the card (visible first) */
.card .front {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
width: 100%;
height: 100%;
/* Needed for 3D flip animation */
backface-visibility: hidden;
transform-style: preserve-3d;
transform-origin: 0% 50%;
transform: perspective(800px) rotateY(0deg);
transition: all .8s ease-in-out;
}
/* Ensures both images fill the card */
.card .front img,
.card .back img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* Back side of card */
.card .back {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
width: 100%;
height: 100%;
backface-visibility: visible;
filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.5));
transform-style: preserve-3d;
transform-origin: 0% 50%;
transition: all 0.8s ease-in-out;
/* Background when back is visible */
background:
radial-gradient(circle, rgba(195, 208, 214, 1) 0%, rgb(163, 230, 237) 100%);
box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.1);
}
/* Flip animation on hover */
.card:hover .front {
transform: perspective(800px) rotateY(-170deg);
background-color: #ecf0f1;
}
/* Back rotates same time as front */
.card:hover .back {
transform: perspective(800px) rotateY(-170deg);
background-color: #ecf0f1;
}