Bootstrap - Jumbotrons Demo


Creating a Basic Jumbotron

To create a basic Jumbotron in Bootstrap, define a container element with the class "jumbotron". This class applies default styles to the Jumbotron, giving it a padded box and a gray background color.

Example: Basic Jumbotron

<div class="jumbotron">
  <!-- Jumbotron content goes here -->

Add content to the Jumbotron. You can include headings, paragraphs, images, or any other HTML elements inside the Jumbotron container.

Example: Jumbotron with Content

<div class="jumbotron">
  <h1>Welcome to My Website</h1>
  <p>This is a simple Jumbotron example.</p>

To style the Jumbotron, you can apply additional classes or use custom CSS. Bootstrap provides utility classes to modify the padding, margin, text alignment, and other properties of the Jumbotron.

Example: Centered Jumbotron

<div class="jumbotron text-center">
  <h1>Welcome to My Website</h1>
  <p>This is a centered Jumbotron.</p>

You can also use custom CSS to override the default styles of the Jumbotron.

Example: Custom Jumbotron

<div class="jumbotron" style="background-color: #f8f9fa; color: #333;">
  <h1>Custom Jumbotron</h1>
  <p>This Jumbotron has a light gray background and dark text.</p>

Customizing Jumbotron Appearance

To customize the look of a Jumbotron in Bootstrap, you can change the background color, add a background image, and change the text color and alignment.

To change the background color of the Jumbotron, use the "bg-*" classes from Bootstrap, such as "bg-primary", "bg-secondary", "bg-success", etc. These classes set predefined background colors to the Jumbotron.

Example: Jumbotron with Blue Background

<div class="jumbotron bg-info">
  <h1>Jumbotron with Blue Background</h1>
  <p>This Jumbotron has a blue background color.</p>

To add a background image to the Jumbotron, use the "background-image" CSS property on the Jumbotron container. You can also change the background size, position, and repeat properties to control how the image is shown.

Example: Jumbotron with Background Image

<div class="jumbotron" style="background-image: url('path/to/image.jpg'); background-size: cover;">
  <h1>Jumbotron with Background Image</h1>
  <p>This Jumbotron has a background image.</p>

To change the text color and alignment within the Jumbotron, use the text utility classes from Bootstrap. Classes like "text-white", "text-dark", "text-center", "text-left", and "text-right" let you change the color and alignment of the text.

Example: Jumbotron with White Text

<div class="jumbotron bg-dark text-white text-center">
  <h1>Jumbotron with White Text</h1>
  <p>This Jumbotron has white text and is center-aligned.</p>

By mixing these customization options, you can create good-looking and unique Jumbotrons that match your website's design and branding.

Adding Buttons to Jumbotron

To add buttons to a Jumbotron in Bootstrap, create button elements inside the Jumbotron container. Use the btn class to style the buttons and add extra classes to change the button's look and behavior.

Example 1

<div class="jumbotron">
  <h1>Welcome to My Website</h1>
  <p>Click the button below to learn more.</p>
  <a class="btn btn-primary" href="#" role="button">Learn More</a>

To style the button, use the btn-* classes from Bootstrap, such as btn-primary, btn-secondary, btn-success, etc. These classes apply predefined colors and styles to the button.

Example 2

<div class="jumbotron">
  <h1>Join Our Newsletter</h1>
  <p>Stay updated with our latest news and offers.</p>
  <a class="btn btn-success btn-lg" href="#" role="button">Subscribe Now</a>

You can also use extra classes to change the size of the button, such as btn-lg for large buttons or btn-sm for small buttons.

To add functionality to the button, you can use JavaScript to handle click events or link the button to another page using the href attribute.

Example 3

<div class="jumbotron">
  <h1>Download Our App</h1>
  <p>Experience our app on your mobile device.</p>
  <a class="btn btn-primary btn-lg" href="" role="button" target="_blank">Download Now</a>

By adding buttons to your Jumbotron, you can encourage users to take specific actions, such as signing up, downloading content, or exploring more of your website.

Responsive Jumbotron

To make a Jumbotron responsive in Bootstrap, you don't need to add extra classes or styles. Jumbotrons are responsive by default and will adjust their layout and sizing based on the screen size.

Bootstrap uses a mobile-first approach, which means that the styles are defined for small screens first and then adjusted for larger screens using media queries. This makes sure that your Jumbotron looks good on all devices.

