Skip to content

Hero

Edit on GitHub

Full-width hero blocks for prominent page-level messaging with text and media layouts.

@volvo-cars/css v3.3.1

The text hero is a full-height block with the title at the top and body + actions pushed to the bottom. The vertical gap between title and body is flexible. It grows with the element’s height.

volvocars.com
Show codeHide code
<section class="text-hero" style="min-height: 740px">
<h1 slot="title">Care. By Volvo</h1>
<div slot="body">
<p>All-electric Volvo EX60</p>
<p>
A transparent monthly cost that includes service and financing. Now with
free home charging.
</p>
</div>
<div slot="action" class="button-group">
<a class="button-filled" href="#">Choose your EX60</a>
<a class="button-filled" data-color="subtle" href="#">Read more</a>
</div>
</section>

This component uses slots to give content built-in styling.

  • slot="title" - Primary heading
  • slot="body" - Supporting text
  • slot="action" - Buttons or links

The body slot has a max-width of var(--v-size-contentmax) (70ch by default) at every breakpoint.

volvocars.com
Show codeHide code
<section class="text-hero" style="min-height: 600px">
<code slot="title">title</code>
<code slot="body">body</code>
<code slot="action">action</code>
</section>

The text hero requires explicit height to create the flexible gap between the title and body+action. Without height, the body collapses directly below the title.

The recommended minimum height is 80vh.

Set height via:

  • Inline style: min-height: 80vh
  • Utility class: min-h-full (inside a sized parent)
  • Layout context: when placed in a grid or flex container that assigns height

The media hero presents a heading, body text, and action buttons above a full-width media element. On mobile the content stacks vertically; on large screens the heading occupies the left half while body and actions sit on the right.

Use a semantic <section> element (or <div>) as the root.

volvocars.com
Show codeHide code
<section class="media-hero">
<h1 slot="title">Care. By Volvo</h1>
<div slot="body">
<p>
All-electric Volvo EX60 A transparent monthly cost that includes service
and financing. Now with free home charging.
</p>
</div>
<div slot="action" class="button-group">
<a class="button-filled" href="#">Choose your EX60</a>
<a class="button-filled" data-color="subtle" href="#">Read more</a>
</div>
<img slot="media" src="/images/decorative/ex60-road.avif" alt="" />
</section>

This component uses slots to give content built-in styling.

  • slot="title" - Primary heading
  • slot="body" - Optional supporting text
  • slot="action" - Optional buttons or links
  • slot="media" - Image or video

The body slot has a max-width of var(--v-size-contentmax) (70ch by default) at every breakpoint.

volvocars.com
Show codeHide code
<section class="media-hero">
<code slot="title">title</code>
<code slot="body">body</code>
<code slot="action">action</code>
<div slot="media" class="bg-feedback-gray flex items-center justify-center">
<code>media</code>
</div>
</section>

Place all slots directly inside .media-hero, without a wrapper. Keep title, body, and action in that order, omitting any optional slots you don’t need.

The supported placement for media is on top, in between title and body or at the bottom.

volvocars.com
Show codeHide code
<section class="media-hero">
<h1 slot="title">Care. By Volvo</h1>
<img slot="media" src="/images/decorative/ex60-road.avif" alt="" />
<div slot="body">
<p>
All-electric Volvo EX60 A transparent monthly cost that includes service
and financing. Now with free home charging.
</p>
</div>
<div slot="action" class="button-group">
<a class="button-filled" href="#">Choose your EX60</a>
<a class="button-filled" data-color="subtle" href="#">Read more</a>
</div>
</section>

body and action are optional. When you omit body, action wraps below the title. When you omit action, the title placement stays the same.

volvocars.com
Show codeHide code
<section class="media-hero">
<h1 slot="title">Care. By Volvo</h1>
<div slot="action" class="button-group">
<a class="button-filled" href="#">Choose your EX60</a>
<a class="button-filled" data-color="subtle" href="#">Read more</a>
</div>
<img slot="media" src="/images/decorative/ex60-road.avif" alt="" />
</section>

The media slot includes responsive default aspect ratios that adapt across breakpoints:

Breakpoint Aspect ratio Token
sm 1:1 Square, mobile-optimized
md 3:2 Landscape, tablet
lg, xl 21:9 Desktop

These defaults can be overridden with aspect ratio utility classes on the media element:

<!-- Override to use 16:9 on all breakpoints -->
<img slot="media" class="aspect-16/9" src="…" alt="" />
<!-- Override only on desktop -->
<img slot="media" class="lg:aspect-16/9" src="…" alt="" />
  • Use semantic elements: <section> for page sections, <div> when no semantic meaning is needed
  • Choose the appropriate heading level (<h1>, <h2>) based on the page hierarchy
  • Ensure action links and buttons have meaningful text describing their destination or purpose
Class Description
text-hero Root class. Flex column with title at top, body+action pushed to bottom via auto margin.
media-hero Root class. Media first or last, or no media, uses two text columns at lg and xl when the body slot is present, with or without actions; media middle stays in one column.
button-group Layout class for the action slot. Provides responsive side-by-side button layout.