Hero Section
Preview
Edit
Download
Run
Download Options
HTML File
Download as .html file
CSS File
Download as .css file
JavaScript File
Download as .js file
Combined HTML
All code in one HTML file
Project ZIP
All files in a ZIP archive
Cancel
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Premium Hero Section</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> </head> <body> <section class="hero"> <div class="floating-elements"> <div class="floating-circle circle-1"></div> <div class="floating-circle circle-2"></div> <div class="floating-circle circle-3"></div> </div> <div class="hero-container"> <div class="hero-content"> <span class="hero-subtitle">Premium Experience</span> <h1 class="hero-title">Elevate Your <span>Digital Presence</span></h1> <p class="hero-text">We craft immersive digital experiences that captivate audiences and drive meaningful results. Our innovative approach combines cutting-edge technology with elegant design.</p> <div class="hero-buttons"> <a href="#" class="btn btn-primary">Get Started <i class="fas fa-arrow-right"></i></a> <a href="#" class="btn btn-secondary">Explore More <i class="fas fa-play"></i></a> </div> </div> <div class="hero-image"> <div class="image-container"> <img src="https://images.unsplash.com/photo-1551288049-bebda4e38f71?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80" alt="Digital Solution"> </div> <div class="image-badge"> <i class="fas fa-trophy"></i> </div> </div> </div> </section> </body> </html>
CSS
/* ===== Global Variables ===== */ :root { --primary-blue: #3498db; --dark-blue: #2980b9; --navy-blue: #2c3e50; --light-blue: #e1f5fe; --white: #ffffff; --black: #2d3436; --gray: #636e72; --transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1); --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); } * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Montserrat', sans-serif; } body { background-color: #f8fafc; color: var(--black); overflow-x: hidden; line-height: 1.6; } /* ===== Hero Section ===== */ .hero { position: relative; height: 100vh; min-height: 800px; display: flex; align-items: center; overflow: hidden; background: linear-gradient(135deg, var(--navy-blue), var(--dark-blue)); } .hero::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: url('https://images.unsplash.com/photo-1516321318423-f06f85e504b3?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80') center/cover no-repeat; opacity: 0.15; z-index: 1; } .hero-container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 40px; position: relative; z-index: 3; display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: center; } .hero-content { position: relative; animation: fadeInUp 1s ease-out 0.3s both; } .hero-subtitle { display: inline-block; font-size: 1.1rem; font-weight: 600; color: var(--primary-blue); margin-bottom: 20px; letter-spacing: 2px; text-transform: uppercase; position: relative; padding-left: 60px; } .hero-subtitle::before { content: ''; position: absolute; left: 0; top: 50%; width: 40px; height: 2px; background: var(--primary-blue); transform: translateY(-50%); } .hero-title { font-size: 4rem; font-weight: 700; line-height: 1.2; color: var(--white); margin-bottom: 25px; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); } .hero-title span { color: var(--primary-blue); position: relative; } .hero-title span::after { content: ''; position: absolute; bottom: 10px; left: 0; width: 100%; height: 8px; background: rgba(52, 152, 219, 0.3); z-index: -1; } .hero-text { font-size: 1.2rem; color: rgba(255, 255, 255, 0.9); margin-bottom: 40px; max-width: 600px; } .hero-buttons { display: flex; gap: 20px; margin-top: 40px; } .btn { display: inline-flex; align-items: center; justify-content: center; padding: 18px 38px; border-radius: 50px; font-weight: 600; text-decoration: none; transition: var(--transition); position: relative; overflow: hidden; } .btn-primary { background: var(--primary-blue); color: var(--white); box-shadow: 0 10px 30px rgba(52, 152, 219, 0.5); } .btn-primary:hover { transform: translateY(-5px); box-shadow: 0 15px 40px rgba(52, 152, 219, 0.7); } .btn-secondary { background: transparent; color: var(--white); border: 2px solid rgba(255, 255, 255, 0.3); } .btn-secondary:hover { background: rgba(255, 255, 255, 0.1); border-color: transparent; transform: translateY(-5px); } .btn i { margin-left: 10px; transition: transform 0.3s ease; } .btn:hover i { transform: translateX(5px); } .hero-image { position: relative; animation: fadeInRight 1s ease-out 0.6s both; } .image-container { position: relative; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); transform: perspective(1000px) rotateY(-15deg); transition: var(--transition); } .hero-image:hover .image-container { transform: perspective(1000px) rotateY(0deg); } .image-container::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(45deg, rgba(41, 128, 185, 0.3), transparent); z-index: 2; } .image-container img { width: 100%; height: auto; display: block; transition: var(--transition); } .hero-image:hover .image-container img { transform: scale(1.05); } .image-badge { position: absolute; bottom: -30px; right: -30px; background: linear-gradient(135deg, var(--primary-blue), var(--dark-blue)); color: var(--white); padding: 25px; border-radius: 20px; box-shadow: 0 15px 40px rgba(41, 128, 185, 0.5); z-index: 3; animation: pulse 2s infinite; } .image-badge i { font-size: 2.5rem; } /* ===== Animated Elements ===== */ .floating-elements { position: absolute; width: 100%; height: 100%; top: 0; left: 0; z-index: 2; pointer-events: none; } .floating-circle { position: absolute; border-radius: 50%; background: radial-gradient(circle, var(--primary-blue), transparent); opacity: 0.1; filter: blur(10px); animation: float 15s infinite ease-in-out; } .circle-1 { width: 400px; height: 400px; top: 20%; left: 10%; animation-delay: 0s; } .circle-2 { width: 600px; height: 600px; bottom: -100px; right: -100px; animation-delay: 3s; } .circle-3 { width: 300px; height: 300px; top: 60%; left: 50%; animation-delay: 6s; } /* ===== Animations ===== */ @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes fadeInUp { from { opacity: 0; transform: translateY(50px); } to { opacity: 1; transform: translateY(0); } } @keyframes fadeInRight { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } } @keyframes float { 0% { transform: translate(0, 0) rotate(0deg); } 33% { transform: translate(30px, -30px) rotate(5deg); } 66% { transform: translate(-30px, 20px) rotate(-5deg); } 100% { transform: translate(0, 0) rotate(0deg); } } @keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } } /* ===== Responsive Adjustments ===== */ @media (max-width: 1200px) { .hero-title { font-size: 3.5rem; } .hero-container { gap: 50px; } } @media (max-width: 992px) { .hero { min-height: auto; padding: 120px 0; height: auto; } .hero-container { grid-template-columns: 1fr; text-align: center; } .hero-subtitle { padding-left: 0; margin: 0 auto 20px; } .hero-subtitle::before { display: none; } .hero-text { margin: 0 auto 30px; } .hero-buttons { justify-content: center; } .hero-image { margin-top: 60px; max-width: 600px; margin-left: auto; margin-right: auto; } .image-badge { right: -20px; bottom: -20px; } } @media (max-width: 768px) { .hero-title { font-size: 2.8rem; } .hero-text { font-size: 1.1rem; } .hero-buttons { flex-direction: column; align-items: center; } .btn { width: 100%; max-width: 300px; } } @media (max-width: 576px) { .hero-container { padding: 0 20px; } .hero-title { font-size: 2.2rem; } .hero-subtitle { font-size: 0.9rem; } .image-badge { padding: 15px; } .image-badge i { font-size: 1.8rem; } }
JavaScript
// Animation on scroll document.addEventListener('DOMContentLoaded', function() { const heroContent = document.querySelector('.hero-content'); const heroImage = document.querySelector('.hero-image'); // Trigger animations when elements are in view const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.style.animationPlayState = 'running'; } }); }, { threshold: 0.1 }); if (heroContent) observer.observe(heroContent); if (heroImage) observer.observe(heroImage); // Parallax effect for floating elements window.addEventListener('mousemove', function(e) { const x = e.clientX / window.innerWidth; const y = e.clientY / window.innerHeight; const circles = document.querySelectorAll('.floating-circle'); circles.forEach((circle, index) => { const speed = index + 1; circle.style.transform = `translate(${x * 20 * speed}px, ${y * 20 * speed}px)`; }); }); });
Output Preview
Desktop
Mobile
Fullscreen