Introduction to bootstrap 5 and differences between bootstrap 5 and bootstrap 4

Lalit Gour
5 min readMar 12, 2021
Bootstrap 5

Introduction

Bootstrap is an open-source framework from late 2011 that is used for designing responsive websites with a mobile-first approach faster and easier. Bootstrap is available for HTML, CSS, and JS. Bootstrap helps to design the frontend.

Why bootstrap

  • Faster and Easier
  • Mobile First style
  • It is free ! Available on www.getbootstap.com
  • Brower support
  • Responsive Design

As of now bootstrap 5 alpha version has been released and there are some differences between bootstrap 4 and bootstrap 5. Bootstrap 5 is designed to be used without the jquery.

Installation

Either way we can download the bootstrap from here https://getbootstrap.com/docs/5.0/getting-started/download and add it into our project or we can add it by using cdn like that

<link href=”https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel=”stylesheet” integrity=”sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl” crossorigin=”anonymous”>

<script src=”https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity=”sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin=”anonymous”></script>

If we’re using compiled JavaScript and prefer to include Popper separately, add Popper before our JS, via a CDN preferably

<script src=”https://cdn.jsdelivr.net/npm/@popperjs/core@2.6.0/dist/umd/popper.min.js" integrity=”sha384-KsvD1yqQ1/1+IA7gi3P0tyJcT3vR+NdBTt13hSJ2lnve8agRGXTTyNaBYmCR/Nwi” crossorigin=”anonymous”></script>

<script src=”https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.min.js" integrity=”sha384-nsg8ua9HAw1y0W1btsyWgBklPnCUAFLuTMS2G72MMONqmOymq585AcH49TLBQObG” crossorigin=”anonymous”></script>

Once downloaded, unzipped and compressed the file we will see something like this in css folder

These are the most precompiled css files

In js folder

Most precompiled js files

Bootstrap supports the latest, stable version of all major browsers and platforms. However it doesn’t support IE11. Ever since Bootstrap was introduced, it utilized jQuery as a dependency to offer dynamic features such as menu expansion, carousel, dropdowns etc. So instead of jquery this time bootstrap use vanilla javascript.

New Features

  1. Vanilla JavaScript instead of jQuery
  2. IE 10 and 11 support removed
  3. CSS custom properties:- Bootstrap 5 now supports custom CSS properties. In Bootstrap 4 root variables were present for only color and fonts. Bootstrap 5 now offers CSS variables in a handful of components and layout options.
  4. Expanded color palette:- Bootstrap 5 has now expanded its color palette to include more colors that are present in different shades such as $blue-100, $blue-200, $blue-300, …., $blue-900.
  5. Update form controls:- Bootstrap 5 includes custom designed form controls. In Bootstrap 4 the form controls were using whatever defaults each browser provided. In Bootstrap 5 the form controls will offer much more consistent look and feel in all browsers due to its custom design.
  6. Enhanced grid system:- While Bootstrap 5 keeps the grid system structure that was introduced in Bootstrap 4, it enhances it by adding new classes. This would mean less effort will be required to move the grid structure from the older to newer version. Here is the what changed in the Bootstrap 5 grid system.
  7. New xxl grid tier.
    Gutter classes can be added in grid using .g* utilities.
    Form layout options have been replaced with the new grid system.
    Vertical spacing classes have been added.
    Columns are no longer position: relative by default.
  8. RTL support:- Bootstrap 5 now includes RTL support. RTL (right-to-left) support means that we can build websites in languages such as Arabic, Hebrew, Pashto, Persian, Urdu, and Sindhi. The writings in these languages starts from the right of the page and continues to the left which demands it’s own specific style settings in order to accommodate with your overall design.
  9. Name spaced data attribute:- Bootstrap utilizes HTML attributes to enable JavaScript behaviors. In Bootstrap 5, all such attributes have been renamed from data-* to data-bs-*.
  10. Popper.js v2:- Tooltips and popovers in Bootstrap are powered by Popper.js. In Bootstrap 5, v2 of Popper.js has been adopted which brings small breaking changes
  11. SVG icon’s library:- Bootstrap now offers SVG library of 1,000+ icons that are easy to integrate in your code. You can add these icons by inline code or SVG sprite. A web font version will also be introduced with the stable release of this icon library. to install the bootstrap icon write this npm command in cmd npm i bootstrap-icons

Differences b/w bootstrap 4 and bootstrap 5

  1. On the basis of grid system bootstrap 4 has 5 tier which is xs, sm, md, lg, xl while bootstrap 5 has 6 tier xs, sm, md, lg, xl, xxl.
  2. On the basis of colors bootstrap 4 has limited colors while as in bootstrap 5 extra color has been added with with improved color palette.
  3. On the basis jquery bootstrap 4 has jquery and all related plugin while as in bootstrap 5 jquery has been removed. Instead of jquery it switched to vanilla javascript .
  4. On the basis Internet Explorer bootstrap 4 support the IE11 which as bootstrap 5 doesn’t support Internet Explorer. it support the latest and stable version of all major browser.
  5. On the basis of form elements bootstrap 4’s form element like radio button, checkbox have different look in different ios and browser while as bootstrap 5’s form element like radio button, checkbox have same styling in different browsers.
  6. On the basis of icons bootstrap 4 doesn’t have icon for icons we use font awesome while as bootstrap has its own svg icons .
  7. On the basis jumbotron bootstrap 4 support jumbotron while as bootstrap 5 doesn’t support jumbotron.
  8. On the basis of card deck bootstrap 4 support card-deck while bootstrap 5 doesn’t support this feature.

Here are the some reasons why would I want to stick with bootstrap 4

  1. Bootstrap 5 still in alpha version waiting for its stable version
  2. Project need support of internet Explorer.

Here are the reason why would I want to switch to bootstrap 5

1. I want to utilize the new features of Bootstrap such as expanded color palette, enhanced grid system, custom utilities, RTL etc.

--

--