Master Bootstrap From Scratch

Clear, interactive, and structured Bootstrap lessons designed for beginners and developers.

Bootstrap Advanced Practice Lab

Topic-wise Bootstrap 5 advanced practical programs with code, live output, and exercises.

Instructions: Study each program, test its output, and then recreate the example yourself.

1. Breadcrumbs

Practice question: Create breadcrumbs for a Home → Courses → Java page.

<nav aria-label="breadcrumb">
    <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="#">Home</a></li>
        <li class="breadcrumb-item"><a href="#">Courses</a></li>
        <li class="breadcrumb-item active" aria-current="page">Java</li>
    </ol>
</nav>
Live Output

2. Input Groups

Practice question: Create a search input with a Search button and an email input with a prefix.

<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">
    <input type="search" class="form-control"
           placeholder="Search courses">
    <button class="btn btn-primary">Search</button>
</div>
Live Output
@

3. Custom Forms

Practice question: Create a form with a select list, checkbox, and switch.

<select class="form-select">
    <option selected>Select Course</option>
    <option>Java</option>
    <option>Python</option>
</select>

<div class="form-check mt-3">
    <input class="form-check-input" type="checkbox" id="terms">
    <label class="form-check-label" for="terms">
        Accept Terms
    </label>
</div>

<div class="form-check form-switch mt-3">
    <input class="form-check-input" type="checkbox" role="switch"
           id="notifications">
    <label class="form-check-label" for="notifications">
        Enable Notifications
    </label>
</div>
Live Output

4. Tooltips

Practice question: Show extra information when a user hovers over a button.

<button type="button" class="btn btn-primary"
        data-bs-toggle="tooltip"
        title="Click to register">
    Register
</button>
Live Output

Hover over the button or focus it using the keyboard.

5. Popovers

Practice question: Display a title and description inside a popup.

<button type="button" class="btn btn-success"
        data-bs-toggle="popover"
        data-bs-title="Course Details"
        data-bs-content="Learn Bootstrap 5 step by step.">
    Course Info
</button>
Live Output

6. Spinners

Practice question: Display a loading spinner and a spinner inside a button.

<div class="spinner-border text-primary" role="status">
    <span class="visually-hidden">Loading...</span>
</div>

<button class="btn btn-primary" disabled>
    <span class="spinner-border spinner-border-sm"
          aria-hidden="true"></span>
    Loading...
</button>
Live Output
Loading...
Loading...

7. Carousel

Practice question: Create a carousel with three slides and Previous/Next controls.

<div id="practiceCarousel" class="carousel slide"
     data-bs-ride="false">
    <div class="carousel-inner">
        <div class="carousel-item active">
            <div class="bg-primary text-white p-5">Slide 1</div>
        </div>
        <div class="carousel-item">
            <div class="bg-success text-white p-5">Slide 2</div>
        </div>
    </div>
    <button class="carousel-control-prev"
            data-bs-target="#practiceCarousel"
            data-bs-slide="prev">
        <span class="carousel-control-prev-icon"></span>
    </button>
    <button class="carousel-control-next"
            data-bs-target="#practiceCarousel"
            data-bs-slide="next">
        <span class="carousel-control-next-icon"></span>
    </button>
</div>
Live Output

8. ScrollSpy

Practice question: Highlight navigation links as the user scrolls through different sections.

<nav id="scrollspyNav" class="nav nav-pills">
    <a class="nav-link" href="#sectionOne">Section 1</a>
    <a class="nav-link" href="#sectionTwo">Section 2</a>
</nav>

<div data-bs-spy="scroll"
     data-bs-target="#scrollspyNav"
     data-bs-smooth-scroll="true"
     tabindex="0"
     style="height: 200px; overflow-y: auto;">
    <h5 id="sectionOne">Section 1</h5>
    <p>Section one content...</p>
    <h5 id="sectionTwo">Section 2</h5>
    <p>Section two content...</p>
</div>
Live Output
Section 1: Containers

Containers organize and align website content.

Section 2: Grid

The grid system creates responsive columns.

Section 3: Components

Bootstrap components provide reusable UI elements.

Scroll inside the content area to test section tracking.

9. Helper and Utility Classes

Practice question: Use spacing, text, background, border, and display utilities.

<div class="bg-primary text-white p-3 mb-3 rounded">
    Styled Box
</div>

<p class="text-success fw-bold">Success Message</p>
<div class="border border-danger rounded p-3">
    Bordered Box
</div>
Live Output
Styled Box — padding, background, margin and rounded corners

Success Message

Bordered Box

10. Dropdown Menus

Practice question: Create a menu with Java, Python and .NET options.

<div class="dropdown">
    <button class="btn btn-primary dropdown-toggle"
            data-bs-toggle="dropdown">
        Choose Course
    </button>
    <ul class="dropdown-menu">
        <li><a class="dropdown-item" href="#">Java</a></li>
        <li><a class="dropdown-item" href="#">Python</a></li>
        <li><a class="dropdown-item" href="#">.NET</a></li>
    </ul>
</div>
Live Output

Advanced Practice Assignments

  1. Create a tooltip for every field in a registration form.
  2. Use a popover to display course fees and duration.
  3. Create a carousel with four course slides.
  4. Build a ScrollSpy page with five topic sections.
  5. Create a toast notification after a successful form action.
  6. Combine breadcrumbs, navbar, cards and pagination in one page.

Summary

You practiced breadcrumbs, input groups, form switches, tooltips, popovers, spinners, carousel, ScrollSpy, helper classes and dropdown menus.