Bootstrap Technique


Bootstrap is a popular framework with many ready-to-use components to choose from. Bootstrap can optimize the code for implementing parallax scrolling.

In this chapter, let us discuss with an example how we are going to use Jumbotron component to implement parallax scrolling.

Full Width Parallax Page with Bootstrap4 Jumbotron

Imagine a website where the user is shown with a big “call-to-action” box with some content regarding a discount or sale. Usually, Jumbotron finds its application in such places. It is a big box useful to attract attention of the user.

As we are using only one component of Bootstrap, we will not create a separate CSS file for this example. Let us dive right into the HTML code.

<!DOCTYPE html>  
<html lang = "en">  
      <meta charset = "utf-8">  
      <meta name = "viewport" content = "width = device-width, initial-scale = 1, shrink-to-fit = no"> 
      <link rel = "stylesheet" href = "" 
         integrity = "sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" 
         crossorigin = "anonymous">  
            margin:15px 30px 0px 30px;  
               rgba(0, 0, 250, 0.25), 
               rgba(125, 250, 250, 0.45)),
            background-repeat: no-repeat;  
            background-attachment: fixed;  
            color:white !important;  
         .page-scroll {
         .lead {
      <div class = "jumbotron jumbotron-fluid">  
         <div class = "container">  
            <h1 class = "display-2">Jumbotron Example</h1>  
            <p class = "lead">Example text for parallax using jumbotron</p>  
      <div class = "page-scroll"> </div>  

Analysis of Code

The line 6 references Bootstrap 4 library. We are specifying the margin and border radius for jumbotron from line 8 to 11.

As we can see on line 33, we are creating a div with jumbotron class to show the big box where we will have our specific image loaded. Please note that there is no direct URL for the image this time, we are going to use a downloaded image. You can download any high resolution image for your example and specify it in line 16.

The output that you can see when you execute the above given code is shown below −

Jumbotron Example