How to use jumbotron in bootstrap 4?

Hi Friends 👋,

Welcome To aGuideHub! ❤️

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

Jumbotron is a lightweight grey box for displaying the key contents of the websites. It increases the size of the contents. The previous version of Bootstrap 4 had a separate class to create a Jumbotron.

Bootstrap 4 used the .jumbotron class to create the jumbotron. Use the HTML elements and Bootstrap classes to add content within the jumbotron.

Table of contents

  • Framework and cdn link
  • Define its class name
  • Included JS 3 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 4 framework CSS into the head tag of your webpage.

     <!-- Bootstrap CSS -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">

Step 2: Define its class name

After that, create the jumbotron with a class name .jumbotron.

    <div class="jumbotron">
        <h1 class="display-4">Jumbotron</h1>
        <p class="lead">This is a jumbotron created using the bootstrap 4</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-primary 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 4 JS included-->  
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
   <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/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 rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</head>

<body>

    <div class="jumbotron">
        <h1 class="display-4">Jumbotron</h1>
        <p class="lead">This is a jumbotron created using the bootstrap 4</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-primary btn-lg" href="#" role="button">Learn more</a>
    </div>

</body>

</html>

Check the output of the above code example.

Bootstrap, jumbotron-4

All the best 👍

Follow me on Twitter