🧱 Bootstrap 5 Hero & Featured Sections – Build Attention-Grabbing Page Intros
🧲 Introduction – What Are Hero and Featured Sections in Bootstrap 5?
A Hero Section is the eye-catching intro area of a webpage—often containing a headline, subheading, call-to-action (CTA), and media like an image or video. Bootstrap 5 makes it easy to create responsive, visually striking hero banners and featured content using the grid system, utilities, and flexbox helpers.
🎯 In this guide, you’ll learn:
- How to create full-width hero sections with headings, text, and CTAs
- Add background images, icons, or media content to heroes
- Build responsive feature sections using
.row
,.col-*
, and.align-items-center
- Apply spacing, alignment, and typography utilities for layout control
✅ Example 1 – Simple Hero Banner with Centered Text
<section class="bg-primary text-white text-center py-5">
<div class="container">
<h1 class="display-4 fw-bold">Welcome to My Website</h1>
<p class="lead">We build modern, responsive experiences using Bootstrap 5.</p>
<a href="#services" class="btn btn-light btn-lg mt-3">Explore Services</a>
</div>
</section>
Class | Description |
---|---|
.bg-primary , .text-white | Sets background and text color |
.text-center , .py-5 | Centers content and adds vertical spacing |
.display-4 , .lead | Boosts heading and paragraph size for emphasis |
📌 Great for homepage intros, product banners, and landing pages.
✅ Example 2 – Hero with Split Layout (Image + Text)
<section class="py-5 bg-light">
<div class="container">
<div class="row align-items-center">
<div class="col-md-6 mb-4 mb-md-0">
<h2 class="fw-bold">Design That Speaks</h2>
<p class="text-muted">Build interfaces that convert. Let your layout do the talking.</p>
<a href="#" class="btn btn-primary">Get Started</a>
</div>
<div class="col-md-6 text-center">
<img src="https://via.placeholder.com/500x300" class="img-fluid" alt="Hero Graphic">
</div>
</div>
</div>
</section>
Class | Description |
---|---|
.row , .col-md-* | Creates responsive grid with image + text |
.align-items-center | Vertically centers text and image side by side |
.img-fluid | Makes image responsive within container |
📌 Perfect for product highlights, feature intros, or service showcases.
✅ Example 3 – Hero with Background Image Overlay
<section class="bg-dark text-white position-relative overflow-hidden">
<img src="https://via.placeholder.com/1200x400" class="w-100 opacity-25 position-absolute top-0 start-0 h-100 object-fit-cover" alt="Background">
<div class="container py-5 position-relative">
<h1 class="display-5 fw-bold">Your Story Starts Here</h1>
<p class="lead">Bootstrap your dream project with a modern foundation.</p>
<a href="#contact" class="btn btn-outline-light btn-lg">Contact Us</a>
</div>
</section>
Class | Purpose |
---|---|
.position-relative/absolute | Layers the background and text content |
.opacity-25 | Adds transparency to background image |
.object-fit-cover | Ensures image covers entire section cleanly |
📌 Ideal for dynamic headers with parallax or media backgrounds.
✅ Example 4 – Featured Section with Cards or Highlights
<section class="py-5">
<div class="container">
<div class="row text-center">
<div class="col-md-4 mb-4">
<div class="card h-100 shadow-sm">
<div class="card-body">
<h5 class="card-title">Fast Development</h5>
<p class="card-text">Leverage Bootstrap's grid and utility classes to speed up delivery.</p>
</div>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="card h-100 shadow-sm">
<div class="card-body">
<h5 class="card-title">Responsive Design</h5>
<p class="card-text">Create layouts that adapt to any screen with mobile-first utilities.</p>
</div>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="card h-100 shadow-sm">
<div class="card-body">
<h5 class="card-title">Modern Aesthetics</h5>
<p class="card-text">Clean design and flexible styles ready for customization.</p>
</div>
</div>
</div>
</div>
</div>
</section>
Class | Description |
---|---|
.card , .h-100 | Card containers with equal height |
.text-center | Center-aligns heading and content |
.shadow-sm | Adds subtle shadow for visual depth |
📌 Great for feature blocks, service highlights, or benefit listings.
📘 Hero & Feature Section Utility Reference
Element | Class / Utility Used | Role |
---|---|---|
Section Spacing | .py-5 , .mb-4 | Adds vertical spacing |
Typography | .display-4 , .lead , .fw-bold | Emphasizes key text |
Image Responsiveness | .img-fluid , .object-fit-cover | Ensures visual scalability across devices |
Grid System | .row , .col-* | Creates structured split layouts |
Button Design | .btn , .btn-lg , .btn-outline-* | Creates CTAs with scalable size and style |
Background Styling | .bg-* , .text-* , .opacity-* | Controls color and visibility of background elements |
🛠️ Best Practices for Hero Sections
Tip | Why It Works |
---|---|
Use .container for content boundaries | Maintains consistent alignment on all screen sizes |
Combine .py-* and .my-* utilities | Adds responsive spacing between elements |
Use .display-* headings for hierarchy | Ensures strong visual appeal and structure |
Add .btn-lg for CTAs in heroes | Draws user attention to actions |
Keep text short and punchy | Ensures readability and engagement |
📌 Summary – Recap & Next Steps
Bootstrap 5 makes it incredibly easy to design beautiful hero and featured sections using a mix of utility classes, layout components, and responsive design best practices. From bold banners to structured highlights, every section remains flexible and mobile-friendly.
🔍 Key Takeaways:
- Use
.container
,.row
, and.col-*
for responsive layouts - Apply
.display-*
,.lead
, and.fw-*
for modern typographic styling - Use
.img-fluid
and.object-fit-cover
for scalable media - Structure features with
.card
,.h-100
, and.shadow-*
utilities
⚙️ Perfect for homepage banners, product intros, landing page headers, and company highlights.
❓ FAQs – Bootstrap 5 Hero & Featured Sections
❓ Can I use Bootstrap carousel inside a hero section?
✅ Yes. Just wrap the .carousel
inside the hero <section>
with appropriate padding and layout classes.
❓ How do I make hero sections full height?
✅ Use .vh-100
or min-vh-100
on the hero container to make it 100% of the viewport height.
❓ Can I use video backgrounds in hero sections?
✅ Yes. Use a <video>
tag with position-absolute
and object-fit-cover
inside a position-relative
wrapper.
❓ Should hero sections use display-*
classes?
✅ Definitely. Classes like .display-1
to .display-6
help create bold headings and visual hierarchy.
Share Now :