hero-sections
intermediate
hero
animation
landing
cta
particles
Category · Hero Sections Difficulty Level · Intermediate Published on · January 29, 2024

Animated Hero Section

Modern hero section with animated text, particle background, and call-to-action buttons, perfect for landing pages.

#hero #animation #landing #cta #particles

Responsive Design

Yes

Dark Mode Support

Yes

lines

411

Browser Compatibility

Chrome · Firefox · Safari · Edge

Live Preview

Interact with the component without leaving the page.

400px

Overview

Modern hero section with animated text, particle background, and call-to-action buttons, perfect for landing pages.

How to use

  1. Copy the HTML markup into your page.
  2. Paste the CSS into your stylesheet and ensure the selectors match your markup.
  3. Paste the JavaScript and load it after the markup.
  4. Adjust spacing, colors, and text to match your design system.

Customization tips

  • Rename class names to avoid collisions with your existing CSS.
  • Replace hard-coded colors with CSS variables for theming.
  • Verify the layout at 320px, 768px, and 1024px widths.
  • Test dark mode with your preferred background and text colors.

HTML

46

lines

CSS

254

lines

JavaScript

111

lines


                <section class="hero-section">
  <div class="hero-background">
    <div class="floating-shapes" aria-hidden="true">
      <div class="shape shape-1"></div>
      <div class="shape shape-2"></div>
      <div class="shape shape-3"></div>
      <div class="shape shape-4"></div>
      <div class="shape shape-5"></div>
    </div>
  </div>
  
  <div class="hero-content">
    <div class="hero-text">
      <h1 class="hero-title">
        <span class="title-line">Build Amazing</span>
        <span class="title-line highlight">Web Experiences</span>
      </h1>
      <p class="hero-subtitle">
        Create stunning websites with modern design patterns and cutting-edge technologies
      </p>
    </div>
    
    <div class="hero-actions">
      <button class="cta-primary" type="button">Get Started</button>
      <button class="cta-secondary" type="button" aria-label="Watch demo">
        <span class="play-icon" aria-hidden="true">▶</span>
        Watch Demo
      </button>
    </div>
    
    <div class="hero-stats">
      <div class="stat-item">
        <span class="stat-number" data-target="10000">0</span>
        <span class="stat-label">Happy Clients</span>
      </div>
      <div class="stat-item">
        <span class="stat-number" data-target="500">0</span>
        <span class="stat-label">Projects Done</span>
      </div>
      <div class="stat-item">
        <span class="stat-number" data-target="50">0</span>
        <span class="stat-label">Team Members</span>
      </div>
    </div>
  </div>
</section>

              
46lines
1528characters
HTMLLanguage

Browser Compatibility

Chrome

>= 50

Firefox

>= 45

Safari

>= 10

Edge

>= 15

Related Code Snippets

Explore template packs

Need larger building blocks? Browse responsive landing pages and component bundles.

Open HTML Template Library ->