Complete Bootstrap Guide
By Himanshu Shekhar , 14 Mar 2022
Module 01 โ Introduction to Bootstrap
Welcome to the world of Bootstrap โ a powerful, open-source front-end framework created by Twitter developers. It helps you design mobile-first, responsive, and beautiful websites quickly using pre-built HTML, CSS, and JavaScript components. In this module, youโll learn what Bootstrap is, why itโs so popular, and how to install and use it effectively.
1.1 ๐ What is Bootstrap?
Bootstrap is a free toolkit that provides ready-made classes for layout, typography, forms, buttons, modals, and many other UI elements. It allows developers to build web pages faster without writing CSS from scratch.
btn btn-primary instantly gives a blue styled button โ
no need to write custom CSS!
- โ๏ธ Built with HTML, CSS, and JavaScript
- ๐ฑ Mobile-first and responsive by design
- ๐จ Provides consistent look across all browsers
- ๐งฉ Easy to customize using utility classes
1.2 โ๏ธ Installing Bootstrap (CDN or Local)
You can use Bootstrap either via a CDN (Content Delivery Network) or by downloading it locally.
๐ธ Option 1: Using CDN (Easiest Way)
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
Just copy these two lines into your HTML <head> and </body> section. Youโre ready to use Bootstrap classes instantly!
๐ธ Option 2: Local Installation
- Download Bootstrap from getbootstrap.com
- Extract the ZIP file in your project folder
- Link the CSS and JS files manually in your HTML page
1.3 ๐ Bootstrap Folder Structure
When you download Bootstrap locally, youโll find these key folders:
| Folder | Description |
|---|---|
css/ | Contains Bootstrapโs core CSS files |
js/ | Contains Bootstrapโs JavaScript bundle and plugins |
scss/ | Used for custom themes and SCSS compiling |
1.4 ๐๏ธ Understanding Containers
The .container class is the heart of Bootstrapโs layout system.
It centers your content and applies proper padding for responsive designs.
<div class="container">
<h1>Hello Bootstrap!</h1>
</div>
.containerโ fixed-width responsive container.container-fluidโ full-width layout (100%).container-{breakpoint}โ changes width at specific screen sizes (e.g..container-lg)
.container for centered pages and .container-fluid for dashboards or banners.
1.5 ๐งฑ Basic Page Setup
Letโs create your first Bootstrap page structure.
Save this 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>My First Bootstrap Page</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-5">
<h1 class="text-center text-primary">Welcome to Bootstrap!</h1>
<p class="lead text-center">Your first responsive page is ready ๐</p>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Module 02 โ Bootstrap Grid System
The Grid System is the backbone of Bootstrapโs layout design. It helps you build responsive web pages that look perfect on any device โ from mobile screens ๐ฑ to large desktop monitors ๐ป.
In this module, youโll learn how Bootstrapโs grid works, how to create layouts using rows and columns, and how to control their alignment, spacing, and order across different screen sizes.
2.1 ๐งฑ Understanding Rows and Columns
The grid system divides the screen into 12 equal columns.
You can use these columns to position content side by side.
A combination of .container, .row, and .col classes creates the structure.
<div class="container">
<div class="row">
<div class="col">Column 1</div>
<div class="col">Column 2</div>
<div class="col">Column 3</div>
</div>
</div>
.col-6 twice โ thatโs 6 + 6 = 12 (a full row).
| Class | Description |
|---|---|
.container | Centers and adds padding to the layout |
.row | Creates a horizontal group of columns |
.col | Automatically adjusts column width |
2.2 ๐ฑ Responsive Breakpoints (xs, sm, md, lg, xl, xxl)
Bootstrap uses breakpoints to make your layout adjust automatically based on screen size.
| Breakpoint | Prefix | Minimum Width |
|---|---|---|
| Extra Small | col- | <576px |
| Small | col-sm- | โฅ576px |
| Medium | col-md- | โฅ768px |
| Large | col-lg- | โฅ992px |
| Extra Large | col-xl- | โฅ1200px |
| Extra Extra Large | col-xxl- | โฅ1400px |
<div class="row">
<div class="col-sm-6 col-lg-4">Column A</div>
<div class="col-sm-6 col-lg-8">Column B</div>
</div>
2.3 ๐งฉ Column Offsets and Order
Sometimes you want to shift a column or reorder them on different screens.
๐น Offset Example:
<div class="row">
<div class="col-md-4 offset-md-2">Shifted Column</div>
</div>
The above code shifts the column 2 units to the right.
๐น Order Example:
<div class="row">
<div class="col order-2">Second</div>
<div class="col order-1">First</div>
</div>
.order-* classes (1โ5) to reorder columns flexibly.
2.4 ๐งฌ Nesting Columns
You can place rows and columns inside another column to create more complex layouts.
<div class="row">
<div class="col-md-8">
<div class="row">
<div class="col-6">Nested 1</div>
<div class="col-6">Nested 2</div>
</div>
</div>
</div>
.row for proper spacing.
2.5 ๐งฑ Real-Life Responsive Layout Example
Hereโs a simple webpage structure using the Bootstrap grid system.
<div class="container">
<div class="row mb-3">
<div class="col-12 bg-primary text-white p-3 text-center">Header</div>
</div>
<div class="row">
<div class="col-md-3 bg-light p-3">Sidebar</div>
<div class="col-md-9 bg-white p-3">Main Content</div>
</div>
<div class="row mt-3">
<div class="col-12 bg-dark text-white text-center p-2">Footer</div>
</div>
</div>
.row + .col for layouts.
- Use .col-{breakpoint}-* for responsive behavior.
- Nest and offset columns for complex layouts.
Module 03 โ Typography & Text Utilities
Text plays a major role in how your website communicates with visitors. Bootstrap provides a wide range of typography classes that make it easy to style headings, paragraphs, colors, alignment, and spacing without writing extra CSS. In this module, weโll explore how to use Bootstrapโs built-in text utilities to make your content look clean and professional. โจ
3.1 ๐งพ Headings, Paragraphs, and Display Classes
Bootstrap includes all HTML heading tags (<h1> to <h6>) and paragraph styles,
plus additional display classes for creating bold and impactful titles.
| Tag / Class | Example Output | Usage |
|---|---|---|
<h1> to <h6> | Heading Levels 1โ6 | Define hierarchy of text |
.h1 to .h6 | Styled as headings but used on other tags | Apply heading style to non-heading tags |
.display-1 to .display-6 | Extra-large headings | For hero titles or banners |
<h1>Main Heading</h1>
<p class="lead">This is a lead paragraph for emphasis.</p>
<h2 class="display-4 text-primary">Big Bold Title</h2>
.lead for highlighting introductory text and .display-* for hero section headings.
3.2 ๐ Text Alignment & Colors
You can align text easily using .text-start, .text-center, or .text-end.
Bootstrap also includes contextual color utilities for text.
<p class="text-start text-primary">Left aligned blue text</p>
<p class="text-center text-success">Centered green text</p>
<p class="text-end text-danger">Right aligned red text</p>
text-primary, text-secondary, text-success, text-danger,
text-warning, text-info, text-light, text-dark.
You can also use responsive alignment like .text-md-center
to change alignment only on medium and larger screens.
3.3 ๐ Lists & Inline Text Elements
Bootstrap offers utilities to style unordered, ordered, and inline lists easily.
๐น Unstyled List:
<ul class="list-unstyled">
<li>Home</li>
<li>About</li>
<li>Contact</li>
</ul>
๐น Inline List:
<ul class="list-inline">
<li class="list-inline-item">Home</li>
<li class="list-inline-item">Services</li>
<li class="list-inline-item">Contact</li>
</ul>
.list-inline when you want navigation-like lists horizontally.
๐ธ Inline Text Elements
<mark>โ Highlighted text<del>โDeleted text<ins>โ Inserted text<small>โ Smaller text<strong>โ Bold text<em>โ Italic text
3.4 ๐ฌ Blockquotes & Text Emphasis
Blockquotes are used for quotations, testimonials, or highlighting a specific piece of text. Bootstrap styles them beautifully.
<blockquote class="blockquote">
<p>โThe best way to predict the future is to create it.โ</p>
<footer class="blockquote-footer">Peter Drucker</footer>
</blockquote>
.text-end to align quotes to the right and .blockquote-footer to display the author.
You can also emphasize parts of text using classes:
.fw-boldโ Bold text.fw-lightโ Light text.fst-italicโ Italic text.text-uppercaseโ Uppercase.text-lowercaseโ Lowercase.text-capitalizeโ Capitalize words
3.5 ๐ง Text Utilities Summary & Best Practices
Bootstrapโs text utilities give you quick control over alignment, color, weight, and spacing โ no need for custom CSS.
| Utility | Example | Description |
|---|---|---|
.text-center | Centers text horizontally | Use for headlines or banners |
.text-muted | Light gray text | For secondary info or captions |
.fw-bold | Bold font | Highlight important info |
.lh-lg | Increases line spacing | Makes paragraphs more readable |
Module 04 โ Colors, Backgrounds & Borders
Colors bring your website to life! ๐จ Bootstrap provides a powerful system of text colors, background utilities, borders, and shadows โ all designed to make your website visually appealing and easy to customize. In this module, youโll learn how to use Bootstrapโs color palette, apply background themes, and add borders with style.
4.1 ๐จ Bootstrap Color System
Bootstrap includes a consistent set of predefined color classes that you can apply to text, backgrounds, buttons, or borders. These are based on a simple theme: primary, secondary, success, danger, warning, info, light, dark.
| Color Class | Usage | Example |
|---|---|---|
.text-primary | Main accent color (blue) | Primary |
.text-success | For success messages | Success |
.text-danger | For errors or warnings | Danger |
.text-warning | For caution or alerts | Warning |
.text-info | For information messages | Info |
.text-muted | For secondary or subtle text | Muted |
.text-dark | Dark colored text | Dark |
.text-light bg-dark | Light text on dark background | Light Text |
.bg-primary or .border-success.
4.2 ๐ผ๏ธ Background Utilities
Bootstrap offers predefined classes for background colors and gradients. These can be used on any block element to create visual sections or highlights.
<div class="p-3 mb-2 bg-primary text-white">Primary Background</div>
<div class="p-3 mb-2 bg-success text-white">Success Background</div>
<div class="p-3 mb-2 bg-warning text-dark">Warning Background</div>
<div class="p-3 mb-2 bg-dark text-light">Dark Background</div>
.bg-gradient for a smooth gradient effect.
Example โ class="bg-primary bg-gradient text-white p-3"
๐ฆ Combine Text and Background:
<p class="bg-info text-dark p-3 rounded">Information Box</p>
<p class="bg-danger text-white p-3 rounded">Error Message</p>
4.3 ๐งฑ Borders and Shadows
Borders can help separate content, create cards, or add focus to certain areas.
Bootstrap provides .border utilities for all sides, colors, and rounded shapes.
๐ธ Basic Borders:
<div class="border p-3 mb-2">Default Border</div>
<div class="border border-primary p-3 mb-2">Primary Border</div>
<div class="border border-danger p-3 mb-2">Danger Border</div>
๐น Border Sides:
<div class="border-top border-success">Top Border</div>
<div class="border-start border-warning">Left Border</div>
<div class="border-end border-info">Right Border</div>
<div class="border-bottom border-dark">Bottom Border</div>
.border-2 and .rounded for thick and curved borders.
๐น Rounded Corners:
<div class="border border-primary rounded p-3">Rounded Corners</div>
<div class="border border-secondary rounded-circle p-5 text-center">Circle Border</div>
๐น Shadows:
Use shadow utilities to add depth and soft highlights.
<div class="shadow-sm p-3 mb-2 bg-body rounded">Small Shadow</div>
<div class="shadow p-3 mb-2 bg-body rounded">Regular Shadow</div>
<div class="shadow-lg p-3 mb-2 bg-body rounded">Large Shadow</div>
4.4 ๐งญ Opacity Utilities
Sometimes you may want to make elements semi-transparent.
Use .opacity-* classes (values: 25, 50, 75, 100) to control visibility.
<div class="bg-primary p-3 opacity-75 text-white">75% Opacity</div>
<div class="bg-danger p-3 opacity-50 text-white">50% Opacity</div>
<div class="bg-warning p-3 opacity-25 text-dark">25% Opacity</div>
โ Bootstrap offers 8 main theme colors for text, borders, and backgrounds.
โ Use
.bg-*, .text-*, and .border-* for instant styling.โ Add
.rounded, .shadow, and .opacity-* for visual depth.โ All utilities are responsive and easy to combine.
Module 05 โ Buttons and Button Groups
Buttons are essential interactive elements that guide user actions โ like submitting forms, navigating pages, or triggering modals. Bootstrap provides a comprehensive button system that helps you create beautiful, responsive buttons quickly without custom CSS.
5.1 ๐จ Button Variants
Bootstrap includes several color variants to match the frameworkโs theme system.
Each variant uses predefined classes to style a <button> or <a> element.
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-secondary">Secondary</button>
<button type="button" class="btn btn-success">Success</button>
<button type="button" class="btn btn-danger">Danger</button>
<button type="button" class="btn btn-warning">Warning</button>
<button type="button" class="btn btn-info">Info</button>
<button type="button" class="btn btn-light">Light</button>
<button type="button" class="btn btn-dark">Dark</button>
<button type="button" class="btn btn-link">Link</button>
<a href="#" class="btn btn-primary"> instead of
<button> if you prefer a link that looks like a button.
5.2 ๐งฑ Outline Buttons
Outline buttons provide a clean, lightweight appearance using only a border and text color โ perfect for secondary or neutral actions.
<button type="button" class="btn btn-outline-primary">Primary</button>
<button type="button" class="btn btn-outline-success">Success</button>
<button type="button" class="btn btn-outline-danger">Danger</button>
<button type="button" class="btn btn-outline-dark">Dark</button>
5.3 ๐ Button Sizes & States
Buttons can be resized and adjusted for different UI contexts.
Use .btn-lg for large and .btn-sm for small.
<button class="btn btn-primary btn-lg">Large Button</button>
<button class="btn btn-success">Default Button</button>
<button class="btn btn-danger btn-sm">Small Button</button>
๐น Disabled State:
<button class="btn btn-secondary" disabled>Disabled</button>
<a href="#" class="btn btn-danger disabled" tabindex="-1" aria-disabled="true">Disabled Link</a>
aria-disabled="true" when disabling links styled as buttons.
5.4 ๐งฉ Button Groups & Toolbars
Button groups allow you to combine multiple buttons on a single line, while toolbars group multiple sets of buttons together.
๐ธ Button Group Example:
<div class="btn-group" role="group">
<button type="button" class="btn btn-primary">Left</button>
<button type="button" class="btn btn-primary">Middle</button>
<button type="button" class="btn btn-primary">Right</button>
</div>
๐น Toolbar Example:
<div class="btn-toolbar" role="toolbar">
<div class="btn-group me-2" role="group">
<button class="btn btn-secondary">1</button>
<button class="btn btn-secondary">2</button>
<button class="btn btn-secondary">3</button>
</div>
<div class="btn-group" role="group">
<button class="btn btn-danger">Delete</button>
</div>
</div>
๐น Vertical Group:
<div class="btn-group-vertical">
<button class="btn btn-outline-dark">Top</button>
<button class="btn btn-outline-dark">Middle</button>
<button class="btn btn-outline-dark">Bottom</button>
</div>
.btn-group with icons or dropdowns for toolbar-style controls.
โ Use
.btn + color classes to create buttons instantly.โ Outline buttons (
.btn-outline-*) are perfect for minimalist UIs.โ Adjust size with
.btn-sm / .btn-lg.โ Group buttons using
.btn-group or toolbars for organized actions.
Module 06 โ Images, Figures & Media Objects
Images make web pages engaging, but they must be responsive and visually consistent. Bootstrap provides ready-made classes for managing image size, alignment, borders, and captions. Youโll also learn about media objects โ a simple yet powerful layout component that combines text and images (like comments, blog posts, or product reviews). ๐
6.1 ๐งญ Responsive Images
Bootstrapโs .img-fluid class makes your images automatically scale with the size of their container.
This ensures your images look great on every screen โ mobile, tablet, or desktop.
<img src="example.jpg" class="img-fluid" alt="Responsive Image">
.img-fluid class applies max-width: 100%; and height: auto;,
so the image never overflows its parent container.
๐ Fixed vs Responsive:
- Without .img-fluid: The image keeps its original size and may overflow small screens.
- With .img-fluid: The image automatically adjusts to fit any screen width.
6.2 ๐ผ๏ธ Image Thumbnails
Thumbnails are small, rounded or bordered versions of images used in galleries, profiles, or previews.
Use .img-thumbnail for this effect.
<img src="photo.jpg" class="img-thumbnail" alt="Thumbnail Example">
.img-fluid + .img-thumbnail
for a responsive, framed image that fits any layout beautifully.
๐จ Example:
<img src="profile.jpg" class="img-fluid img-thumbnail rounded-circle" alt="User Avatar">
6.3 ๐ชถ Figures with Captions
Bootstrapโs <figure> and <figcaption> elements make it easy to include descriptive captions under your images.
Add .figure and .figure-caption for proper styling.
<figure class="figure">
<img src="nature.jpg" class="figure-img img-fluid rounded" alt="Beautiful Nature">
<figcaption class="figure-caption text-center">A peaceful view of nature.</figcaption>
</figure>
.text-start, .text-center, or .text-end.
This method is commonly used for portfolio images, educational diagrams, or photography websites.
6.4 ๐ฌ Media Object Layouts
A media object is a layout pattern that places an image or icon beside some text. Itโs great for testimonials, comments, blog previews, or product details.
<div class="media">
<img src="user.jpg" class="align-self-start me-3 rounded-circle" alt="User" width="80">
<div class="media-body">
<h5 class="mt-0">John Doe</h5>
<p>Bootstrap makes building responsive designs easy and elegant. This layout combines images and text seamlessly.</p>
</div>
</div>
.media class was replaced by Flex utilities in Bootstrap 5,
but you can recreate the same effect using .d-flex.
โ Modern Bootstrap 5 Version:
<div class="d-flex align-items-start">
<img src="avatar.jpg" class="flex-shrink-0 me-3 rounded-circle" width="80" alt="User">
<div>
<h5>Jane Smith</h5>
<p>This example uses Bootstrap 5 flexbox utilities instead of the old media component.</p>
</div>
</div>
.align-items-center and spacing utilities (.me-3, .mt-2)
to create neat, aligned layouts for testimonials or reviews.
โ
.img-fluid โ Makes images responsive.โ
.img-thumbnail โ Adds a border and padding for framed images.โ
<figure> + .figure-caption โ Perfect for captions and photo credits.โ
.d-flex โ Replaces .media for image-text layouts in Bootstrap 5.๐ง Combine these utilities to create elegant, adaptive visual designs easily.
Module 07 โ Tables
Tables allow you to organize data neatly into rows and columns. Bootstrap offers a rich set of table utilities for styling, responsiveness, color variants, borders, and hover effects โ all without writing a single line of custom CSS! ๐ช
7.1 ๐ Table Basics
To start using tables in Bootstrap, simply wrap your HTML table with the class .table.
This adds padding, borders, and text alignment for readability.
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Email</th>
<th>Country</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>John Doe</td>
<td>john@example.com</td>
<td>USA</td>
</tr>
<tr>
<td>2</td>
<td>Jane Smith</td>
<td>jane@example.com</td>
<td>UK</td>
</tr>
</tbody>
</table>
.table to any table element for instant Bootstrap formatting.
7.2 ๐จ Table Variants
Bootstrap provides several table color schemes for quick styling โ including striped, bordered, hover, and contextual classes.
๐น Striped Rows
<table class="table table-striped"> ... </table>
๐น Bordered Table
<table class="table table-bordered"> ... </table>
๐น Hover Effect
<table class="table table-hover"> ... </table>
๐น Color Variants
<table class="table table-success"> ... </table>
<table class="table table-danger"> ... </table>
<table class="table table-warning"> ... </table>
<table class="table table-info"> ... </table>
.table-success or .table-danger.
7.3 ๐ฑ Responsive Tables
On small screens, wide tables can cause horizontal overflow.
Bootstrapโs .table-responsive class wraps your table in a scrollable container,
allowing users to scroll horizontally without breaking layout.
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr><th>#</th><th>Name</th><th>Email</th><th>Address</th><th>Country</th></tr>
</thead>
<tbody>
<tr><td>1</td><td>Alice</td><td>alice@example.com</td><td>123 Elm Street</td><td>Canada</td></tr>
<tr><td>2</td><td>Bob</td><td>bob@example.com</td><td>456 Pine Ave</td><td>USA</td></tr>
</tbody>
</table>
</div>
.table-responsive-sm, .table-responsive-md, etc.
to make the scroll effect appear only on smaller breakpoints.
7.4 โ๏ธ Advanced Styling: Striped, Hover & Bordered Combo
Combine multiple table utilities for a polished and modern design. Hereโs an example combining stripes, hover effect, and borders ๐
<table class="table table-striped table-hover table-bordered align-middle">
<thead class="table-dark">
<tr>
<th>ID</th>
<th>Student Name</th>
<th>Course</th>
<th>Marks</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr class="table-success">
<td>1</td>
<td>Ravi Kumar</td>
<td>Web Development</td>
<td>88%</td>
<td>Passed</td>
</tr>
<tr class="table-warning">
<td>2</td>
<td>Sneha Patel</td>
<td>UI Design</td>
<td>60%</td>
<td>Average</td>
</tr>
<tr class="table-danger">
<td>3</td>
<td>Aman Verma</td>
<td>Cyber Security</td>
<td>45%</td>
<td>Failed</td>
</tr>
</tbody>
</table>
- Student result sheets ๐งพ
- Pricing tables ๐ฐ
- Admin dashboards ๐
- Sales or customer data lists ๐งโโ๏ธ
โ
.table gives instant professional styling.โ Use
.table-striped, .table-hover, .table-bordered for clean UI.โ Wrap tables in
.table-responsive for mobile-friendly layouts.โ Color individual rows with
.table-success, .table-danger, etc.โ Combine multiple utilities for advanced table designs.
Module 08 โ Forms and Form Controls
Forms are how users interact with your website โ login, registration, feedback, contact, search, and more. Bootstrap 5 makes form design incredibly easy and beautiful with built-in spacing, layout, and validation utilities. In this module, youโll learn all about form structure, input groups, floating labels, selects, checkboxes, and validation. ๐ช
8.1 ๐งฉ Form Structure & Layout
Every form starts with a simple structure of <form> elements like input, label, and button.
Bootstrap provides spacing and alignment automatically using classes like .mb-3 (margin bottom).
<form>
<div class="mb-3">
<label for="email" class="form-label">Email address</label>
<input type="email" class="form-control" id="email" placeholder="Enter your email">
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" placeholder="Enter your password">
</div>
<button type="submit" class="btn btn-primary">Login</button>
</form>
.form-label for labels and .form-control for input fields โ Bootstrap automatically adjusts width and padding.
๐ Inline Forms (Horizontal Layout)
<form class="row g-3 align-items-center">
<div class="col-auto">
<input type="text" class="form-control" placeholder="Search...">
</div>
<div class="col-auto">
<button type="submit" class="btn btn-success">Search</button>
</div>
</form>
8.2 ๐ Input Groups & Floating Labels
Input groups combine text, icons, or buttons inside a single input field. Perfect for email, currency, or search bars.
<div class="input-group mb-3">
<span class="input-group-text">@</span>
<input type="text" class="form-control" placeholder="Username">
</div>
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="Amount">
<span class="input-group-text">โน</span>
</div>
๐ง Floating Labels
Floating labels are a modern way to show input names that move up when users type.
Use .form-floating with <label> placed after the input.
<div class="form-floating mb-3">
<input type="email" class="form-control" id="floatingEmail" placeholder="Email">
<label for="floatingEmail">Email address</label>
</div>
<div class="form-floating">
<input type="password" class="form-control" id="floatingPassword" placeholder="Password">
<label for="floatingPassword">Password</label>
</div>
8.3 โ Checkboxes, Radios & Selects
Bootstrap gives you elegant controls for user selection โ from checkboxes and radio buttons to dropdown selects.
๐น Checkboxes
<div class="form-check">
<input class="form-check-input" type="checkbox" id="subscribe">
<label class="form-check-label" for="subscribe">
Subscribe to newsletter
</label>
</div>
๐น Radio Buttons
<div class="form-check">
<input class="form-check-input" type="radio" name="gender" id="male" checked>
<label class="form-check-label" for="male">Male</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="gender" id="female">
<label class="form-check-label" for="female">Female</label>
</div>
๐น Select Dropdown
<select class="form-select">
<option selected>Choose your country</option>
<option value="1">India</option>
<option value="2">USA</option>
<option value="3">Canada</option>
</select>
.form-select-sm or .form-select-lg for size variations.
8.4 ๐ง Form Validation
Form validation helps ensure users enter correct information. Bootstrap provides client-side validation styles that highlight fields in green or red.
<form class="needs-validation" novalidate>
<div class="mb-3">
<label for="validationEmail" class="form-label">Email</label>
<input type="email" class="form-control" id="validationEmail" required>
<div class="valid-feedback">Looks good!</div>
<div class="invalid-feedback">Please enter a valid email.</div>
</div>
<button class="btn btn-primary" type="submit">Submit</button>
</form>
<script>
(() => {
'use strict';
const forms = document.querySelectorAll('.needs-validation');
Array.from(forms).forEach(form => {
form.addEventListener('submit', event => {
if (!form.checkValidity()) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
})();
</script>
.valid-feedback and .invalid-feedback messages to show hints directly under each input.
8.5 ๐ File Inputs
File inputs allow users to upload files (images, PDFs, etc.).
Bootstrapโs .form-control automatically styles them nicely.
<div class="mb-3">
<label for="formFile" class="form-label">Upload your profile picture</label>
<input class="form-control" type="file" id="formFile">
</div>
โ
.form-control โ Standard text, password, or email input fields.โ
.input-group โ Combine inputs with icons or buttons.โ
.form-floating โ Modern floating label layout.โ
.form-check & .form-select โ Checkboxes, radios, and dropdowns.โ Validation helps users correct mistakes quickly.
โ All form controls are responsive and accessible out-of-the-box.
Module 09 โ Cards & Card Layouts
Cards are flexible containers that group related information โ like product details, user profiles, or blog posts. Each card can include images, titles, text, buttons, and even entire layouts. Bootstrapโs card system is lightweight, responsive, and perfect for almost any project. ๐ฏ
9.1 ๐งฑ Basic Card Structure
A Bootstrap card starts with the .card class.
Inside, you can add a .card-body to hold text, buttons, and more.
<div class="card" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title">NotesTime Course</h5>
<p class="card-text">
Learn Bootstrap with hands-on modules and examples.
Perfect for beginners and developers alike!
</p>
<a href="#" class="btn btn-primary">Start Learning</a>
</div>
</div>
.card-body for proper padding and alignment.
9.2 ๐ผ๏ธ Card with Images
Cards often include an image at the top or bottom.
Use .card-img-top or .card-img-bottom to position images correctly.
<div class="card" style="width: 18rem;">
<img src="course.jpg" class="card-img-top" alt="Course Image">
<div class="card-body">
<h5 class="card-title">Web Development</h5>
<p class="card-text">Learn HTML, CSS, and Bootstrap step by step.</p>
<a href="#" class="btn btn-success">Explore</a>
</div>
</div>
9.3 ๐๏ธ Card Groups & Decks
To display multiple cards side-by-side, use .card-group or .card-deck (Bootstrap 4)
โ in Bootstrap 5, use grid system or flex utilities for responsive card layouts.
<div class="row row-cols-1 row-cols-md-3 g-4">
<div class="col">
<div class="card h-100">
<img src="html.jpg" class="card-img-top" alt="HTML">
<div class="card-body">
<h5 class="card-title">HTML Basics</h5>
<p class="card-text">Understand structure and tags.</p>
</div>
</div>
</div>
<div class="col">
<div class="card h-100">
<img src="css.jpg" class="card-img-top" alt="CSS">
<div class="card-body">
<h5 class="card-title">CSS Styling</h5>
<p class="card-text">Design with colors and layouts.</p>
</div>
</div>
</div>
<div class="col">
<div class="card h-100">
<img src="bootstrap.jpg" class="card-img-top" alt="Bootstrap">
<div class="card-body">
<h5 class="card-title">Bootstrap Components</h5>
<p class="card-text">Build fast and responsive websites.</p>
</div>
</div>
</div>
</div>
class="h-100" to each card for equal heights in rows.
9.4 ๐ Card Overlays
Overlays let you display text over an image โ great for banners, blog headers, or featured articles.
<div class="card bg-dark text-white">
<img src="banner.jpg" class="card-img" alt="Banner">
<div class="card-img-overlay">
<h5 class="card-title">Welcome to NotesTime</h5>
<p class="card-text">Learn front-end development with live examples.</p>
<p class="card-text"><small>Updated just now</small></p>
</div>
</div>
.bg-dark and .text-white for readability.
9.5 ๐งญ Image + Text Cards (Practical Layout)
Hereโs a real-world example of using cards for displaying blog posts or products.
<div class="card mb-3" style="max-width: 540px;">
<div class="row g-0">
<div class="col-md-4">
<img src="laptop.jpg" class="img-fluid rounded-start" alt="Laptop">
</div>
<div class="col-md-8">
<div class="card-body">
<h5 class="card-title">Learn Bootstrap Step-by-Step</h5>
<p class="card-text">
This structured guide helps you master responsive design easily with examples and projects.
</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
</div>
</div>
โ
.card โ Create clean, content boxes.โ
.card-img-top / .card-img-bottom โ Add images.โ
.row-cols-* โ Create responsive grids of cards.โ
.card-img-overlay โ Display text over images.โ Combine grid & flex utilities for advanced card layouts.
๐ง Perfect for blogs, products, portfolios, and dashboards!
Module 10 โ Navbar & Navigation
The Bootstrap Navbar is a responsive, flexible, and mobile-first component that helps organize links, dropdowns, search boxes, and branding.
It automatically adapts to different screen sizes using Bootstrapโs powerful collapse system.
Letโs learn how to build your own navigation bar step by step ๐งญ
10.1 ๐๏ธ Navbar Basics
A basic Bootstrap navbar includes a brand name and simple links. You can customize the color, background, and padding easily using classes.
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">NotesTime</a>
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item"><a class="nav-link active" href="#">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#">Courses</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>
</nav>
.navbar-light bg-light for a light theme or .navbar-dark bg-dark for a dark one.
10.2 ๐ฑ Responsive Navbar (Collapsible Menu)
Bootstrap automatically converts your navbar into a collapsible โhamburger menuโ on smaller screens using .navbar-expand-lg and .collapse classes.
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container-fluid">
<a class="navbar-brand" href="#">NotesTime</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarMenu">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarMenu">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item"><a class="nav-link active" href="#">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#">Modules</a></li>
<li class="nav-item"><a class="nav-link" href="#">Projects</a></li>
</ul>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search">
<button class="btn btn-light" type="submit">Go</button>
</form>
</div>
</div>
</nav>
.navbar-expand-lg โ expands on large screens and collapses on smaller ones.
You can also use md or xl for other breakpoints.
10.3 ๐ฝ Navbar with Dropdowns
Dropdowns are a key feature of navbars, letting you organize multiple related links under one menu item.
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">Bootstrap Course</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarDropdown">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarDropdown">
<ul class="navbar-nav me-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="courseMenu" role="button" data-bs-toggle="dropdown">
Modules
</a>
<ul class="dropdown-menu" aria-labelledby="courseMenu">
<li><a class="dropdown-item" href="#">HTML Basics</a></li>
<li><a class="dropdown-item" href="#">CSS Styling</a></li>
<li><a class="dropdown-item" href="#">Bootstrap Advanced</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
bootstrap.bundle.min.js is included).
10.4 ๐จ Navbar Colors & Customization
Bootstrap offers built-in color themes for navbars:
bg-primary, bg-dark, bg-light, bg-success, etc.
You can also customize with your own CSS or Bootstrap variables.
<nav class="navbar navbar-expand-lg navbar-dark bg-success">
<div class="container-fluid">
<a class="navbar-brand" href="#">NotesTime</a>
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link active" href="#">Dashboard</a></li>
<li class="nav-item"><a class="nav-link" href="#">Internships</a></li>
<li class="nav-item"><a class="nav-link" href="#">Blog</a></li>
</ul>
</div>
</nav>
.shadow-sm, .bg-gradient, or custom CSS variables.
โจ Example: Custom Shadowed Navbar
<nav class="navbar navbar-expand-lg navbar-dark bg-dark shadow-lg">
<a class="navbar-brand ms-3" href="#">NotesTime Pro</a>
</nav>
โ
.navbar โ creates responsive navigation bars.โ
.navbar-expand-lg โ controls when the menu collapses.โ
.dropdown-menu โ adds dropdown items.โ
.navbar-light / .navbar-dark โ changes link color scheme.โ
bg-* classes โ instantly apply background colors.๐ง Combine search forms, icons, and branding for a professional header.
Module 11 โ Bootstrap Utilities & Helpers
Bootstrapโs Utility Classes are pre-made CSS helpers that let you style elements instantly.
No need to write new CSS โ just add the class you need!
For example, p-3 adds padding, text-center centers text, and shadow adds soft shadows.
Think of them as โready-to-use shortcutsโ to make your design faster and consistent โก
11.1 ๐ Spacing Utilities (Margin & Padding)
Bootstrap spacing utilities use the syntax:
{property}{sides}-{size}
where:
- Property:
m= margin,p= padding - Sides: t = top, b = bottom, s = start, e = end, x = left/right, y = top/bottom
- Size: 0โ5 (each step โ 0.25rem)
<div class="m-3 p-3 bg-light border">Margin 3, Padding 3</div>
<div class="mt-5 mb-2 bg-warning text-dark">Top Margin 5, Bottom 2</div>
<div class="px-4 py-2 bg-info text-white">Padding X 4, Y 2</div>
mx-auto to center blocks horizontally (like images or cards).
11.2 ๐จ Text & Color Utilities
Easily change text alignment, color, and decoration with simple utility classes.
<p class="text-start text-primary">Left aligned, Blue Text</p>
<p class="text-center text-success">Centered, Green Text</p>
<p class="text-end text-danger fw-bold">Right aligned, Bold Red Text</p>
<p class="text-muted fst-italic">Muted & Italic text</p>
<a href="#" class="text-decoration-none text-warning">No underline yellow link</a>
fw-bold = bold | fst-italic = italic | text-uppercase = CAPITAL TEXT
11.3 ๐งฑ Border & Shadow Utilities
Add borders, rounding, and shadows to elements using Bootstrap utilities.
<div class="border border-2 border-primary p-3 mb-3">Blue Border</div>
<div class="border-start border-danger border-4 p-3 mb-3">Left Border Only</div>
<div class="rounded shadow p-4 mb-3 bg-light">Rounded Corners + Shadow</div>
<div class="rounded-pill bg-success text-white p-2">Pill Shape Box</div>
.rounded + .shadow-lg for a beautiful card-like appearance.
11.4 ๐ Width, Height & Display Utilities
Control element sizes and display types easily with Bootstrap helpers.
<div class="bg-primary text-white w-50 p-3">Width 50%</div>
<div class="bg-secondary text-white h-25 p-3">Height 25%</div>
<div class="d-inline-block bg-warning p-2">Inline Block</div>
<div class="d-block bg-info p-2 mt-2">Block Element</div>
<div class="d-none d-md-block bg-dark text-white p-2 mt-2">Hidden on mobile</div>
d-none d-lg-block to hide elements on mobile and show on large screens only.
11.5 ๐คธ Flexbox & Alignment Utilities
Bootstrap uses Flexbox for layout alignment and positioning. You can align, justify, and center elements quickly using these classes.
<div class="d-flex justify-content-between align-items-center bg-light p-3">
<div class="p-2 bg-primary text-white">Left</div>
<div class="p-2 bg-success text-white">Center</div>
<div class="p-2 bg-danger text-white">Right</div>
</div>
| Class | Effect |
|---|---|
justify-content-start | Align items to the left |
justify-content-center | Center items horizontally |
justify-content-end | Align items to the right |
align-items-center | Vertically center items |
flex-column | Stack elements vertically |
d-flex + justify-content-center + align-items-center to perfectly center any element!
โ
m-*, p-* โ control margin & paddingโ
text-*, bg-* โ change color & alignmentโ
border, shadow, rounded โ design helpersโ
w-*, h-*, d-* โ control size & visibilityโ
d-flex + alignment classes โ layout perfection
โจ These utilities let you design fast โ *no CSS file needed!*
Module 12 โ Modal, Offcanvas & Toasts
Bootstrap includes three super-handy UI components for interactivity: ๐ช Modals (pop-up dialogs), ๐ฑ Offcanvas (slide-in sidebars), and ๐ Toasts (temporary alert notifications). These are all powered by Bootstrapโs JavaScript and are mobile-responsive by default. Letโs dive in step by step! ๐
12.1 ๐ช Bootstrap Modal โ Popup Dialogs
A Modal is a centered popup that appears on top of the page. Itโs great for login forms, confirmations, or displaying details without leaving the current page.
๐งฉ Basic Modal Structure
<!-- Button to Open Modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
Launch Demo Modal
</button>
<!-- Modal Structure -->
<div class="modal fade" id="exampleModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">NotesTime Modal</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
Welcome to your first Bootstrap modal! ๐
You can use it to show alerts, forms, or messages.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
fade for animation and data-bs-dismiss="modal" to close it smoothly.
๐จ Modal Sizes
<div class="modal-dialog modal-sm">...</div>
<div class="modal-dialog modal-lg">...</div>
<div class="modal-dialog modal-xl">...</div>
12.2 ๐ฑ Offcanvas โ Slide-in Sidebar
The Offcanvas component is a hidden sidebar that slides in from the left or right. Itโs perfect for mobile menus, side panels, or shopping carts.
๐งฉ Example: Left Side Menu
<!-- Button to open Offcanvas -->
<button class="btn btn-dark" type="button" data-bs-toggle="offcanvas" data-bs-target="#sideMenu">
Open Sidebar
</button>
<!-- Offcanvas Structure -->
<div class="offcanvas offcanvas-start" tabindex="-1" id="sideMenu">
<div class="offcanvas-header">
<h5 class="offcanvas-title">Menu</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas"></button>
</div>
<div class="offcanvas-body">
<ul class="list-unstyled">
<li><a href="#" class="text-decoration-none">Home</a></li>
<li><a href="#" class="text-decoration-none">Courses</a></li>
<li><a href="#" class="text-decoration-none">Blog</a></li>
<li><a href="#" class="text-decoration-none">Contact</a></li>
</ul>
</div>
</div>
offcanvas-start โ offcanvas-end for right side,
offcanvas-top or offcanvas-bottom for vertical ones.
๐ก Offcanvas with Background
<div class="offcanvas offcanvas-end text-bg-dark" tabindex="-1" id="darkMenu">
<div class="offcanvas-header">
<h5 class="offcanvas-title">Dark Sidebar</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas"></button>
</div>
<div class="offcanvas-body">
Dark themed offcanvas using text-bg-dark.
</div>
</div>
12.3 ๐ Toasts โ Notifications
Toasts are lightweight pop-up alerts that appear temporarily at the edge of the screen. Theyโre often used for feedback messages (like โSaved successfullyโ โ ).
๐งฉ Example: Simple Toast
<!-- Button to Show Toast -->
<button type="button" class="btn btn-success" id="showToast">Show Toast</button>
<!-- Toast Element -->
<div class="toast align-items-center text-bg-success border-0 position-fixed bottom-0 end-0 m-3" role="alert" id="liveToast">
<div class="d-flex">
<div class="toast-body">
โ
Successfully saved your progress!
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"></button>
</div>
</div>
<script>
const toastTrigger = document.getElementById('showToast');
const toastLive = document.getElementById('liveToast');
const toast = new bootstrap.Toast(toastLive);
toastTrigger.addEventListener('click', () => toast.show());
</script>
position-fixed and m-* classes to control toast placement anywhere.
โจ Multiple Toasts Example
<div class="toast-container position-fixed top-0 end-0 p-3">
<div class="toast text-bg-info"><div class="toast-body">Welcome Back! ๐</div></div>
<div class="toast text-bg-danger"><div class="toast-body">Error Saving Data โ</div></div>
</div>
โ Modals โ pop-up windows for forms and messages
โ Offcanvas โ slide-in sidebars for menus and navigation
โ Toasts โ quick feedback notifications
๐ง Combine these with buttons, forms, and icons to create professional, dynamic UI interactions!
Module 13 โ Carousel & Slideshows
A Carousel in Bootstrap is a rotating slideshow for images or text. It allows you to display multiple items โ like banners, testimonials, or featured products โ with smooth transitions. You can control how it slides, how fast it rotates, and even add captions. Letโs learn how to make it visually stunning and functional ๐
13.1 ๐๏ธ Basic Carousel Structure
The carousel uses .carousel and .carousel-inner to hold slides.
Each slide is inside a .carousel-item.
<div id="notesCarousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="slide1.jpg" class="d-block w-100" alt="Slide 1">
</div>
<div class="carousel-item">
<img src="slide2.jpg" class="d-block w-100" alt="Slide 2">
</div>
<div class="carousel-item">
<img src="slide3.jpg" class="d-block w-100" alt="Slide 3">
</div>
</div>
</div>
.active so the carousel knows where to start.
13.2 ๐ฎ Adding Controls (Next & Previous)
To let users manually move between slides, add navigation controls using buttons or icons.
<div id="notesCarousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="img1.jpg" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="img2.jpg" class="d-block w-100" alt="...">
</div>
</div>
<!-- Controls -->
<button class="carousel-control-prev" type="button" data-bs-target="#notesCarousel" data-bs-slide="prev">
<span class="carousel-control-prev-icon"></span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#notesCarousel" data-bs-slide="next">
<span class="carousel-control-next-icon"></span>
</button>
</div>
<span>Previous</span> and <span>Next</span> if you prefer.
13.3 ๐ Adding Indicators (Slide Dots)
Indicators show users which slide is currently active.
Each dot links to a specific slide using data-bs-slide-to.
<div id="bannerCarousel" class="carousel slide" data-bs-ride="carousel">
<!-- Indicators -->
<div class="carousel-indicators">
<button type="button" data-bs-target="#bannerCarousel" data-bs-slide-to="0" class="active"></button>
<button type="button" data-bs-target="#bannerCarousel" data-bs-slide-to="1"></button>
<button type="button" data-bs-target="#bannerCarousel" data-bs-slide-to="2"></button>
</div>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="slide1.jpg" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="slide2.jpg" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="slide3.jpg" class="d-block w-100" alt="...">
</div>
</div>
</div>
13.4 ๐ Autoplay & Interval Settings
You can make your carousel automatically switch slides every few seconds using the data-bs-ride and data-bs-interval attributes.
<div id="autoCarousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active" data-bs-interval="2000">
<img src="banner1.jpg" class="d-block w-100" alt="...">
</div>
<div class="carousel-item" data-bs-interval="3000">
<img src="banner2.jpg" class="d-block w-100" alt="...">
</div>
</div>
</div>
data-bs-interval="false" to stop auto-sliding.
13.5 ๐๏ธ Adding Captions & Text Overlays
Add text or buttons inside a slide with .carousel-caption.
Itโs perfect for headlines or โCall To Actionโ sections.
<div id="captionCarousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="hero.jpg" class="d-block w-100" alt="Hero">
<div class="carousel-caption d-none d-md-block">
<h5>Welcome to NotesTime</h5>
<p>Learn Bootstrap with beautiful examples.</p>
<a href="#" class="btn btn-light btn-sm">Start Learning</a>
</div>
</div>
</div>
</div>
.d-none d-md-block on captions to hide them on mobile for better visibility.
โ
.carousel โ Creates the sliderโ
.carousel-inner โ Contains slidesโ
.carousel-control-prev/next โ Adds arrowsโ
.carousel-indicators โ Adds navigation dotsโ
.carousel-caption โ Adds overlay text๐ง Combine autoplay + captions + controls for professional results!
Module 14 โ Alerts, Badges & Progress Bars
In this module, weโll explore three commonly used Bootstrap UI elements:
- ๐จ Alerts โ display notifications or messages
- ๐ท๏ธ Badges โ show counts or highlights
- ๐ Progress Bars โ visualize progress or status
14.1 ๐จ Bootstrap Alerts
Alerts are used to show important feedback like success, warnings, or errors. You can dismiss them easily or make them stay visible permanently.
๐ฏ Basic Alert Examples
<div class="alert alert-primary" role="alert">
This is a primary alert โ check it out!
</div>
<div class="alert alert-success" role="alert">
โ
Operation successful!
</div>
<div class="alert alert-danger" role="alert">
โ Something went wrong!
</div>
<div class="alert alert-warning" role="alert">
โ ๏ธ Be careful with this action.
</div>
alert-* with any Bootstrap color class โ like primary, success, danger, warning, info, dark.
โ Dismissible Alert
<div class="alert alert-success alert-dismissible fade show" role="alert">
Your profile has been updated successfully ๐
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
alert-dismissible fade show to make the alert closable with a smooth fade effect.
14.2 ๐ท๏ธ Bootstrap Badges
Badges are tiny count or status indicators โ perfect for showing notifications, unread messages, or statuses next to items.
๐ฏ Basic Badge Usage
<h1>Messages <span class="badge bg-primary">5</span></h1>
<h2>Notifications <span class="badge bg-danger">3</span></h2>
<p>New Comment <span class="badge bg-success">New</span></p>
๐ฆ Badges on Buttons
<button type="button" class="btn btn-dark position-relative">
Inbox
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">
99+
<span class="visually-hidden">unread messages</span>
</span>
</button>
position-relative and position-absolute to place badges perfectly.
๐จ Badge Colors
<span class="badge bg-primary">Primary</span>
<span class="badge bg-secondary">Secondary</span>
<span class="badge bg-success">Success</span>
<span class="badge bg-danger">Danger</span>
<span class="badge bg-warning text-dark">Warning</span>
<span class="badge bg-info text-dark">Info</span>
<span class="badge bg-dark">Dark</span>
14.3 ๐ Bootstrap Progress Bars
Progress bars visually show completion or loading status. You can control their width and color using Bootstrapโs utility classes.
๐งฉ Basic Example
<div class="progress">
<div class="progress-bar" style="width: 60%;">60% Complete</div>
</div>
๐จ Progress Bar Colors
<div class="progress mt-3">
<div class="progress-bar bg-success" style="width: 80%;">Success</div>
</div>
<div class="progress mt-2">
<div class="progress-bar bg-danger" style="width: 40%;">Error</div>
</div>
<div class="progress mt-2">
<div class="progress-bar bg-warning text-dark" style="width: 70%;">Warning</div>
</div>
progress-bar-striped or progress-bar-animated for extra flair.
๐ฅ Animated Example
<div class="progress mt-3">
<div class="progress-bar progress-bar-striped progress-bar-animated bg-info" style="width: 75%;">
Uploading...
</div>
</div>
โ Alerts โ show messages or feedback to users
โ Badges โ display counts, labels, and highlights
โ Progress Bars โ visualize progress dynamically
๐ง Combine these for dashboards, status pages, and notifications
Module 15 โ Cards & Card Layouts
The Bootstrap Card component is a simple yet powerful container for displaying content with a clean and organized design. Cards can hold images, titles, text, buttons, and even lists or embedded media. Letโs see how to make them attractive and useful in different layouts ๐งฉ
15.1 ๐ Basic Card Structure
A card consists of the .card container with sections like .card-body, .card-title, .card-text, and optional .card-img-top for images.
<div class="card" style="width: 18rem;">
<img src="card-image.jpg" class="card-img-top" alt="Card Image">
<div class="card-body">
<h5 class="card-title">Learn Bootstrap</h5>
<p class="card-text">Bootstrap makes front-end development faster and easier!</p>
<a href="#" class="btn btn-primary">Start Now</a>
</div>
</div>
style="width:..." or responsive grid classes like col-md-4.
15.2 ๐ผ๏ธ Image Placement in Cards
Cards support images on the top, bottom, or as full background covers. Hereโs how to use each:
<!-- Image on Top -->
<div class="card">
<img src="image-top.jpg" class="card-img-top" alt="...">
<div class="card-body">Text inside</div>
</div>
<!-- Image on Bottom -->
<div class="card">
<div class="card-body">Some content</div>
<img src="image-bottom.jpg" class="card-img-bottom" alt="...">
</div>
<!-- Image as Background -->
<div class="card text-bg-dark">
<img src="bg-image.jpg" class="card-img" alt="...">
<div class="card-img-overlay">
<h5 class="card-title">Overlay Card</h5>
<p class="card-text">Text appears over image</p>
</div>
</div>
.card-img-overlay to display text or buttons on top of the image background.
15.3 ๐ Card Groups, Decks & Grids
You can arrange multiple cards in a row using card groups or responsive grids. This is perfect for blog posts, services, or team sections.
<!-- Card Group (Equal Height Cards) -->
<div class="card-group">
<div class="card">
<img src="card1.jpg" class="card-img-top">
<div class="card-body"><h5>Card One</h5><p>Short info</p></div>
</div>
<div class="card">
<img src="card2.jpg" class="card-img-top">
<div class="card-body"><h5>Card Two</h5><p>More info</p></div>
</div>
</div>
<!-- Responsive Grid Layout -->
<div class="row row-cols-1 row-cols-md-3 g-4">
<div class="col">
<div class="card h-100">
<img src="blog1.jpg" class="card-img-top">
<div class="card-body">
<h5>Responsive Card</h5>
<p>Fits all screen sizes</p>
</div>
</div>
</div>
</div>
row-cols-md-3 to automatically make 3 cards per row on medium screens and above โ perfect for responsive designs!
15.4 ๐งฉ Advanced Cards (Headers, Footers & Lists)
You can add headers, footers, or even lists inside cards for structured content โ such as pricing or contact cards.
<div class="card text-center">
<div class="card-header">
Featured
</div>
<div class="card-body">
<h5 class="card-title">Special Offer</h5>
<p class="card-text">Get Bootstrap training at 50% off.</p>
<a href="#" class="btn btn-primary">Enroll Now</a>
</div>
<div class="card-footer text-muted">
Offer ends soon โฐ
</div>
</div>
<!-- List Group Inside Card -->
<div class="card" style="width: 18rem;">
<ul class="list-group list-group-flush">
<li class="list-group-item">HTML Basics</li>
<li class="list-group-item">CSS Styling</li>
<li class="list-group-item">Bootstrap Layouts</li>
</ul>
</div>
โ Cards โ clean content containers for text & media
โ Card Groups & Grids โ arrange cards responsively
โ Image & Overlay Cards โ visual storytelling
โ Headers, Footers, Lists โ structured information
๐ง Use cards everywhere: blogs, eCommerce, dashboards, or portfolios!
Module 16 โ Navbar & Navigation
A Navbar is the main navigation header of a website.
Bootstrap makes it super easy to build **responsive, sticky, and stylish navbars** using classes like .navbar, .navbar-expand, and .navbar-brand.
You can add logos, links, dropdowns, search bars, and even buttons! ๐งฉ
16.1 ๐งฑ Basic Navbar Structure
Hereโs the simplest responsive navbar โ it collapses on smaller screens and expands on large ones.
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">NotesTime</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarBasic">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarBasic">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item"><a class="nav-link active" href="#">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#">Courses</a></li>
<li class="nav-item"><a class="nav-link" href="#">Blog</a></li>
<li class="nav-item"><a class="nav-link" href="#">Contact</a></li>
</ul>
<button class="btn btn-outline-success">Login</button>
</div>
</div>
</nav>
navbar-expand-lg for responsiveness,
navbar-light or navbar-dark for theme color, and
bg-* classes for background.
16.2 ๐จ Navbar Colors & Backgrounds
Bootstrap navbars can use any color background โ from light to dark, even gradients or custom CSS.
<nav class="navbar navbar-dark bg-dark">...</nav>
<nav class="navbar navbar-light bg-warning">...</nav>
<nav class="navbar navbar-expand-md bg-primary navbar-dark">...</nav>
navbar-dark on dark backgrounds and navbar-light on light backgrounds for text visibility.
16.3 ๐ฑ Responsive Navbar Collapse
The navbar automatically becomes a โhamburger menuโ on small devices.
You can control when it collapses using navbar-expand-*.
<!-- Collapse at medium breakpoint -->
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">MySite</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav me-auto mb-2 mb-md-0">
<li class="nav-item"><a class="nav-link" href="#">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#">About</a></li>
</ul>
</div>
</div>
</nav>
navbar-expand-md or navbar-expand-lg for smoother transitions across screen sizes.
16.4 ๐ฝ Navbar with Dropdowns
You can easily add dropdown menus inside navbars using Bootstrapโs dropdown component.
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
Tutorials
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">HTML</a></li>
<li><a class="dropdown-item" href="#">CSS</a></li>
<li><a class="dropdown-item" href="#">Bootstrap</a></li>
</ul>
</li>
.dropdown-menu-end to align it to the right.
16.5 ๐ Navbar with Search Bar & Buttons
Add forms and buttons to your navbar for searching or actions.
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
16.6 ๐ Sticky & Fixed Navbar
Bootstrap allows you to keep the navbar always visible โ fixed to the top or bottom.
<nav class="navbar navbar-dark bg-dark fixed-top">...</nav>
<nav class="navbar navbar-light bg-light fixed-bottom">...</nav>
<nav class="navbar sticky-top bg-primary navbar-dark">...</nav>
fixed-top, add padding to your pageโs top so content doesnโt hide behind the navbar.
โ Navbar โ build responsive site headers
โ Dropdowns โ add multiple menu levels
โ Search Bars & Buttons โ improve UX
โ Sticky / Fixed Navbars โ enhance accessibility
๐ง Combine with branding and icons for professional results!
Module 17 โ Dropdowns & Nav Tabs
Dropdowns and tabs let users easily navigate different sections or content views without leaving the page. Bootstrapโs built-in components make these **dynamic menus** simple and stylish โ no custom JS needed! ๐ช
17.1 ๐ฝ Dropdown Basics
A dropdown menu displays additional options when a button or link is clicked. Hereโs a simple example:
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown">
Choose Topic
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">HTML</a></li>
<li><a class="dropdown-item" href="#">CSS</a></li>
<li><a class="dropdown-item" href="#">Bootstrap</a></li>
</ul>
</div>
data-bs-toggle="dropdown" to make it functional.
Bootstrap automatically handles the open/close behavior.
17.2 โ๏ธ Split Button Dropdowns
Split dropdowns give users both a **main action** and a **menu trigger**.
<div class="btn-group">
<button type="button" class="btn btn-success">Save</button>
<button type="button" class="btn btn-success dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown">
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Save as Draft</a></li>
<li><a class="dropdown-item" href="#">Save & Publish</a></li>
</ul>
</div>
17.3 ๐งญ Navigation Tabs
Tabs are perfect for switching between content sections โ like product details, reviews, or settings โ without reloading the page.
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button">Home</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button">Profile</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="contact-tab" data-bs-toggle="tab" data-bs-target="#contact" type="button">Contact</button>
</li>
</ul>
<div class="tab-content mt-3">
<div class="tab-pane fade show active" id="home">๐ Home content here.</div>
<div class="tab-pane fade" id="profile">๐ค Profile details here.</div>
<div class="tab-pane fade" id="contact">๐ Contact info here.</div>
</div>
data-bs-toggle="tab" for automatic switching between content panels.
17.4 ๐ Navigation Pills
Pills are a rounded and modern alternative to tabs. You can also make them vertical or justified across the screen.
<ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
<li class="nav-item">
<button class="nav-link active" id="pills-home-tab" data-bs-toggle="pill" data-bs-target="#pills-home">Home</button>
</li>
<li class="nav-item">
<button class="nav-link" id="pills-profile-tab" data-bs-toggle="pill" data-bs-target="#pills-profile">Profile</button>
</li>
<li class="nav-item">
<button class="nav-link" id="pills-contact-tab" data-bs-toggle="pill" data-bs-target="#pills-contact">Contact</button>
</li>
</ul>
<div class="tab-content mt-3">
<div class="tab-pane fade show active" id="pills-home">๐ Home Tab</div>
<div class="tab-pane fade" id="pills-profile">๐ค Profile Tab</div>
<div class="tab-pane fade" id="pills-contact">๐ Contact Tab</div>
</div>
nav-fill or nav-justified to make tabs stretch evenly across the width.
17.5 ๐งฑ Vertical Navs (Side Tabs)
You can display navigation tabs vertically โ great for dashboards or sidebar menus.
<div class="d-flex align-items-start">
<div class="nav flex-column nav-pills me-3" id="v-pills-tab" role="tablist">
<button class="nav-link active" data-bs-toggle="pill" data-bs-target="#v-home">Home</button>
<button class="nav-link" data-bs-toggle="pill" data-bs-target="#v-profile">Profile</button>
<button class="nav-link" data-bs-toggle="pill" data-bs-target="#v-settings">Settings</button>
</div>
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane fade show active" id="v-home">๐ Vertical Home</div>
<div class="tab-pane fade" id="v-profile">๐ค Vertical Profile</div>
<div class="tab-pane fade" id="v-settings">โ๏ธ Vertical Settings</div>
</div>
</div>
โ Dropdowns โ reveal hidden menu options
โ Split Buttons โ quick actions + choices
โ Tabs & Pills โ organize content cleanly
โ Vertical Navs โ great for side layouts
๐ง Bootstrap JS automatically powers the interactivity!
Module 18 โ Modal, Offcanvas & Toasts
Bootstrap includes JavaScript-powered UI components that make your website **interactive and dynamic**. You can create pop-ups, side panels, and live notifications without writing any JavaScript manually โ only HTML attributes! ๐
18.1 ๐ช Bootstrap Modal
A Modal is a centered pop-up dialog box that appears over your page content. Itโs used for sign-in forms, confirmations, or displaying additional information.
<!-- Button trigger -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
Open Modal
</button>
<!-- Modal Structure -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Welcome to NotesTime!</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Learn Bootstrap easily with step-by-step examples ๐
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Start Learning</button>
</div>
</div>
</div>
</div>
data-bs-toggle="modal" and data-bs-target="#id"
to connect a button with the modal you want to open.
๐ Modal Sizes
<div class="modal-dialog modal-sm">Small</div>
<div class="modal-dialog modal-lg">Large</div>
<div class="modal-dialog modal-xl">Extra Large</div>
18.2 ๐ฑ Offcanvas Component
The Offcanvas is a sliding panel (usually from left or right). Itโs perfect for side menus, mobile navigation, or filters โ similar to a drawer or sidebar.
<!-- Button to open Offcanvas -->
<button class="btn btn-dark" type="button" data-bs-toggle="offcanvas" data-bs-target="#sideMenu">
โฐ Open Sidebar
</button>
<!-- Offcanvas Structure -->
<div class="offcanvas offcanvas-start" tabindex="-1" id="sideMenu">
<div class="offcanvas-header">
<h5 class="offcanvas-title">Main Menu</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas"></button>
</div>
<div class="offcanvas-body">
<ul class="list-group">
<li class="list-group-item">Home</li>
<li class="list-group-item">Courses</li>
<li class="list-group-item">Blog</li>
<li class="list-group-item">Contact</li>
</ul>
</div>
</div>
offcanvas-end for right-side panel
- Use offcanvas-top or offcanvas-bottom for top/bottom drawers
18.3 ๐ Bootstrap Toasts (Notifications)
Toasts are small, temporary pop-up notifications used for alerts like โMessage Sentโ or โSaved Successfullyโ. They appear at the edge of the screen and disappear automatically or when closed.
<!-- Button Trigger -->
<button class="btn btn-success" id="showToastBtn">Show Toast</button>
<!-- Toast Container -->
<div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
<div id="liveToast" class="toast align-items-center text-bg-primary border-0" role="alert">
<div class="d-flex">
<div class="toast-body">
โ
Your file was uploaded successfully!
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"></button>
</div>
</div>
</div>
<!-- Script to trigger Toast -->
<script>
const toastTrigger = document.getElementById('showToastBtn')
const toastLive = document.getElementById('liveToast')
if (toastTrigger) {
toastTrigger.addEventListener('click', () => {
const toast = new bootstrap.Toast(toastLive)
toast.show()
})
}
</script>
top-0 start-0).
โ Modals โ pop-up boxes for forms and alerts
โ Offcanvas โ hidden side menus or drawers
โ Toasts โ instant notifications for user feedback
๐ง Bootstrap handles all functionality with simple
data-bs-* attributes!
Module 19 โ Carousel & Slideshow Components
The Bootstrap Carousel is a powerful and lightweight slider component for cycling through images, text, or custom content. You can control it with indicators, previous/next buttons, or even keyboard arrows โ all built-in! โ๏ธ
19.1 ๐ผ๏ธ Basic Carousel Structure
Letโs start with the simplest form โ a carousel that slides between images automatically.
<div id="basicCarousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="slide1.jpg" class="d-block w-100" alt="Slide 1">
</div>
<div class="carousel-item">
<img src="slide2.jpg" class="d-block w-100" alt="Slide 2">
</div>
<div class="carousel-item">
<img src="slide3.jpg" class="d-block w-100" alt="Slide 3">
</div>
</div>
</div>
data-bs-ride="carousel" to make it auto-slide continuously.
19.2 ๐๏ธ Adding Controls & Indicators
You can add **indicators** (the small dots) and **next/previous arrows** for user control.
<div id="carouselExampleIndicators" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-indicators">
<button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="0" class="active"></button>
<button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="1"></button>
<button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="2"></button>
</div>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="banner1.jpg" class="d-block w-100" alt="Banner 1">
</div>
<div class="carousel-item">
<img src="banner2.jpg" class="d-block w-100" alt="Banner 2">
</div>
<div class="carousel-item">
<img src="banner3.jpg" class="d-block w-100" alt="Banner 3">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
</button>
</div>
19.3 ๐ Adding Captions & Text Overlays
You can display text or call-to-action buttons on your slides using .carousel-caption.
<div class="carousel-item active">
<img src="hero1.jpg" class="d-block w-100" alt="Hero Image">
<div class="carousel-caption d-none d-md-block">
<h5>Welcome to Bootstrap Learning</h5>
<p>Master web design with clean and responsive layouts.</p>
<a href="#" class="btn btn-primary">Get Started</a>
</div>
</div>
d-none d-md-block for a cleaner view.
19.4 ๐น๏ธ Controlling Auto-Interval & Animation
You can control slide duration or turn off auto-sliding altogether.
<!-- Custom interval per slide -->
<div class="carousel-item" data-bs-interval="3000">...</div>
<!-- Turn off auto sliding -->
<div id="manualCarousel" class="carousel slide" data-bs-ride="false">...</div>
data-bs-pause="hover" to stop sliding when hovered.
19.5 ๐งฉ Custom Carousel Content (Cards, Videos, etc.)
Youโre not limited to images โ add any HTML inside carousel items like cards, testimonials, or embedded videos.
<div class="carousel-item">
<div class="d-flex justify-content-center">
<div class="card text-center" style="width: 20rem;">
<div class="card-body">
<h5 class="card-title">Student Testimonial</h5>
<p class="card-text">โBootstrap made responsive design so easy!โ</p>
<p>- Priya Sharma</p>
</div>
</div>
</div>
</div>
โ Carousel โ automatic or manual slide transitions
โ Indicators & Controls โ improve navigation
โ Captions โ add text and CTAs on images
โ Custom Content โ cards, text, or video
๐ง Bootstrapโs JS powers everything without custom code!
Module 20 โ Utilities & Helper Classes
Bootstrap Utilities are small, ready-to-use CSS classes that let you adjust spacing, color, alignment, and layout behavior **instantly** โ without writing any custom CSS. ๐ฏ Think of them as the โquick-access toolsโ in your web design toolbox.
20.1 ๐ Spacing Utilities (Margin & Padding)
The spacing system helps you control **margin (m)** and **padding (p)**. You can apply it on all sides or individually โ top, bottom, start, and end.
<!-- Margin (m) and Padding (p) syntax -->
m = margin
p = padding
t = top, b = bottom, s = start (left), e = end (right), x = left/right, y = top/bottom
<div class="mt-3 mb-4 px-5">Margin top 3, bottom 4, padding x 5</div>
| Size | Value |
|---|---|
| 0 | 0 (no space) |
| 1 | 0.25rem |
| 2 | 0.5rem |
| 3 | 1rem |
| 4 | 1.5rem |
| 5 | 3rem |
m-auto to center an element horizontally using auto margins.
20.2 ๐ Sizing Utilities (Width, Height, Max & Min)
Control the dimensions of any element with width and height utilities โ especially useful for images, modals, and cards.
<div class="w-25">25% width</div>
<div class="w-50">50% width</div>
<div class="w-75">75% width</div>
<div class="w-100">Full width</div>
<img src="image.jpg" class="w-50 h-auto" alt="Responsive Image">
.mw-100 and .mh-100 for max-width and max-height limits.
20.3 ๐งฑ Display & Visibility Utilities
Quickly control how elements are displayed using d-* classes.
<div class="d-block">Block element</div>
<span class="d-inline">Inline element</span>
<div class="d-flex">Flex container</div>
<div class="d-none d-md-block">Hidden on mobile, visible on desktop</div>
| Class | Behavior |
|---|---|
| d-none | Hide element |
| d-block | Display block |
| d-inline | Inline display |
| d-flex | Use Flexbox layout |
d-none d-lg-block hides an element on mobile but shows it on large screens.
20.4 ๐ฏ Position Utilities
Control where elements appear using position helpers like position-relative, absolute, or sticky.
<div class="position-relative">
<div class="position-absolute top-0 end-0 bg-primary text-white p-2">
Top Right Corner
</div>
</div>
top-0, bottom-0, start-0, end-0 for custom positioning.
20.5 ๐ Color, Background & Border Utilities
Easily add colors, background shades, and borders with Bootstrapโs built-in palette.
<div class="text-primary">Blue text</div>
<div class="bg-success text-white p-3">Green background</div>
<div class="border border-danger p-2">Red border</div>
<div class="rounded-3 shadow-sm p-3">Rounded with shadow</div>
20.6 ๐งญ Overflow, Z-Index & Shadow Utilities
Control how content behaves inside containers โ like scroll, hide overflow, or layer elements.
<div class="overflow-auto" style="max-height:100px;">
Long content that scrolls when needed.
</div>
<div class="position-relative z-3">Above others</div>
<div class="shadow-lg p-3 bg-light">Large shadow</div>
z-1 to z-3 to layer modals, dropdowns, or alerts correctly.
โ Margin & Padding โ quick spacing control
โ Width, Height โ responsive sizing
โ Display โ hide/show elements easily
โ Position โ absolute, relative, sticky layouts
โ Color & Border โ instant styling
โ Shadow, Overflow, Z-index โ professional depth & layering
๐ง Utilities = Fast, CSS-free customization for perfect design control!
Module 21 โ Responsive Helpers & Breakpoints
Bootstrapโs **responsive design system** allows you to create layouts that look perfect on all screen sizes.
Itโs built on a set of predefined **breakpoints** (like sm, md, lg, etc.)
that automatically adjust spacing, grids, typography, and components. ๐
21.1 ๐ What Are Breakpoints?
A breakpoint is a screen width where the layout changes to fit different devices. For example, a 3-column layout might change to 1-column on mobile. Bootstrap includes 6 default breakpoints:
| Breakpoint | Prefix | Min Width | Device Example |
|---|---|---|---|
| Extra Small | (none) | <576px | Phones (Portrait) |
| Small | sm | โฅ576px | Phones (Landscape) |
| Medium | md | โฅ768px | Tablets |
| Large | lg | โฅ992px | Laptops |
| Extra Large | xl | โฅ1200px | Desktops |
| Extra Extra Large | xxl | โฅ1400px | Large Monitors |
.col-md-6 or .d-lg-block
to apply styles only on certain devices.
21.2 ๐งฑ Responsive Grid Example
You can easily make your layout adjust automatically using grid breakpoints. For example:
<div class="container">
<div class="row">
<div class="col-12 col-md-6 col-lg-4 bg-light p-3">Column 1</div>
<div class="col-12 col-md-6 col-lg-4 bg-secondary text-white p-3">Column 2</div>
<div class="col-12 col-lg-4 bg-info text-white p-3">Column 3</div>
</div>
</div>
21.3 ๐๏ธ Responsive Display Utilities
You can control the visibility of elements across different screen sizes using d-*-* classes.
<div class="d-none d-md-block">Visible on Tablet & Desktop</div>
<div class="d-block d-md-none">Visible only on Mobile</div>
| Class | Behavior |
|---|---|
d-none | Always hidden |
d-sm-block | Visible on small and up |
d-lg-none | Hidden on large and up |
d-xl-block | Visible on extra large only |
d-none d-lg-block โ Hide on mobile, show on large screens.
21.4 ๐ Responsive Spacing Utilities
Spacing classes can also change by device!
Just add breakpoint prefixes like mt-md-5 or p-lg-3.
<div class="p-2 p-md-4 p-lg-5 bg-light">
Responsive padding changes by screen size!
</div>
21.5 ๐ฏ Responsive Text Alignment & Flex Helpers
Bootstrap lets you align text and flex items differently based on breakpoints.
<div class="text-center text-md-start text-lg-end">
Responsive Text Alignment
</div>
<div class="d-flex flex-column flex-md-row justify-content-between">
<div>Item 1</div>
<div>Item 2</div>
</div>
21.6 ๐ง Practical Example โ Responsive Navbar
Hereโs a mini example of a responsive navbar that collapses into a toggle menu on small screens.
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">NotesTime</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="mainNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item"><a class="nav-link" href="#">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#">Courses</a></li>
<li class="nav-item"><a class="nav-link" href="#">Contact</a></li>
</ul>
</div>
</div>
</nav>
.navbar-expand-md means:
- Collapsed on mobile
- Expanded from tablets (โฅ768px) and up
โ Breakpoints define screen size thresholds
โ Grids, spacing, and text can change responsively
โ Display utilities hide/show by device
โ Flex helpers adjust layout flow dynamically
โ Responsive navbar = best real-world use case
๐ง Mastering this = True Responsive Design Expert!
Module 22 โ Customizing Bootstrap with SCSS
Bootstrap is built with SCSS (Sass) โ a CSS preprocessor that allows developers to write modular, maintainable, and customizable styles. Instead of manually overriding Bootstrap classes, you can **customize variables and recompile** your own version! ๐ง
22.1 ๐งฉ What is SCSS (Sass)?
SCSS (Sassy CSS) is an enhanced version of CSS that supports variables, nesting, functions, and mixins. Bootstrap uses SCSS for all its styling to make customization faster and cleaner.
- ๐ฏ Variables โ Store reusable values (like colors or font sizes).
- ๐ Partials โ Split CSS into smaller modular files.
- ๐ Mixins โ Create reusable style functions.
- ๐ Imports โ Combine multiple files efficiently.
// Example of SCSS
$primary-color: #0d6efd;
button {
background: $primary-color;
border-radius: 10px;
}
.scss and must be compiled into CSS using tools like Sass CLI, Node, or Webpack.
22.2 โ๏ธ Setting Up Bootstrap Source Files
To customize Bootstrap deeply, download its **source files** instead of using the CDN. These contain all the SCSS files you can modify.
# Step 1: Create project folder
mkdir my-bootstrap-project
cd my-bootstrap-project
# Step 2: Install Bootstrap via npm
npm install bootstrap
# Step 3: Create main SCSS file
touch scss/custom.scss
Now you can import Bootstrapโs SCSS source inside your custom file:
// custom.scss
// 1๏ธโฃ Import Bootstrap functions & variables first
@import "../node_modules/bootstrap/scss/functions";
@import "../node_modules/bootstrap/scss/variables";
// 2๏ธโฃ Override variables here
$primary: #6f42c1; // Custom purple theme
$body-font-family: 'Poppins', sans-serif;
// 3๏ธโฃ Import rest of Bootstrap
@import "../node_modules/bootstrap/scss/bootstrap";
22.3 ๐จ Customizing Bootstrap Variables
Bootstrap provides hundreds of variables to easily tweak color schemes, typography, spacing, and component styles.
// colors
$primary: #ff5722;
$secondary: #607d8b;
$success: #28a745;
$danger: #dc3545;
// typography
$font-family-sans-serif: 'Inter', sans-serif;
$font-size-base: 1rem;
$headings-font-weight: 700;
// buttons
$btn-border-radius: 0.4rem;
$btn-padding-y: 0.5rem;
$btn-padding-x: 1rem;
22.4 ๐ง Using Mixins for Reusable Styles
Mixins are reusable blocks of CSS logic โ think of them as โstyle functions.โ Bootstrap has built-in mixins for breakpoints, transitions, gradients, and more.
22.5 ๐งฉ Compiling SCSS into CSS
Once youโve customized Bootstrapโs SCSS files, youโll need to compile them into a single CSS file your website can use.
# Install Sass globally
npm install -g sass
# Compile SCSS โ CSS
sass scss/custom.scss css/custom.css --watch
Now, link your new compiled CSS file in your HTML:
<link rel="stylesheet" href="css/custom.css">
_variables.scss
- Compile with sass
- Use your new theme like magic โจ
22.6 ๐ฏ Real Example โ Custom Purple Theme
Letโs say you want your brand to have a unique purple-and-gold aesthetic.
// custom.scss
$primary: #6f42c1; // purple
$warning: #f9c74f; // gold
$body-bg: #f8f9fa;
$body-color: #212529;
$border-radius: 0.5rem;
@import "../node_modules/bootstrap/scss/bootstrap";
<button class="btn btn-primary">Purple Button</button>
<button class="btn btn-warning">Gold Button</button>
โ Bootstrap is built with SCSS โ easy to customize
โ Override variables for colors, fonts, spacing
โ Use mixins for responsive & reusable design
โ Compile SCSS into CSS using Sass tools
โ Build your own branded Bootstrap theme ๐จ
Module 23 โ Bootstrap Projects & Deployment
In this final module, youโll combine everything youโve learned โ grid systems, utilities, components, responsive design, and SCSS โ to build real-world web projects. Youโll also learn how to deploy your website online for free using GitHub Pages or Netlify. ๐
23.1 ๐ผ Project 1 โ Portfolio Website
Letโs create a personal portfolio website using Bootstrapโs grid and card systems. This project helps you showcase your skills and projects beautifully.
<header class="bg-dark text-white text-center py-5">
<h1>Hi, I'm Rohan ๐</h1>
<p>Frontend Developer | Designer | Freelancer</p>
<a href="#projects" class="btn btn-primary">View My Work</a>
</header>
<section id="projects" class="container my-5">
<div class="row g-4">
<div class="col-md-4">
<div class="card shadow">
<img src="project1.jpg" class="card-img-top" alt="Project 1">
<div class="card-body">
<h5 class="card-title">E-Commerce UI</h5>
<p class="card-text">A modern responsive shop layout built with Bootstrap 5.</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card shadow">
<img src="project2.jpg" class="card-img-top" alt="Project 2">
<div class="card-body">
<h5 class="card-title">Blog Website</h5>
<p class="card-text">A clean and minimal blog homepage layout.</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card shadow">
<img src="project3.jpg" class="card-img-top" alt="Project 3">
<div class="card-body">
<h5 class="card-title">Landing Page</h5>
<p class="card-text">A startup landing page with smooth navigation and call-to-actions.</p>
</div>
</div>
</div>
</div>
</section>
23.2 ๐ป Project 2 โ Landing Page Design
Build a modern, product-focused landing page with a hero banner, features, and a call-to-action section.
<section class="bg-primary text-white text-center py-5">
<div class="container">
<h1>Launch Your Product with Style</h1>
<p>A sleek landing page template built using Bootstrap 5.</p>
<a href="#" class="btn btn-light btn-lg">Get Started</a>
</div>
</section>
<section class="container py-5">
<div class="row text-center">
<div class="col-md-4">
<i class="bi bi-lightning-charge display-4 text-primary"></i>
<h4>Fast Performance</h4>
<p>Built for speed and efficiency.</p>
</div>
<div class="col-md-4">
<i class="bi bi-phone display-4 text-primary"></i>
<h4>Mobile Ready</h4>
<p>Looks great on every device.</p>
</div>
<div class="col-md-4">
<i class="bi bi-palette display-4 text-primary"></i>
<h4>Customizable</h4>
<p>Easily modify colors, fonts, and layouts.</p>
</div>
</div>
</section>
23.3 ๐ฐ Project 3 โ Blog Layout with Cards
Create a blog homepage using Bootstrapโs card layout and grid utilities.
<div class="container my-5">
<div class="row g-4">
<div class="col-md-6 col-lg-4">
<div class="card h-100">
<img src="blog1.jpg" class="card-img-top" alt="Post">
<div class="card-body">
<h5 class="card-title">Learn Bootstrap 5</h5>
<p class="card-text">A complete beginnerโs guide to Bootstrap components and utilities.</p>
<a href="#" class="btn btn-outline-primary">Read More</a>
</div>
</div>
</div>
</div>
</div>
23.4 โ๏ธ Hosting & Deployment (GitHub / Netlify)
Once your project is ready, you can publish it online **for free** using GitHub Pages or Netlify. ๐
๐ Deploy Using GitHub Pages
# Step 1: Initialize Git
git init
git add .
git commit -m "Initial Bootstrap project"
# Step 2: Push to GitHub
git remote add origin https://github.com/username/bootstrap-portfolio.git
git push -u origin main
# Step 3: Enable Pages
Go to GitHub โ Repository โ Settings โ Pages โ Select "main / root"
https://username.github.io/bootstrap-portfolio
โ๏ธ Deploy Using Netlify
# Option 1: Drag & Drop
1๏ธโฃ Go to https://www.netlify.com/
2๏ธโฃ Log in โ "Add new site" โ "Deploy manually"
3๏ธโฃ Drag your project folder onto the upload area
# Option 2: Connect GitHub Repo
1๏ธโฃ Click "Import from Git"
2๏ธโฃ Choose your GitHub repo
3๏ธโฃ Click "Deploy Site"
23.5 ๐ง Final Project Tips & Best Practices
- ๐งฉ Always use the grid system for structure โ avoid manual CSS positioning.
- ๐ฑ Test responsiveness on multiple devices (mobile, tablet, desktop).
- ๐จ Use custom SCSS for brand colors and consistent theming.
- ๐งญ Optimize images (JPG/WEBP) for faster loading.
- ๐ฆ Use Bootstrap icons for modern and lightweight visuals.
- ๐ฆ Use the โInspectโ tool to debug and preview responsive layouts.
โ Built 3 real-world projects (Portfolio, Landing Page, Blog)
โ Used all Bootstrap components & utilities
โ Learned how to deploy to GitHub Pages & Netlify
โ Followed best practices for design, speed & responsiveness
๐ Congratulations โ Youโve completed the Bootstrap Full Course!