Toggle navigation
☰
HTML
CSS
Scripting
Database
<!DOCTYPE html> <html> <head> <title>Hero Section Example</title> <style> body { font-family: sans-serif; margin: 0; } /* The Hero Container */ .hero { /* Set a dark, captivating background color or image */ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); /* Ensure the text inside is visible */ color: white; /* Center the text */ text-align: center; /* Use padding to make the section tall and dramatic */ padding: 100px 20px; /* Flexbox makes perfect centering easy if desired, but padding usually works well */ display: flex; flex-direction: column; align-items: center; justify-content: center; /* min-height: 80vh; Uncomment this to make it fill the screen height! */ } /* The Main Headline */ .hero h1 { font-size: 3em; /* Very large text */ margin-bottom: 20px; margin-top: 0; } /* The Sub-headline */ .hero p { font-size: 1.2em; /* Slightly larger than normal text */ max-width: 600px; /* Keep lines from getting too long */ margin-bottom: 40px; line-height: 1.6; color: #e0e0e0; } /* The Hero Call-to-Action Buttons */ .hero-buttons { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; } .btn { padding: 12px 30px; font-size: 1.1em; font-weight: bold; text-decoration: none; border-radius: 50px; /* Pill-shaped buttons are popular in hero sections */ transition: all 0.3s; } .btn-primary { background-color: white; color: #764ba2; } .btn-primary:hover { background-color: #f8f9fa; transform: translateY(-2px); } .btn-secondary { background-color: transparent; color: white; border: 2px solid white; } .btn-secondary:hover { background-color: rgba(255, 255, 255, 0.1); } @media (max-width: 600px) { .hero h1 { font-size: 2em; } .hero { padding: 60px 20px; } } </style> </head> <body> <header class="hero"> <h1>Launch Your Next Big Idea</h1> <p>Our platform provides all the tools you need to build, scale, and manage your online business beautifully and efficiently.</p> <div class="hero-buttons"> <a href="#" class="btn btn-primary">Get Started Free</a> <a href="#" class="btn btn-secondary">Learn More</a> </div> </header> </body> </html>