Skip to content

A decade of Canvas, now with AI.

How it works
Bootstrap 5Layout

Bootstrap 5 Hero Section

A Hero Section is the large introductory block at the top of a page, combining a headline, supporting text, and one or two calls to action, often alongside an image or background. Bootstrap 5 has no dedicated hero class (the Bootstrap 4 .jumbotron was removed), so heroes are built from the container, grid, spacing, display heading, and flex utilities. Use it on any landing page, homepage, or campaign page where visitors must grasp the offer within a few seconds.

Bootstrap class

.container .row .align-items-center .py-5 .display-4 .lead

Common use cases

  • A SaaS homepage hero with a benefit-led headline, a free trial button, and a dashboard screenshot on the right.
  • A restaurant landing page with a full-height background photo, the opening hours, and a Reserve a Table button.
  • A webinar registration page with a centered headline, event date, and a single sign-up CTA above the fold.
  • A real estate agency hero with an overlay image of a featured property and a prominent search or enquiry button.

Variants and classes

VariantDescription and classes
Centered heroA single column of centered text with a narrow max width so the headline stays readable..container .text-center .py-5 .display-4 .fw-bold .col-lg-8 .mx-auto .lead
Split heroText on one side and an image or product screenshot on the other, stacking on small screens..container .row .align-items-center .g-5 .col-lg-6 .img-fluid
Full-height heroFills the viewport and vertically centers its content, common for homepage openers..min-vh-100 .d-flex .align-items-center
Dark heroUses a dark background with light text for strong contrast and a more premium feel..bg-dark .text-white .py-5 .btn .btn-light .btn-lg
Background image with overlayPlaces text over a photo, with an absolutely positioned dark layer to keep the text legible..position-relative .position-absolute .top-0 .start-0 .w-100 .h-100 .bg-dark .opacity-50 .text-white
Rounded callout heroA contained, padded box that replicates the old jumbotron look inside a page layout..p-5 .mb-4 .bg-body-tertiary .rounded-3

Code example

HTML
<section class="bg-dark text-white py-5">
  <div class="container py-lg-5">
    <div class="row align-items-center g-5">
      <div class="col-lg-6">
        <h1 class="display-4 fw-bold mb-3">Book your next appointment in 30 seconds</h1>
        <p class="lead mb-4">Online scheduling for independent clinics, with automatic reminders that cut no-shows by up to 40%.</p>
        <div class="d-flex flex-column flex-sm-row gap-3">
          <a href="/signup" class="btn btn-primary btn-lg px-4">Start free trial</a>
          <a href="/demo" class="btn btn-outline-light btn-lg px-4">Watch demo</a>
        </div>
      </div>
      <div class="col-lg-6">
        <img src="images/dashboard.webp" class="img-fluid rounded-3 shadow" alt="Scheduling dashboard showing a weekly calendar" width="720" height="480" fetchpriority="high">
      </div>
    </div>
  </div>
</section>

Live examples

Basic Hero Section

Example 1

Canvas template variants

Canvas Builder builds pages on the Canvas HTML template, which adds its own styled versions of Bootstrap 5 components. Variants you can ask for in a prompt:

  • Canvas Builder generates full-width hero sections using Canvas template section wrappers, with your brand colours applied to buttons, accents, and overlays rather than default Bootstrap blue.
  • Split layouts pair a headline, subheading, and dual CTA buttons with an image column, using Bootstrap's responsive grid so the image drops below the text on mobile.
  • Dark and image-backed variants add an overlay and light text classes automatically, keeping headline contrast readable over photography.

Best practices

Use one H1 and make it the hero headline

Put the primary keyword and value proposition in a single <h1 class="display-4">. Style size with display classes instead of switching heading levels, so the document outline stays correct.

Limit the line length of hero text

Wrap centered copy in .col-lg-8 .mx-auto or set a max-width on the paragraph. Lines wider than about 70 characters are harder to read and make the hero feel unfocused.

Stack buttons on mobile with flex utilities

Use .d-flex .flex-column .flex-sm-row .gap-3 so CTAs are full-width and easy to tap on phones, then sit side by side from the sm breakpoint upward.

Do not lazy-load the hero image

The hero image is usually the Largest Contentful Paint element. Skip loading="lazy", add fetchpriority="high", and set width and height attributes to avoid layout shift.

Check overlay contrast, not just the photo

When text sits on an image, use a dark layer with .bg-dark .opacity-50 or a CSS gradient and test the contrast ratio. White text should reach at least 4.5:1 against the busiest part of the image.

FAQ

Does Bootstrap 5 still have a jumbotron class?
No. The .jumbotron component was removed in Bootstrap 5. You recreate it with utilities such as .p-5 .mb-4 .bg-body-tertiary .rounded-3 (or .bg-light on versions before 5.3), and for larger heroes you combine .container, .row, and the .display-* heading classes.
How do I make a hero section full screen height?
Add .min-vh-100 .d-flex .align-items-center to the section. Using min-vh-100 rather than a fixed height lets the section grow if the content is taller than the viewport on small screens. For mobile browsers with dynamic toolbars, you can add a custom rule such as min-height: 100dvh.
How do I add a background image to a Bootstrap hero?
Set the image in CSS with background-size: cover and background-position: center on the section, then add a child overlay using .position-absolute .top-0 .start-0 .w-100 .h-100 .bg-dark .opacity-50. Put the content in a .position-relative container so it renders above the overlay. Use a CSS background for decorative images, or an <img> with object-fit: cover if the image carries meaning.
How do I customise hero colours and spacing without editing Bootstrap's source?
Override CSS variables or add a small custom class, for example .hero { --bs-body-color: #fff; background: linear-gradient(135deg, #1f2a44, #3a4f8a); }. For spacing, use responsive padding utilities like .py-5 .py-lg-6 (with a custom spacer) or .py-4 .py-md-5 so the hero scales between breakpoints.
How does Canvas Builder generate a hero section?
Canvas Builder reads your prompt and brand details, then outputs a hero built on the Canvas HTML template with Bootstrap 5 grid and utility classes. You get a headline, subtext, CTA buttons, and an image or background in the layout that fits your page, with your brand colours and responsive behaviour already applied.