Three Ways to Use Bootstrap
Before you can use Bootstrap you need to add its CSS (for styling) and JavaScript (for interactive parts) to your page. There are three common ways to do it.
| Method | Best For | Internet Needed? |
|---|---|---|
| CDN links | Beginners, quick demos and small projects | Yes |
| Download files | Offline use and learning how files are organized | No |
| npm package | Modern projects with build tools and Sass | Only to install |
Method 1: CDN (Easiest)
A CDN (Content Delivery Network) is a fast server that already hosts the Bootstrap files. You only add two links to your HTML and Bootstrap works.
- The CSS link goes in the
<head>, so the styles load first - The JS bundle goes at the end of
<body>, so the page shows quickly bootstrap.bundle.min.jsalready includes Popper, which dropdowns and tooltips need
@5.3.8 in the link is the Bootstrap version. You can change it to another 5.3.x version if you need a specific release. Always check the official Bootstrap website for the latest version.
Method 2: Download the Files
- Open the official Bootstrap website and go to the Download page.
- Click Download to get the compiled CSS and JS zip file.
- Unzip it and copy the
cssandjsfolders into your project. - Link them using local paths.
Method 3: npm (For Modern Projects)
If you use Node.js, open the terminal in your project folder and run:
The files are saved in node_modules/bootstrap/dist/. In a build tool such as Vite or webpack you can then import them:
How to Check That Bootstrap Works
Add this small test inside your <body>. If the text appears in a green box, Bootstrap is working.
A light green alert box with the text Bootstrap is working!
Common Mistakes
- Putting the JS file in the
<head>before the content, which can slow the page - Typing the wrong file path when using downloaded files
- Loading Bootstrap 4 CSS with Bootstrap 5 JS, or the other way around
- Forgetting the internet connection when using a CDN
Conclusion
For learning, the CDN is the quickest option. Later, when you build bigger projects, npm gives you more control and lets you customize with Sass.

