How to use Bootstrap

In order to use bootstrap framework, you have to embed bootstrap files. There are two ways to attach Bootstrap files on your website.

  1. Download Bootstrap 5
  2. Use Bootstrap 5 from a CDN

You can find both the ways in bootstrap official website 'getbootstrap.com'.

Download Bootstrap 5

Click Here to Download Bootstrap 5.2
The above link contain files: bootstrap 5 CSS files, JS files

Bootstrap 5 CDN

If you don't want to download bootstrap files, you can include it from a CDN(Content Delivery Network). jsdelivr provides CDN for Bootstrap's classes. Bootstrap JavaScript is required to include components like:

  • Alerts for dismissing
  • Buttons for toggling states and checkbox/radio functionality
  • Carousel for all slide behaviors, controls, and indicators
  • Collapse for toggling visibility of content
  • Dropdowns for displaying and positioning
  • Modals for displaying, positioning, and scroll behavior
  • Navbar for extending our Collapse plugin to implement responsive behavior
  • Offcanvases for displaying, positioning, and scroll behavior
  • Toasts for displaying and dismissing
  • Tooltips and popovers for displaying and positioning (also requires Popper)
  • Scrollspy for scroll behavior and navigation updates

However, if you just use CSS part of Bootstrap, you don't need to include javascript and Popper.js library.

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css">

<!-- Latest compiled JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js"></script>

You can also include Popper and our JS separately.
If you don't plan to use dropdowns, popovers, or tooltips, save some kilobytes by not including Popper.

<!-- Popper JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.5/dist/umd/popper.min.js"></script>

<!-- Compiled JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.min.js"></script> 

One advantage of using the Bootstrap 5 CDN is that many users already have downloaded Bootstrap 5 from jsdelivr when visiting another site. As a result, it will be loaded from cache when they visit your site, which leads to faster loading time. Also, most CDN's will make sure that once a user requests a file from it, it will be served from the server closest to them, which also leads to faster loading time.