How to use jumbotron in bootstrap 5?

Hi Friends 👋,

Welcome To aGuideHub! ❤️

Today, I am going to show you. How to use jumbotron in bootstrap with code example.

To reimplement jumbotron using Bootstrap 5 just add the .container-fluid class and add a .bg-light background color with some padding to the container class. And then use bootstrap utility classes and HTML elements to add the contents in it.

Table of contents

  • Framework and cdn link
  • Define its class name
  • Included JS bootstrap

This article will guide you to adding jumbotron in Bootstrap with example.

Step 1: Framework and cdn link

First of all, load the Bootstrap 5 framework CSS into the head tag of your webpage.

     <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">

Step 2: Define its class name

After that, create the jumbotron with a class name .container-fluid.

   <div class="container-fluid bg-light p-5">
        <h1 class="display-4">Jumbotron</h1>
        <p class="lead">This is a jumbotron created using the bootstrap 5</p>
        <hr class="my-4">
        <p>It uses utility classes for typography and spacing to space content out within the larger container.</p>
        <a class="btn btn-success btn-lg" href="#" role="button">Learn more</a>
    </div>

Step 3: Included JS bootstrap

Now, load the Bootstrap JavaScript file before closing the body tag and done.

<!--Bootstrap 5 JS included-->  
   <script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
   <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>

Example.

Let’s look at the following example to understand how it basically works:

<!DOCTYPE html>
<html lang="en">

<head>
    <title> Bootstrap </title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
</head>

<body>

    <div class="container-fluid bg-light p-5">
        <h1 class="display-4">Jumbotron</h1>
        <p class="lead">This is a jumbotron created using the bootstrap 5</p>
        <hr class="my-4">
        <p>It uses utility classes for typography and spacing to space content out within the larger container.</p>
        <a class="btn btn-success btn-lg" href="#" role="button">Learn more</a>
    </div>

</body>

</html>

Check the output of the above code example.

Bootstrap, jumbotron-5

All the best 👍