Home » CSS » Bootstrap » Bootstrap Jumbotron Example

About Siddharth Seth

Siddharth Seth

Siddharth is a Software Development Professional with a Master’s degree in Computer Applications with around 12 years of experience. He is currently focused on Software Architecture, Windows Azure, JavaScript Frameworks, GIS and Big Data.

Bootstrap Jumbotron Example

In this tutorial, I will guide you through using the Jumbotron component from Bootstrap. A typical use of the Jumbotron is to draw the user’s attention to specific information. We will see how we can create one and the various options for styling it. We will also explore the responsive behavior of the Jumbotron on different size viewports.

Want to be a Bootsrap Master?

Subscribe to our newsletter and download the Bootstrap Programming Cookbook right now!

In order to get you prepared for your Bootstrap development needs, we have compiled numerous recipes to help you kick-start your projects. Besides reading them online you may download the eBook in PDF format!

 

1. Tools and Technologies

To build the example application for this example, I have used the following toolset. Some of them are required whilst others could be replaced by tools of your own choice.

  1. Bootstrap v3.3.7
  2. JQuery v1.12.4
  3. Nodejs v6.3.0
  4. Express
  5. Visual Studio Code IDE

Bootstrap is a front-end framework for designing responsive websites. We also include JQuery since Bootstrap needs it. The JQuery library makes writing JavaScript a breeze. Node.js in essence is JavaScript on the server-side. The Express module is used to create a barebones server to serve files and resources to the browser.

2. Project Layout

The project structure of our example application is as follows:

Project Layout

css
The css folder holds the Bootstrap css files taken from the Bootstrap download.
fonts
The fonts that came with the Bootstrap download are placed in this folder.
js
All Bootstrap JavaScript files and the ones we create reside in this folder.
index.js
This file is placed in the root of our project and contains code for a bare minimum web server for our use.
index.html
The index.html file contains all the HTML markup. I have used the template provided in the Getting Started section of the Bootstrap website as a start.

3. HTML Markup

In this section we will setup and write the HTML markup for our example in the index.html page. There are a couple of ways to use the Jumbotron component in a web page. We can occupy the entire width of the viewport by placing it outside of all containers. Or we can have the Jumbotron enveloped in a container which would offset it from the edges and give it round borders. Let us look at Html for both and the resultant output in each case.

3.1. Jumbotron outside of container

To achieve this we need the following Html markup:

index.html

...
    <div class="jumbotron">
        <div class="container">
            <h1>WCG -- Bootstrap Jumbotron Tutorial</h1>
            <p>This is a tutorial for Bootstrap Jumbotron Component from Web Code Geeks</p>
            <button class="btn btn-info">Details</button>
        </div>
    </div>
...

This should give us a layout with the Jumbotron occupying the entire width of the viewport and without rounded borders like in the below screenshot.

Jumbotron outside Container

3.2. Jumbotron inside of container

To implement this we would modify the Html Markup in the previous section to look like below:

index.html

...
    <div class="container">
        <div class="jumbotron">
            <h1>WCG -- Bootstrap Jumbotron Tutorial</h1>
            <p>This is a tutorial for Bootstrap Jumbotron Component from Web Code Geeks</p>
            <button class="btn btn-info">Details</button>
        </div>
    </div>
...

This would create a Jumbotron which is placed at the center with whitespace on either side and rounded corners. The output would be as below:

Jumbotron Inside Container

4. Running the Code

To run the code and see it in action you need to run the following commands at the root of the project:

> npm install

then

> node index.js

After running the above two commands we need to navigate to the Url http://localhost:8090 to arrive at the below page:

Jumbotron Demo

5. Download the Source Code

You can download the source code for this example below:

Download
You can download the full source code of this example here : WCG — Bootstrap Jumbotron Tutorial

Do you want to know how to develop your skillset to become a Web Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. Building web apps with Node.js

2. HTML5 Programming Cookbook

3. CSS Programming Cookbook

4. AngularJS Programming Cookbook

5. jQuery Programming Cookbook

6. Bootstrap Programming Cookbook

 

and many more ....

 

 

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz