<!-- Confetti Background -->
<div class="confetti-container" id="confettiContainer"></div>
<!-- Main Content -->
<div class="content">
<div class="hero">
<h1>🎉 Celebrate!</h1>
<p>Beautiful animated confetti raining down</p>
<button class="celebration-btn" onclick="burstConfetti()">Add More Confetti</button>
</div>
<div class="features">
<div class="feature-card">
<div class="feature-icon">🎨</div>
<div class="feature-title">Colorful Design</div>
<div class="feature-desc">
Multiple vibrant colors including red, orange, yellow, green, cyan, blue, pink, and more creating a festive atmosphere.
</div>
</div>
<div class="feature-card">
<div class="feature-icon">✨</div>
<div class="feature-title">Pure CSS</div>
<div class="feature-desc">
Smooth animations powered entirely by CSS with optional JavaScript for interactive confetti bursts.
</div>
</div>
<div class="feature-card">
<div class="feature-icon">🎊</div>
<div class="feature-title">Multiple Shapes</div>
<div class="feature-desc">
Includes squares, circles, triangles, rectangles, and stars for variety and realistic confetti effects.
</div>
</div>
</div>
</div>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
min-height: 100vh;
overflow-x: hidden;
position: relative;
}
/* Confetti Container */
.confetti-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
pointer-events: none;
z-index: 1;
}
/* Confetti Base */
.confetti {
position: absolute;
width: 10px;
height: 10px;
opacity: 0.8;
animation: fall linear infinite;
}
/* Confetti Shapes */
.confetti.square {
border-radius: 2px;
}
.confetti.circle {
border-radius: 50%;
}
.confetti.triangle {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 10px solid;
}
.confetti.rectangle {
width: 15px;
height: 8px;
border-radius: 2px;
}
.confetti.star {
clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
/* Colors - Red */
.confetti-red { background: #ff6b6b; }
.confetti.triangle.confetti-red { border-bottom-color: #ff6b6b; }
/* Colors - Orange */
.confetti-orange { background: #ffa500; }
.confetti.triangle.confetti-orange { border-bottom-color: #ffa500; }
/* Colors - Yellow */
.confetti-yellow { background: #ffd93d; }
.confetti.triangle.confetti-yellow { border-bottom-color: #ffd93d; }
/* Colors - Green */
.confetti-green { background: #6bcf7f; }
.confetti.triangle.confetti-green { border-bottom-color: #6bcf7f; }
/* Colors - Cyan */
.confetti-cyan { background: #4ecdc4; }
.confetti.triangle.confetti-cyan { border-bottom-color: #4ecdc4; }
/* Colors - Blue */
.confetti-blue { background: #1e90ff; }
.confetti.triangle.confetti-blue { border-bottom-color: #1e90ff; }
/* Colors - Pink */
.confetti-pink { background: #ff69b4; }
.confetti.triangle.confetti-pink { border-bottom-color: #ff69b4; }
/* Colors - Magenta */
.confetti-magenta { background: #ff1493; }
.confetti.triangle.confetti-magenta { border-bottom-color: #ff1493; }
/* Colors - Lime */
.confetti-lime { background: #32cd32; }
.confetti.triangle.confetti-lime { border-bottom-color: #32cd32; }
/* Colors - Gold */
.confetti-gold { background: #ffd700; }
.confetti.triangle.confetti-gold { border-bottom-color: #ffd700; }
/* Fall Animation */
@keyframes fall {
0% {
transform: translateY(-100px) rotate(0deg);
opacity: 1;
}
100% {
transform: translateY(100vh) rotate(720deg);
opacity: 0.3;
}
}
/* Swing Animation */
@keyframes swing {
0%, 100% {
transform: translateX(0) rotate(0deg);
}
25% {
transform: translateX(50px) rotate(90deg);
}
50% {
transform: translateX(0) rotate(180deg);
}
75% {
transform: translateX(-50px) rotate(270deg);
}
}
/* Spin Animation */
@keyframes spin {
0% {
transform: rotate(0deg) scale(1);
}
50% {
transform: rotate(180deg) scale(1.2);
}
100% {
transform: rotate(360deg) scale(1);
}
}
/* Content Layer */
.content {
position: relative;
z-index: 10;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40px 20px;
}
.hero {
text-align: center;
color: white;
animation: fadeInUp 1s ease;
}
.hero h1 {
font-size: 4.5rem;
font-weight: 700;
margin-bottom: 20px;
background: linear-gradient(45deg, #ff6b6b, #ffa500, #ffd93d, #6bcf7f, #4ecdc4, #1e90ff, #ff69b4);
background-size: 200% 200%;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
animation: gradientShift 3s ease infinite;
}
@keyframes gradientShift {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
.hero p {
font-size: 1.5rem;
margin-bottom: 40px;
color: rgba(255, 255, 255, 0.9);
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(50px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.celebration-btn {
background: linear-gradient(135deg, #ff6b6b 0%, #ffa500 100%);
color: white;
padding: 18px 45px;
border: none;
border-radius: 50px;
font-size: 1.3rem;
font-weight: 700;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 10px 30px rgba(255, 107, 107, 0.4);
text-transform: uppercase;
letter-spacing: 2px;
animation: fadeInUp 1s ease 0.3s backwards;
}
.celebration-btn:hover {
transform: translateY(-5px) scale(1.05);
box-shadow: 0 15px 40px rgba(255, 107, 107, 0.6);
}
.celebration-btn:active {
transform: translateY(-2px) scale(1.02);
}
/* Feature Cards */
.features {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 30px;
max-width: 1200px;
margin-top: 80px;
width: 100%;
}
.feature-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border-radius: 20px;
padding: 40px;
border: 2px solid rgba(255, 255, 255, 0.2);
transition: all 0.4s ease;
animation: fadeInUp 1s ease backwards;
}
.feature-card:nth-child(1) { animation-delay: 0.5s; }
.feature-card:nth-child(2) { animation-delay: 0.7s; }
.feature-card:nth-child(3) { animation-delay: 0.9s; }
.feature-card:hover {
transform: translateY(-15px);
background: rgba(255, 255, 255, 0.15);
border-color: rgba(255, 255, 255, 0.4);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}
.feature-icon {
font-size: 4rem;
margin-bottom: 20px;
animation: bounce 2s ease-in-out infinite;
}
.feature-card:nth-child(2) .feature-icon {
animation-delay: 0.3s;
}
.feature-card:nth-child(3) .feature-icon {
animation-delay: 0.6s;
}
@keyframes bounce {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-15px);
}
}
.feature-title {
font-size: 1.8rem;
color: white;
font-weight: 700;
margin-bottom: 15px;
}
.feature-desc {
color: rgba(255, 255, 255, 0.8);
line-height: 1.8;
font-size: 1.1rem;
}
@media (max-width: 768px) {
.hero h1 {
font-size: 2.5rem;
}
.hero p {
font-size: 1.2rem;
}
.celebration-btn {
padding: 15px 35px;
font-size: 1rem;
}
.features {
grid-template-columns: 1fr;
margin-top: 50px;
}
}
const container = document.getElementById('confettiContainer');
const colors = ['red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'pink', 'magenta', 'lime', 'gold'];
const shapes = ['square', 'circle', 'triangle', 'rectangle', 'star'];
function createConfetti() {
const confetti = document.createElement('div');
confetti.classList.add('confetti');
// Random shape
const shape = shapes[Math.floor(Math.random() * shapes.length)];
confetti.classList.add(shape);
// Random color
const color = colors[Math.floor(Math.random() * colors.length)];
confetti.classList.add('confetti-' + color);
// Random position
confetti.style.left = Math.random() * 100 + '%';
// Random size
const size = Math.random() * 10 + 8;
if (shape !== 'triangle') {
confetti.style.width = size + 'px';
confetti.style.height = size + 'px';
}
if (shape === 'rectangle') {
confetti.style.width = (size * 1.5) + 'px';
}
// Random animation duration
const duration = Math.random() * 3 + 3;
confetti.style.animationDuration = duration + 's';
// Random delay
confetti.style.animationDelay = Math.random() * 2 + 's';
container.appendChild(confetti);
// Remove after animation
setTimeout(() => {
confetti.remove();
}, (duration + 2) * 1000);
}
// Create initial confetti
function initConfetti() {
for (let i = 0; i < 80; i++) {
setTimeout(createConfetti, i * 100);
}
}
// Continuous confetti
function continuousConfetti() {
createConfetti();
setTimeout(continuousConfetti, 300);
}
// Burst effect
function burstConfetti() {
for (let i = 0; i < 50; i++) {
setTimeout(createConfetti, i * 30);
}
}
// Initialize
initConfetti();
setTimeout(continuousConfetti, 3000);
No comments yet. Be the first!