Example: Responsive Jumbotron

<div class="jumbotron">
  <h1>Responsive Jumbotron</h1>
  <p>This Jumbotron automatically adjusts its layout and sizing based on the screen size.</p>

However, you may need to adjust the content within the Jumbotron to make it look better on different screen sizes. This is where Bootstrap's responsive utility classes come in handy.

You can use classes like text-sm-center, text-md-left, text-lg-right to change the text alignment based on the screen size. You can also use classes like d-none, d-sm-block, d-md-inline to show or hide elements based on the screen size.

Example: Responsive Jumbotron with Utility Classes

<div class="jumbotron">
  <h1 class="text-sm-center text-md-left">Responsive Jumbotron</h1>
  <p class="d-none d-sm-block">This content is hidden on extra small screens and shown on larger screens.</p>
  <a class="btn btn-primary btn-lg d-block d-sm-inline-block" href="#" role="button">Learn More</a>

By using these responsive utility classes, you can control how the content within your Jumbotron is shown on different screen sizes, making it more readable and user-friendly.

Jumbotron Variations

Bootstrap has variations of the Jumbotron component that let you change its look and behavior. Two common variations are making a full-width Jumbotron and a Jumbotron with rounded corners.

To make a full-width Jumbotron that spans the whole width of the viewport, remove the default padding and border-radius of the Jumbotron. You can do this by adding the jumbotron-fluid class to the Jumbotron container.


<div class="jumbotron jumbotron-fluid">
  <div class="container">
    <h1>Full-width Jumbotron</h1>
    <p>This Jumbotron spans the entire width of the viewport.</p>

When using the jumbotron-fluid class, wrap the content inside a container or container-fluid class to add proper spacing and alignment.

To make a Jumbotron with rounded corners, use the rounded class with the jumbotron class. This will add a border-radius to the Jumbotron, giving it rounded corners.


<div class="jumbotron rounded">
  <h1>Jumbotron with Rounded Corners</h1>
  <p>This Jumbotron has rounded corners.</p>

You can control the amount of rounding by using classes like rounded-sm, rounded-lg, or rounded-pill to get different levels of rounded corners.


<div class="jumbotron rounded-lg">
  <h1>Jumbotron with Large Rounded Corners</h1>
  <p>This Jumbotron has large rounded corners.</p>

By using these Jumbotron variations, you can make visually appealing and unique Jumbotrons that fit your website's design and layout needs.

Integrating Jumbotron with Other Components

You can integrate Jumbotron with other Bootstrap components to create more complex and visually appealing layouts. Two common components that work well with Jumbotron are the NavBar and Cards.

To use a Jumbotron with a NavBar, place the Jumbotron container below the NavBar in your HTML structure. This way, the Jumbotron will appear below the navigation menu.


<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <!-- NavBar content goes here -->

<div class="jumbotron">
  <h1>Welcome to My Website</h1>
  <p>This is a Jumbotron that appears below the NavBar.</p>

The NavBar can contain links, buttons, or a search form, providing easy navigation for your users. The Jumbotron can then be used to display a prominent message or call-to-action related to the current page.

Another way to integrate Jumbotron is by combining it with Bootstrap Cards. Cards are flexible and extensible content containers that can be used to display various types of content, such as images, text, and buttons.

To combine a Jumbotron with Cards, place the Card components inside the Jumbotron container. This allows you to create visually appealing sections with a background provided by the Jumbotron and structured content within the Cards.


<div class="jumbotron">
  <h1>Featured Products</h1>
  <p>Check out our latest offerings.</p>

  <div class="row">
    <div class="col-sm-4">
      <div class="card">
        <img src="product1.jpg" class="card-img-top" alt="Product 1">
        <div class="card-body">
          <h5 class="card-title">Product 1</h5>
          <p class="card-text">Description of Product 1.</p>
          <a href="#" class="btn btn-primary">Buy Now</a>

    <div class="col-sm-4">
      <!-- Card for Product 2 -->

    <div class="col-sm-4">
      <!-- Card for Product 3 -->

The Jumbotron acts as a container for a featured products section. The Cards inside the Jumbotron display individual products with their images, descriptions, and "Buy Now" buttons. The row and col-* classes are used to create a responsive grid layout for the Cards.

Experiment with different combinations to find the perfect layout for your website.