Bootstrap Introduction
Bootstrap is a free CSS framework: a big set of ready-made styles. Instead of writing your own CSS, you add class names to your HTML, and the page looks neat on phones, tablets and computers.
You should know some HTML and CSS first. This tutorial uses Bootstrap 5.3.
Writing CSS for a whole website from scratch takes a long time: buttons, forms, menus, grids, spacing, and making all of it work on phones. Bootstrap gives you all of that, already designed and tested on many browsers. You build pages quickly just by choosing class names like btn btn-primary or col-md-6.
It's especially useful for admin panels, dashboards, prototypes and small business sites, and it's still one of the most used CSS frameworks. The trade-off is that sites can look similar - which you can fix by changing colours and fonts later.
Adding Bootstrap to a page
Add one <link> line in the <head>. The viewport meta tag makes the page fit phone screens.
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="p-3">
<h1 class="text-primary">Hello from Bootstrap!</h1>
<p class="lead">This paragraph is bigger because of the "lead" class.</p>
<button class="btn btn-success">Shop now</button>
</body>
</html>▶ Try it yourself- Bootstrap is mobile first: styles are made for small screens, then grow for bigger ones.
- Some parts (menus that open, pop-up windows) also need Bootstrap's JavaScript file. We add it when needed.
- Bootstrap is a ready-made CSS framework used through class names.
- Add it with one
<link>line, plus the viewport meta tag. - Interactive parts also need Bootstrap's JavaScript file.
