Bootstrap
Meet a popular front-end framework and use reusable classes to build polished interfaces faster.
>_ What Is Bootstrap?
Bootstrap is a front-end framework that provides ready-made CSS classes, responsive layout tools, and reusable interface components. Instead of styling every element from scratch, developers can use Bootstrap’s existing classes.
The idea should feel familiar after the previous lesson: Bootstrap gives you a large collection of predefined styles and components that you can apply to your HTML.
Components
Buttons, cards, alerts, navigation, forms, and many other interface pieces.
Layout
Containers, rows, and columns help organize responsive page layouts.
Utilities
Small classes can control spacing, colors, alignment, display, and more.
Responsive
Bootstrap includes tools designed to adapt interfaces across different screen sizes.
>_ Adding Bootstrap to a Webpage
On a real webpage, Bootstrap’s stylesheet must be loaded before you can use its CSS classes.
rel=“stylesheet”
href=“bootstrap.min.css”>
Bootstrap can be installed locally or loaded from a CDN. Once the stylesheet is available, Bootstrap’s CSS classes can be used throughout the page.
>_ Bootstrap Buttons
Bootstrap commonly combines a base component class with another class that controls its appearance.
Primary Button
</button>
btn
The base Bootstrap button class.
btn-primary
Applies Bootstrap’s primary button style.
btn-success
Applies a success-themed button style.
btn-danger
Applies a danger-themed button style.
>_ Bootstrap Alerts
Alerts follow the same pattern: one class establishes the component and another class selects its variation.
Your changes were saved!
</div>
>_ Bootstrap Cards
Components can also contain other components and
classes. A Bootstrap card, for example, may use
both card and card-body.
<div class=“card-body”>
Hello, Bootstrap!
</div>
</div>
>_ Bootstrap’s Grid System
Bootstrap also includes its own responsive layout system. You’ll often see classes such as container, row, and col.
<div class=“row”>
<div class=“col”>HTML</div>
<div class=“col”>CSS</div>
<div class=“col”>JavaScript</div>
</div>
</div>
container
Wraps and helps position page content.
row
Groups columns into a horizontal row.
col
Creates a flexible column inside a row.
col-md-6
An example of a responsive column class that changes behavior at a breakpoint.
>_ Utility Classes
Bootstrap also contains many small classes called utilities. These can handle common styling jobs without requiring a custom CSS rule.
text-center
Centers text.
p-3
Adds padding using Bootstrap’s spacing scale.
mt-3
Adds margin to the top of an element.
rounded
Adds rounded corners.
Bootstrap doesn’t replace what you’ve learned. When you understand selectors, colors, the Box Model, Grid, and responsive design, Bootstrap becomes much easier to understand and customize.
>_ Developers Use Documentation
You do not need to memorize every Bootstrap class. Real developers regularly use documentation to find the component or utility they need.
Learn the patterns, not every class name. Knowing that Bootstrap has buttons, cards, grids, utilities, and responsive tools is more useful than trying to memorize the entire framework.
Build a Bootstrap Dashboard
The Bootstrap-style classes are already included. Your job is to apply the correct classes to the HTML.
-
✓
Apply
containerto the main wrapper. -
✓
Create a success message using
alert alert-success. -
✓
Turn the course wrapper into a
row. -
✓
Apply
colandcardto each course. -
✓
Style the button with
btn btn-primary.
Bootstrap Challenge
What You’ve Learned
btn provides the base
button component.
btn-primary
provide component variations.
alert and card
create reusable interface components.
container, row,
and col help build layouts.
Nice work!
Finished this lesson? Mark it complete to track your progress.


