Table of contents
1.
Introduction
2.
Jumbotron
2.1.
Program
2.2.
Output
2.3.
Full Width Jumbotron
2.3.1.
Program
2.3.2.
Output
3.
Page Header
3.1.
Program
3.2.
Output
4.
Combining Jumbotron and Page Header
4.1.
Program
4.2.
Output
5.
Frequently Asked Questions
5.1.
How can we start using Bootstrap?
5.2.
Are these page headers and jumbotron responsive?
5.3.
What are other classes present in bootstrap?
5.4.
How can we use the components of Bootstrap?
5.5.
Why isn't jumbotron working on Bootstrap 5?
6.
Conclusion
Last Updated: Mar 27, 2024
Easy

Bootstrap - Jumbotron and Page Header

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

While developing websites and web apps using bootstrap. There are times when the developer wants the attention of the reader to specific content.  Such situations can be easily taken care of with the help of the page header concept and jumbotron component of the bootstrap.

Bootstrap - Jumbotron and Page Header

Both classes are provided by bootstrap to give an attractive look to specific content like headers and other text which require attention from the reader. Let's look at a jumbotron and page header following how to use them in our project. 

Jumbotron

A jumbotron is a box that adds to the attractiveness of a particular text or HTML content enclosed inside it. It is colored grey and is sized big compared to the rest of the page with enlarged text. It is a lightweight, adaptable element that may span the entire viewport to highlight your site's most crucial marketing messaging.


Follow the given below steps to create a Jumbotron.

Step 1: Create a div element, and link HTML to bootstrap style and script as shown below.

Step 2: Add "jumbotron" to this div element's class list

Step 3: Now, put any HTML content inside of it.
              <div class="jumbotron"> any content </div> 

Program

<!DOCTYPE html>
<html lang="en">
	<head>
		<title>Jumbotron</title>
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" />
		<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
	</head>
	<body>
		<div class="container">
			<div class="jumbotron">
				<h3>Jumbotron</h3>
				<p class="lead">Experience the world of Bootstrap</p>
				<p>
					<a class="btn btn-primary btn-success" href="#" role="button">Log In</a>
				</p>
			</div>
		</div>
	</body>
</html>

Output

output

Full Width Jumbotron

If we want content inside to jumbotron to extend to its full width, add the "jumbotron-fluid" class to the class with "jumbotron" as well.

Program

<!DOCTYPE html>
<html lang="en">
	<head>
		<title>Jumbotron</title>
		<meta charset="utf-8" />
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
		<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.1/dist/jquery.slim.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
	</head>
	<body>
		<div class="jumbotron jumbotron-fluid">
			<div class="container">
				<h1 class="m-4">Jumbotron</h1>
				<p class="m-4">Experience the world of Bootstrap</p>
				<a class="m-4 btn btn-primary btn-success" href="#" role="button">Log In</a>
			</div>
		</div>
		<div class="container">
			<p>Connect and learn more.</p>
		</div>
	</body>
</html>

Output

output

Page Header

Page headers separate the page's content from the heading by providing extra space around the heading and a separator line below the header. This helps distinguish multiple headers from each other. This also helps in creating an impression on the reader.


Just give a "page-header" class to the header division of the Html snippet. It will automatically add extra space around headers to give a distinct look with enlarged font size and a horizontal line below the page header.


Follow the given below steps to create a page header.

Step 1: Link HTML with the style and scripts of bootstrap

Step 2: Add an element with a class of "page-header", e.g., a div

Step 3: Add text inside of this element and close it.

Program

<!DOCTYPE html>
<html lang="en">
	<head>
		<title>Jumbotron Page Header</title>
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" />
		<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
	</head>
	<body style="background-color:#a87332;">
		<div class="container">
			<div class="page-header">
				<h1 style="color:white;">Page Header</h1>
			</div>
			<h3 style="color:white;">Experience the world of Bootstrap</h3>
		</div>
	</body>
</html>

Output

output

Combining Jumbotron and Page Header

Now let us see an example of combining a jumbotron and page header.

Program

<!DOCTYPE html>
<html lang="en">
	<head>
		<title>Jumbotron Page Header</title>
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" />
		<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
	</head>
	<body style="background-color:#a87332;">
		<div class="container">
			<div class="page-header">
				<h1 style="color:white;">Bootstrap</h1>
			</div>
			<h4 style="color:white;">Code and learn</h4>
		</div>
		<br/>
		<div class="container">
			<div class="jumbotron">
				<h1>Jumbotron</h1>
				<p class="lead">Log In and learn more</p>
				<p>
					<a class="btn btn-primary btn-success" href="#" role="button">Log In</a>
				</p>
			</div>
		</div>
	</body>
</html>

Output

output

You can also see,  javascript replace

Frequently Asked Questions

How can we start using Bootstrap?

The links provided on Bootstrap's official website can be included in your file in the header, and after that, add classes to respective elements for interacting with the results.

Are these page headers and jumbotron responsive?

Yes, classes provided by bootstrap add responsiveness to the element it is attached with.

What are other classes present in bootstrap?

There are a lot of classes inside the bootstrap library. You can create beautiful designs with them easily without adding any stylesheet to the project. Bootstrap classes are made to be responsive and attractive. Some are "btn" for the button, "m" for the margin, p for padding, border-primary for border color, etc.

How can we use the components of Bootstrap?

There are many classes; for example, for dropdowns, we have .drop-down and many more provided by the bootstrap framework, which can be added to the respective elements to get used.

Why isn't jumbotron working on Bootstrap 5?

Jumbotrons are not supported by Bootstrap 5. it was first launched in the third version of bootstrap.

Conclusion

In this article, we have seen steps on how to add jumbotron and page header classes to HTML and also understood how jumbotron fluid extends the contents of the jumbotron to full-width. The use of bootstrap makes life easier and simpler. To read more about bootstrap, you can read our blogs:


You may refer to our Guided Path on Code Studios for enhancing your skill set on DSACompetitive ProgrammingSystem Design, etc. Check out essential interview questions, practice our available mock tests, look at the interview bundle for interview preparations, and so much more!

Happy Learning, Ninjas!

Live masterclass