Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 58 ยท Getting Started

Introduction to Bootstrap

Meet Bootstrap 5.3: a CSS and JavaScript toolkit for responsive pages. See what it includes, how it compares with Tailwind and plain CSS, and try it live.

Bootstrap is a free, open-source front-end toolkit. It gives you a ready-made set of CSS classes and a few small JavaScript plugins, so you can build responsive, good-looking web pages without writing every rule yourself. Need a row of three equal columns? Add a few class names. Need a navigation bar that collapses into a menu on phones? Copy a short piece of markup and it works.

Bootstrap was started at Twitter in 2011 to keep internal tools consistent, and it grew into one of the most widely used front-end projects in the world. This tutorial teaches Bootstrap 5.3, the current line of version 5. You should already know basic HTML and CSS. If you need a refresher, start with the HTML tutorial and the CSS tutorial.

What Bootstrap gives you

Bootstrap is not one thing but a bundle of related parts. Knowing the parts helps you find the right tool later.

  • Reboot: a thin layer that resets browser differences (margins, box sizing, fonts) so your page starts from the same point everywhere.
  • Layout: containers, a 12-column grid and responsive breakpoints. This is what most people come for. See containers and the grid system.
  • Content styles: typography, tables, images and figures.
  • Forms and buttons: consistent inputs, selects, checkboxes, switches and validation styles.
  • Components: navbars, cards, alerts, modals, dropdowns, carousels, accordions and more.
  • Utilities: small single-purpose classes such as mt-3 (margin top), text-center or d-flex.
  • JavaScript plugins: the behavior behind modals, dropdowns, tooltips and collapsing menus.
  • Customization: CSS variables and Sass, so the result does not have to look like "default Bootstrap".
flowchart TD
  B["Bootstrap 5.3"] --> C["CSS"]
  B --> J["JavaScript"]
  C --> C1["Reboot and typography"]
  C --> C2["Layout: grid, containers"]
  C --> C3["Components"]
  C --> C4["Utilities"]
  J --> J1["Modal, dropdown, collapse"]
  J --> J2["Tooltip, popover, carousel"]

Bootstrap is mostly CSS; JavaScript is only needed for interactive components.

No jQuery, no build step required

Older tutorials (and Bootstrap 3 and 4) require jQuery. Bootstrap 5 dropped jQuery completely. Its plugins are written in plain modern JavaScript, so the only script you may need is Bootstrap's own bundle. There is also no required build step. Two lines in your HTML, one for the stylesheet and one for the script, are enough to start. Later you can switch to npm and Sass when you want to customize deeply (see Installing Bootstrap and Customizing with Sass).

How the live examples on this site work

Every <TryIt> editor in this tutorial runs your HTML inside a sandboxed frame. The frame has no access to this site's cookies or storage, but it can load a stylesheet and a script from a CDN (a public file server). So each Bootstrap example starts with the same two lines:

HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>

The version number is pinned (5.3.3). That means the example keeps working even if a newer Bootstrap changes something. You can edit any example and press Run to see the result. Here is a first one: a plain heading, a paragraph and three buttons. Everything you see is styled by class names.

Your first taste of Bootstrap

Try changing btn-primary to btn-danger, or remove rounded-pill. Each class does one clear thing, and that is the idea you will use throughout the course.

A first component that needs JavaScript

Some parts of Bootstrap need its script. A dismissible alert is a good small example: the close button removes the alert, and that behavior comes from the bundle. You do not write any JavaScript yourself, only a data-bs-dismiss attribute.

A dismissible alert

Bootstrap, Tailwind or your own CSS?

There is no single best choice. Each approach fits different projects.

Approach Strengths Trade-offs
Bootstrap Ready-made components, JavaScript behavior included, fast to a decent-looking result, huge community Sites can look alike unless you customize; the full CSS file is larger than you may need
Tailwind CSS Total design freedom with utility classes, tiny final CSS when built No ready-made components or behavior; needs a build step; you design everything
Hand-written CSS Smallest and most exact result, no dependency Slowest to build; you must solve responsiveness, accessibility and browser quirks yourself

Choose Bootstrap when you need a working interface quickly: admin panels, internal tools, prototypes, school or client projects, and sites where consistency matters more than a unique look. Choose Tailwind or custom CSS when a distinctive brand design is the main goal. Many professionals know both. Bootstrap also teaches concepts (grid, breakpoints, utilities, component states) that transfer to any framework. You can compare this approach with Tailwind-style thinking later, once you have seen how Bootstrap generates its own utilities.

Bootstrap gives you building blocks, not a finished design. The way you combine, space and customize them is still your job, and that is what the rest of this tutorial teaches.

Foundation and Bulma, and two ways to build

Bootstrap, Tailwind and plain CSS are the choices most people compare, but two more names come up in conversations and job listings:

  • Foundation (by ZURB) is a component framework like Bootstrap, with an XY grid, many components and strong accessibility documentation. It is aimed at larger, more customisable builds, and its community is smaller than Bootstrap's.
  • Bulma is a CSS-only framework built on flexbox. It has no JavaScript at all, so interactive pieces such as modals or navbar toggles are yours to script. Its class names read naturally (button is-primary), and it is pleasant for small projects.

A helpful way to think about the whole field is component-first versus utility-first. A component-first framework gives you a finished piece, such as card or btn btn-primary, and you adjust it. A utility-first framework such as Tailwind gives you tiny single-purpose classes (p-4 rounded text-sm) and you assemble every component yourself. Bootstrap sits mostly on the component side but includes a full utility layer (see the Utility API), so you can mix both. If you want fast, consistent results with behavior included, pick component-first; if you want a unique brand and are happy to design every part, pick utility-first. Neither is "better": choose by how much design freedom and how much ready-made behavior your project needs.

What you need to follow along

  • A basic understanding of HTML tags and attributes.
  • A feeling for CSS ideas such as margin, padding and display.
  • A browser. Everything runs in the editors on this site, and later lessons show how to set up a local project.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What changed about jQuery in Bootstrap 5?

    Bootstrap 5 dropped jQuery. Its plugins are written in plain modern JavaScript, so you only load Bootstrap's own script, and only if you use interactive components.
  2. 2. Which part of Bootstrap does NOT need its JavaScript file?

    Layout, typography and utilities are pure CSS. Modals, dropdowns, tooltips, collapsing menus and dismissible alerts use the JavaScript bundle.
  3. 3. Why do the examples in this tutorial pin the version in the CDN URL ([email protected])?

    A pinned version never changes. Without it, a future release could alter styles or behavior and break an example or your site.
  4. 4. For which project is Bootstrap usually a better fit than writing all CSS by hand?

    Ready-made, accessible components and a responsive grid save a lot of time on admin tools, prototypes and similar projects. Highly custom or ultra-lean designs may justify custom CSS.

Summary

  • Bootstrap is a CSS and JavaScript toolkit: reboot, layout, content styles, forms, components, utilities and plugins.
  • Bootstrap 5.3 needs no jQuery and no build step to start; a stylesheet link and an optional script are enough.
  • Live examples on this site load Bootstrap 5.3.3 from the jsDelivr CDN inside a sandboxed frame.
  • Choose Bootstrap for speed and consistency, Tailwind or custom CSS for a unique, minimal result.

Next: Installing Bootstrap.