There are two common ways to add Bootstrap 5.
1. CDN (quickest)
Add the CSS in the <head>:
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
Add the JavaScript bundle before </body> (needed for navbar toggles, modals, dropdowns, carousels):
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
The bundle already includes Popper, which dropdowns and tooltips need.
2. npm (for build tools)
npm install bootstrap and import it in your project. Useful when you want to customise Sass variables.
Do not forget the viewport tag
<meta name="viewport" content="width=device-width, initial-scale=1"> — without it, the page will not be responsive on phones.
Your own CSS
Link your style.css after Bootstrap, so your rules can override it.
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Starter</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-4">
<h1>My Bootstrap Page</h1>
<p>Start building here.</p>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Save this as a template and start every new Bootstrap page from it.
Try it Now »