Hero Section

Hero patterns using layout-cover for vertical centering. Responsive without media queries.

Overview

Hero sections are prominent page areas that introduce content with a headline, supporting text, and call-to-action buttons. This snippet uses <layout-cover> for vertical centering, <layout-center> for horizontal alignment, and semantic <nav> with <ul> for CTA button groups.

Key features:

  • Vertical centering with layout-cover
  • Configurable minimum height
  • Semantic <nav> for CTA links — data-layout="cluster" on the <ul>
  • Centered and split layout variants
  • Optional background image support
  • Responsive without media queries

Basic Hero

A centered hero with headline, lead text, and action buttons.

Split Layout Hero

A hero with text on one side and an image on the other, using layout-sidebar.

Background Image Hero

Add a background image with CSS custom property and overlay.

Required CSS

Add these styles to support background images with overlay:

Layout Configuration

The <layout-cover> element accepts these data attributes:

Attribute Values Description
data-layout-min CSS length (e.g., 50vh, 400px) Minimum height of the cover area.
data-layout-padding xs s m l xl 2xl Vertical padding inside the cover.

Usage Notes

  • Centering: Use layout-center to constrain content width and center horizontally
  • Text alignment: Use a .hero-content class with text-align: center; for centered content
  • CTAs: Wrap action links in <nav><ul data-layout="cluster"> — these are navigation, so use semantic list markup with data-layout on the <ul>
  • Images: Use loading="eager" for hero images since they're above the fold
  • Responsive: Split layouts automatically stack on narrow viewports

Related

Layout Cover

Cover layout element documentation

Layout Center

Center layout element documentation

Layout Sidebar

Sidebar layout element documentation