Bootstrap Introduction

Bootstrap is a free and open source front end framework. It gives you ready made CSS and JavaScript parts, like a grid, buttons, forms, cards, menus and popups, so you can build a good looking responsive website quickly without writing all the CSS yourself.

It was started at Twitter in 2011 by Mark Otto and Jacob Thornton, for the internal tools of the company, and it became open source in the same year. Today it is one of the most used front end frameworks in the world.

Why use Bootstrap?

  • Responsive and mobile first. Pages work on phones, tablets and big screens with the same code.
  • Fast development. Many parts are ready, and you only add the class names.
  • Consistent design. All the buttons, forms and menus look and work in the same style.
  • Works in all modern browsers.
  • Easy to learn. If you know basic HTML and CSS, you can start in one day.
  • Customizable. You can change colors, sizes and fonts with CSS variables or Sass.

What is in Bootstrap?

PartWhat it gives you
LayoutContainers, a 12 column grid, breakpoints and utilities for spacing and flexbox
ContentTypography, images, tables, colors
ComponentsButtons, alerts, cards, navbar, modals, carousel, accordion and more
FormsStyled inputs, selects, switches, validation states
JavaScriptPlugins for the components, which work with simple data attributes
UtilitiesSmall helper classes for spacing, display, borders, shadows and text

A first look

The code below makes a responsive three column section. On a phone the columns are stacked one under the other, on a big screen they are side by side. Resize the preview window (or open this page on a phone) to see it.

<div class="container">
  <div class="row text-center">
    <div class="col-12 col-md-4 mb-3"><div class="p-3 bg-primary-subtle border rounded">Column 1</div></div>
    <div class="col-12 col-md-4 mb-3"><div class="p-3 bg-success-subtle border rounded">Column 2</div></div>
    <div class="col-12 col-md-4 mb-3"><div class="p-3 bg-warning-subtle border rounded">Column 3</div></div>
  </div>
</div>
Live preview

Bootstrap versions

VersionNotes
Bootstrap 5 (5.3.8)The current stable version. No jQuery needed, has color modes (dark mode), offcanvas, RTL support. This tutorial is for Bootstrap 5.3
Bootstrap 4Older version. Needs jQuery. Many old websites and themes still use it
Bootstrap 6In alpha (pre-release) at the time of writing, not for production sites

If you use an old theme or template, check which version it uses before you copy examples. Class names changed between version 4 and 5. See Migrating from Bootstrap 4 to 5.

Bootstrap or something else?

Other frameworks like Tailwind CSS and Bulma are also popular. Bootstrap gives ready components with a standard look, and it is a very good choice for admin panels, business sites, prototypes and for learning. It is also used by many WordPress themes. You need only HTML and CSS knowledge to start.

What you will learn in this tutorial

  • Set up Bootstrap, containers and the grid system.
  • Typography, colors, images and tables.
  • Buttons, alerts, cards, navs, navbar, forms and many other components.
  • JavaScript components like modal, carousel, collapse and tooltips.
  • Utilities, dark mode, icons, customization and a full page example.
Note: All the examples in this tutorial are real: each has a live preview which uses the real Bootstrap 5.3.8 files. Next: Bootstrap Get Started.

Congratulations! Chapter Finished. Learn more about the similar topics:
Exercises & Assignments
No Content Found.
Interview Questions & Answers
What is Bootstrap?
What are the advantages of Bootstrap?
Who developed Bootstrap and when?
How do you add Bootstrap to a web page?
What is the difference between bootstrap.bundle.js and bootstrap.js?
Is jQuery required for Bootstrap 5?
What are the main differences between Bootstrap 4 and Bootstrap 5?