Introduction
Creating neat buttons, navigation menus, cards, and forms with CSS from scratch can be fun, but it can also take a lot of time. You also have to make sure everything looks consistent across different browsers and screen sizes.
This is where a CSS framework comes in handy. One of the best-known and longest-standing frameworks is Bootstrap. In this article, we’ll explore what Bootstrap is, how to install it, and how to use it to build web pages quickly.
What Are CSS Frameworks And Bootstrap?
A CSS framework is a collection of ready-made CSS code (and sometimes JavaScript) that you can use right away. Think of it as an instant seasoning mix: you don’t have to make everything from scratch; just use what you need.
What is Bootstrap? Bootstrap is an open-source front-end framework that provides:
A grid system for arranging page layouts into rows and columns.
Ready-to-use components such as navbars, buttons, cards, forms, modals, and carousels.
Utility classes, small classes for adjusting spacing, colors, text alignment, and other properties directly in HTML.
Responsive design, so the layout automatically adapts to different screen sizes.
Using it is simple, just add Bootstrap class names to HTML elements, and their appearance changes automatically. For example, adding class="btn btn-primary" to a button gives you a neatly styled blue button.
A Brief History And The Latest Version
Bootstrap was originally developed at Twitter by Mark Otto and Jacob Thornton to standardize the appearance of internal tools. It was then released as an open-source project in 2011. Since then, Bootstrap has continued to evolve alongside the web:
Version | Release Year | Key Notes |
Bootstrap 3 | 2013 | Introduced a mobile-first approach |
Bootstrap 4 | 2018 | Switched to Flexbox for layouts |
Bootstrap 5 | 2021 | No longer depends on jQuery |
As of late November 2026, the latest stable release is Bootstrap 5.3.9 (released on November 11, 2026, according to the official Bootstrap blog). Bootstrap 6 has also started appearing in alpha releases: the first alpha was released in October 2026, followed by Alpha 2 on November 23, 2026. This version is still in the testing phase and has not yet been declared production-ready, so Bootstrap 5 is the recommended choice for both learning and real-world projects. All examples in this article use Bootstrap 5
Advantages And Disadvantages Of Bootstrap
Like any other tool, Bootstrap has its advantages as well as a few drawbacks to consider.
Advantages:
Fast. You can build a polished page in minutes, making it ideal for prototyping.
Responsive by default. Its grid and components are designed to work across different screen sizes.
Consistent. It provides a uniform appearance across modern browsers.
Extensive documentation and a large community. Answers to most beginner questions can already be found online.
Easy to learn. A basic understanding of HTML and CSS is enough to get started.
Disadvantages:
Common-looking designs. Without customization, many Bootstrap websites can look alike.
Larger files than necessary. You may load many styles that you never use.
Class-heavy HTML. An element may end up with a dozen or more classes.
Customization is needed for unique designs. Overriding the default styles can sometimes be cumbersome.
How To Install Bootstrap
There are several ways to install Bootstrap:
Method | Description | Best For |
CDN | Loads files from the internet using <link> and <script> tags | Beginners and practice; the quickest option |
Unduh manual | Download files from the official website and place them in the project folder | Projects that must run without an internet connection |
npm | Run npm install bootstrap, then use it with a build tool | Large projects and customization with Sass |
For beginners, using a CDN is the easiest method. Save the following code as index.html, then open it in your browser:
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First Bootstrap Page</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.9/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<h1 class="text-center mt-5">Hello, Bootstrap!</h1>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.9/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>A few things to note:
The <meta name="viewport"> tag is required for Bootstrap's responsive features to work correctly.
The CSS file (bootstrap.min.css) handles the appearance. The JS file (bootstrap.bundle.min.js) is only needed for interactive components such as dropdowns, modals, and the navbar menu on smaller screens. You can simply use data-bs-* attributes in your HTML without writing JavaScript yourself.
You can update the version number in the CDN link (5.3.9) to match the latest stable version listed on the official Bootstrap website.
Grid System: Building Layouts
The grid is at the heart of Bootstrap. The idea is to divide a page into 12 columns within a row. The structure always consists of three layers:
.container wraps the content and controls its width.
.row creates a row.
.col-* defines columns within a row.
Here's an example with three equal-width columns:
<div class="container">
<div class="row">
<div class="col-md-4">Column 1</div>
<div class="col-md-4">Column 2</div>
<div class="col-md-4">Column 3</div>
</div>
</div>The number after col-md- indicates how many of the 12 columns are used. Three columns with a value of 4 mean 4 + 4 + 4 = 12, filling one row. You can also use uneven column widths, such as col-md-8 and col-md-4 for the main content and sidebar.
The md part is a breakpoint, which is the screen width at which the column layout takes effect. Below that width, columns automatically stack vertically:
Prefix | Applies From Screen Width |
col- | All sizes |
col-sm- | 576px and up |
col-md- | 768px and up |
col-lg- | 992px and up |
col-xl- | 1200px and up |
col-xxl- | 1400px and up |
You can combine these classes. For example, col-12 col-md-6 col-lg-4 means one full-width column on a phone, two columns on a tablet, and three columns on a large screen. To add spacing between columns, add a class such as g-3 or g-4 to .row.
Ready-to-Use Components
Bootstrap provides many components that you can use right away. Here are some of the most commonly used ones:
Component | Main Classes | Purpose |
Button | btn, btn-primary | Buttons in various colors and sizes |
Navbar | navbar, navbar-expand-lg | A navigation menu that collapses on small screens |
Card | card, card-body | A card for displaying content, products, or profiles |
Form | form-control, form-label | Neatly styled input fields and labels |
Alert | alert, alert-success | Colored notification messages |
Modal | modal | A pop-up window |
Example of buttons and a card:
<button class="btn btn-primary">Save</button>
<button class="btn btn-outline-secondary">Cancel</button>
<div class="card" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title">Card Title</h5>
<p class="card-text">A brief description of this card.</p>
<a href="#" class="btn btn-primary">Learn More</a>
</div>
</div>With just a few classes, the result already looks neat without writing a single line of CSS.
Utility Classes: Fine-Tuning Elements Directly In HTML
In addition to components, Bootstrap provides utility classes: small classes that each perform a specific task. They help reduce the need to open your CSS file.
Use Case | Example Classes | Result |
Margin | mt-3, mb-4, mx-auto | Spacing outside an element (top, bottom, left, and right) |
Padding | p-3, px-4, py-5 | Spacing inside an element |
Rata teks | text-center, text-end | Centered or right-aligned text |
Warna teks | text-primary, text-danger | Colored text |
Warna latar | bg-light, bg-dark | Colored background |
Flexbox | d-flex, justify-content-between | Arrange elements in a single row |
Tampilan | rounded, shadow | Rounded corners and shadows |
The numbers after m and p range from 0 to 5; the larger the number, the greater the spacing. Prefixes such as t, b, x, and y determine which side is affected (top, bottom, horizontal, or vertical).
A Simple Page Example
Now let’s combine everything into one page: a navbar, a welcome section, three cards, and a footer. Save it as index.html and open it in your browser:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Portfolio | Nama Kamu</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.9/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-lg bg-dark" data-bs-theme="dark">
<div class="container">
<a class="navbar-brand" href="#">Portfolio</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#menu">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="menu">
<ul class="navbar-nav ms-auto">
<li class="nav-item"><a class="nav-link active" href="#">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#">About</a></li>
<li class="nav-item"><a class="nav-link" href="#">Contact</a></li>
</ul>
</div>
</div>
</nav>
<header class="py-5 text-center bg-light">
<div class="container">
<h1 class="display-5 fw-bold">Hello, I’m Your Name</h1>
<p class="lead">A web learner who enjoys building simple yet useful things.</p>
<a href="#" class="btn btn-primary btn-lg">Contact Me</a>
</div>
</header>
<main class="container my-5">
<h2 class="mb-4">Latest Work</h2>
<div class="row g-4">
<div class="col-12 col-md-4">
<div class="card h-100 shadow-sm">
<div class="card-body">
<h5 class="card-title">Project 1</h5>
<p class="card-text">A brief description of the first project.</p>
</div>
</div>
</div>
<div class="col-12 col-md-4">
<div class="card h-100 shadow-sm">
<div class="card-body">
<h5 class="card-title">Project 2</h5>
<p class="card-text">A brief description of the second project.</p>
</div>
</div>
</div>
<div class="col-12 col-md-4">
<div class="card h-100 shadow-sm">
<div class="card-body">
<h5 class="card-title">Project 3</h5>
<p class="card-text">A brief description of the third project.</p>
</div>
</div>
</div>
</div>
</main>
<footer class="bg-dark text-white text-center py-3">
<small>© 2026 Nama Kamu</small>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.9/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>Notice that we haven’t written any CSS ourselves, yet the page already looks like a real website. Try making the browser window narrower: the navbar menu collapses into a button, and the cards stack vertically on smaller screens. That is the grid system and Bootstrap components at work.
If you have followed the previous static website tutorial, compare this page with the version you built yourself. The results are similar, but the approach is different.
When Should You Use It And What Are The Alternatives?
Bootstrap is best suited for:
Prototypes or MVPs that need to be completed quickly.
Admin dashboards and internal applications.
Corporate websites or standard landing pages.
Small teams without a dedicated designer.
On the other hand, if you need a truly unique and highly customized design, Bootstrap may feel limiting. In that case, consider these alternatives:
Framework | Approach | Best For |
Tailwind CSS | Utility-first, kamu menyusun desain sendiri dari class kecil | Custom designs with full control |
Bulma | CSS only, with no built-in JavaScript | Those who want a lightweight, simple framework |
CSS murni | Write everything yourself | Learning the basics and small projects |
There is no single best choice. Choose the option that suits your project needs and personal preferences.
Tips For Getting Started With Bootstrap
Master the basics of HTML and CSS first. Bootstrap is a shortcut, not a replacement. When you understand CSS, you also understand what each class does.
Start with a small page. Re-create the example in this article, then change its text, colors, and number of columns.
Read the official documentation. Bootstrap provides code examples for every component that you can copy and customize.
Use your browser’s DevTools. Right-click an element and select Inspect to see which CSS rules are applied by its Bootstrap classes.
Rebuild a page you have made before. For example, recreate the portfolio website from the previous tutorial using Bootstrap.
Start customizing gradually. Add your own CSS file after the Bootstrap file to override its default colors or styles.
Conclusion
Bootstrap is a CSS framework that helps you build neat, responsive web pages faster using its grid system, ready-to-use components, and utility classes. Its main strengths are speed and ease of use, while its main drawback is that websites can look generic if you do not customize them.
The best advice is to understand the basics of HTML and CSS first, then use Bootstrap as a tool to speed up your work. Try copying the page example above, changing its content, and experiencing the difference for yourself.
Discussion (0)
Your email address will not be shown or shared.
No comments yet: be the first to write one.