-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Open
Description
<title>Happy Birthday!</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
</style>
<script>
const confettiContainer = document.getElementById('confetti-container');
function dropConfettiPiece() {
const piece = document.createElement('div');
piece.textContent = '🎉'; // you can change to 🎊✨ etc.
piece.classList.add('confetti');
// random horizontal position and size
piece.style.left = Math.random() * 100 + 'vw';
piece.style.fontSize = (16 + Math.random() * 16) + 'px';
confettiContainer.appendChild(piece);
// remove after animation
setTimeout(() => {
piece.remove();
}, 4000);
}
// continuous gentle confetti
setInterval(dropConfettiPiece, 250);
// extra burst when button clicked
document.getElementById('wish-btn').addEventListener('click', () => {
for (let i = 0; i < 30; i++) {
setTimeout(dropConfettiPiece, i * 50);
}
});
</script>
body {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
font-family: Arial, sans-serif;
background: linear-gradient(135deg, #ff9a9e, #fad0c4);
overflow: hidden; /* so confetti doesn't create scrollbars */
}
.card {
background: #ffffffcc;
padding: 30px 40px;
border-radius: 16px;
text-align: center;
max-width: 420px;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
border: 3px solid #ff6f91;
position: relative;
z-index: 1;
}
h1 {
font-size: 2.2rem;
color: #ff3b6f;
margin-bottom: 10px;
}
h2 {
font-size: 1.4rem;
color: #555;
margin-bottom: 20px;
}
p {
font-size: 1rem;
color: #444;
line-height: 1.6;
margin-bottom: 20px;
}
.name {
font-weight: bold;
color: #ff3b6f;
}
.btn {
display: inline-block;
padding: 10px 20px;
border-radius: 999px;
background: #ff6f91;
color: #fff;
text-decoration: none;
font-weight: bold;
transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
cursor: pointer;
}
.btn:hover {
background: #ff3b6f;
transform: translateY(-2px);
box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}
.emoji {
font-size: 2.5rem;
margin-bottom: 10px;
}
.footer {
margin-top: 10px;
font-size: 0.85rem;
color: #777;
}
/* Confetti container + pieces */
#confetti-container {
position: fixed;
inset: 0;
pointer-events: none;
overflow: hidden;
z-index: 0;
}
.confetti {
position: absolute;
top: -40px;
font-size: 24px;
animation: fall 4s linear forwards;
}
@keyframes fall {
0% {
transform: translateY(0) rotate(0deg);
opacity: 1;
}
100% {
transform: translateY(110vh) rotate(360deg);
opacity: 0;
}
}
🎂🎉
Happy Birthday!
Dear Your Friend's Name,
Wishing you a day filled with smiles, laughter, and all your favorite things. May this year bring you lots of happiness and success!
Make a wish ✨<div class="footer">
Made with ❤️ just for you.
</div>
Metadata
Metadata
Assignees
Labels
No labels