Category: Bootstrap 5

  • Bootstrap 5 Typography: Font Sizes, Weights, and Display Classes

    Bootstrap 5 Typography: Font Sizes, Weights, and Display Classes

    Typography is one of the most direct levers you have over how a website feels — and Bootstrap 5 ships with a comprehensive set of utility classes that let you control font sizes, weights, and display headings without writing a single line of custom CSS. Knowing which class does what, and when to reach for each one, is the difference between a polished layout and one that looks like a first draft.

    Key Takeaways

    • Bootstrap 5 includes a full scale of font-size utilities (fs-1 through fs-6) that are independent of heading semantics, giving you precise control over visual hierarchy.
    • Display classes (display-1 through display-6) are designed for hero headings and large marketing text — they render much larger than standard heading tags.
    • Font-weight and font-style utilities let you adjust typographic emphasis inline without touching your stylesheet.
    • When using Bootstrap 5 inside the Canvas HTML Template, you can layer Canvas CSS variables like –cnvs-primary-font on top of Bootstrap’s type utilities for fully branded typography.

    How Bootstrap 5 Sets Up Its Typography Foundation

    Bootstrap 5 uses a base font size of 16px on the <html> element and builds all its type scale from rem units, which means your typography scales predictably when users change browser font preferences. This is important in 2025 because accessibility audits increasingly flag fixed-pixel font sizes as a failure point.

    The default body font stack is a system-font stack — system-ui, -apple-system, “Segoe UI”, Roboto — which loads instantly without a web font request. In practice, most projects override this via a custom font pairing, and when working inside Canvas, you do this through the –cnvs-primary-font and –cnvs-secondary-font CSS variables rather than overriding Bootstrap’s Sass variables directly.

    Bootstrap 5 also resets margins on headings (h1–h6) to a consistent 0 0 0.5rem, which prevents the inconsistent browser-default spacing that used to require manual resets. Understanding these defaults saves you from fighting the cascade when you start customising.

    tilt shift lens photography close shot of brown letter and number blocks
    Photo by Mr Cup / Fabien Barral on Unsplash

    Font Size Utilities: fs-1 Through fs-6

    The fs- utilities decouple visual size from semantic meaning. You can make a <p> tag render at heading scale, or make an <h1> render at body size, purely through a class — the HTML element stays semantically correct for accessibility and SEO while the visual presentation is controlled independently.

    <p class="fs-1">This paragraph renders at h1 visual size</p>
    <p class="fs-2">Slightly smaller — equivalent to h2 scale</p>
    <p class="fs-3">h3-scale text on a paragraph element</p>
    <h3 class="fs-6">Semantically h3, but visually small</h3>

    The mapped sizes are: fs-1 = 2.5rem, fs-2 = 2rem, fs-3 = 1.75rem, fs-4 = 1.5rem, fs-5 = 1.25rem, fs-6 = 1rem. These mirror the default heading scale exactly, which makes it easy to reason about the relationship between your semantic structure and your visual hierarchy. If you need values outside this scale, you can use Bootstrap’s responsive font-size feature (RFS) or define custom utility classes in your project’s Sass configuration.

    Display Classes for Hero and Marketing Text

    When standard heading sizes are not large enough — for hero sections, landing page headlines, or full-width banners — Bootstrap 5’s display classes give you a heavier, larger type scale designed specifically for marketing contexts. This is one of the most visually impactful tools in Bootstrap’s typography toolkit.

    <h1 class="display-1">The Largest Display Heading</h1>
    <h2 class="display-3">A mid-scale display heading</h2>
    <p class="display-6">Smallest display class — still larger than fs-1</p>

    The display scale runs from display-1 (5rem) down to display-6 (2.5rem), and all use a font weight of 300 by default — giving them an elegant, editorial quality rather than a heavy feel. This lighter weight at large size is a deliberate design choice: heavy weight at very large sizes can feel aggressive rather than authoritative.

    For a deeper look at how large typographic elements fit into broader layout patterns, the post on grid systems and visual order in web layouts covers how type scale and grid structure work together to create hierarchy.

    flat-lay photography of stamp lot
    Photo by Kristian Strand on Unsplash

    Font Weight, Style, and Lead Utilities

    Bootstrap 5 includes a complete set of font-weight utilities that map directly to CSS font-weight values. These are essential when you need to add emphasis without switching to a different element or writing inline styles.

    <p class="fw-bold">Bold text — font-weight: 700</p>
    <p class="fw-semibold">Semibold — font-weight: 600</p>
    <p class="fw-normal">Normal — font-weight: 400</p>
    <p class="fw-light">Light — font-weight: 300</p>
    <p class="fst-italic">Italic text</p>
    <p class="fst-normal">Removes italic from inherited italic</p>

    One frequently overlooked utility is .lead, which increases a paragraph’s font size to 1.25rem and sets font-weight to 300 — making it ideal for introductory paragraphs immediately below a hero heading. When building webinar or event pages, a well-styled lead paragraph immediately after the headline measurably improves readability and can support conversion goals. The post on webinar registration page design covers how typographic hierarchy contributes to pages that convert.

    <h1 class="display-4 fw-bold">Register for the Live Webinar</h1>
    <p class="lead">Join 2,000+ professionals learning how to scale their teams in 2025.</p>

    Text Alignment, Transform, and Truncation

    Bootstrap 5 provides responsive text-alignment utilities that let you change alignment at specific breakpoints — removing the need for custom media queries in most cases.

    <p class="text-start">Left-aligned text</p>
    <p class="text-center">Centred text</p>
    <p class="text-end">Right-aligned text</p>
    
    <p class="text-sm-start text-md-center">
      Left on small screens, centred from medium up
    </p>
    
    <p class="text-uppercase fw-semibold">uppercase label</p>
    <p class="text-lowercase">FORCED TO LOWERCASE</p>
    <p class="text-capitalize">first letter of each word capitalised</p>
    
    <p class="text-truncate" style="max-width: 200px;">
      This long sentence will be cut off with an ellipsis when it overflows
    </p>

    The text-truncate class requires the element to be a block or inline-block with a defined width — something to watch for when you apply it inside flex containers. Also worth noting: text-decoration-none is a typography utility that removes underlines, commonly used on nav links and button-style anchors, and text-decoration-underline can restore underlines on elements where they have been removed by a reset.

    Applying Canvas Typography Variables Over Bootstrap Classes

    When working with the Canvas Builder tool or building directly in the Canvas HTML Template, Bootstrap’s typography utilities remain fully available — but Canvas layers its own CSS variable system on top. Rather than overriding Bootstrap’s Sass variables (which requires a build step), Canvas lets you customise typography through CSS variables scoped to the :root.

    :root {
      --cnvs-primary-font: 'Inter', sans-serif;
      --cnvs-secondary-font: 'Playfair Display', serif;
    }
    
    body {
      font-family: var(--cnvs-primary-font);
    }
    
    .section-heading {
      font-family: var(--cnvs-secondary-font);
    }

    This approach means you can set your brand typefaces once and let all Canvas components inherit them, while still using Bootstrap’s fs-, fw-, and display- classes for granular control within individual sections. If you want to convert a designer-specified pixel size from a mockup into rem for use alongside Bootstrap, the px to rem converter handles that quickly.

    Understanding how type and grid interact is equally important — for a practical breakdown of Bootstrap’s grid system in layout contexts, see the comparison post on CSS Grid vs Bootstrap Grid.

    Frequently Asked Questions

    What is the difference between Bootstrap 5 heading tags and fs- utilities?

    Heading tags (h1–h6) carry semantic meaning — they define document structure for screen readers and search engines. The fs-1 through fs-6 utilities only control visual size with no semantic effect. Use the right HTML element for structure, then use fs- classes to adjust the visual scale if the default heading size does not match your design.

    When should I use display classes instead of heading tags?

    Use display-1 through display-6 when you need text larger and lighter than standard headings — typically in hero sections, full-width banners, or large marketing callouts. They are not replacements for heading tags; they are visual modifiers you apply on top of heading tags to override the default size.

    Does Bootstrap 5 include responsive typography by default?

    Bootstrap 5 includes an opt-in feature called Responsive Font Sizes (RFS) that automatically scales type values down on smaller screens. It is applied to headings by default in the Bootstrap build but requires Sass compilation to customise. If you are working with a compiled Bootstrap file, you can achieve responsive scaling manually using responsive breakpoint utilities like fs-md-1.

    How do I use Bootstrap typography classes inside the Canvas HTML Template?

    Bootstrap 5 is bundled inside Canvas, so all Bootstrap typography utilities work out of the box — no separate CDN link needed. Apply fs-, fw-, and display- classes directly in your HTML. For brand-level font customisation, set –cnvs-primary-font and –cnvs-secondary-font in your CSS rather than overriding Bootstrap variables.

    Can I combine Bootstrap font-weight utilities with Google Fonts?

    Yes. Load your Google Fonts link in the <head> of your document, set the font on body or via Canvas’s –cnvs-primary-font variable, and Bootstrap’s fw-bold, fw-light, and other utilities will apply the correct font-weight values. Make sure you load all the font-weight variants you need in the Google Fonts URL — if the 300 weight is not loaded, fw-light will fall back to the nearest available weight.

    If you’re working with the Canvas HTML Template and want to generate production-ready layouts faster, try Canvas Builder free and see how much time you save on every project.

  • Bootstrap 5 Modal Components: Building Popup Dialogues

    Bootstrap 5 Modal Components: Building Popup Dialogues

    Popup dialogues are one of the most versatile UI patterns on the web — used for confirmations, forms, image previews, and notifications — yet many developers implement them poorly, either blocking the page incorrectly or relying on outdated JavaScript libraries. Bootstrap 5 solves this cleanly with its built-in Bootstrap modal component, requiring no third-party dependencies and giving you full control over structure, behaviour, and accessibility.

    Key Takeaways

    • Bootstrap 5 modals are fully self-contained — no jQuery or third-party plugins required, just the bundled Bootstrap JS.
    • Modal size, scrolling behaviour, and backdrop options are all controlled through data attributes and CSS utility classes.
    • Stacking multiple modals or nesting a form inside a modal are common patterns that require specific structural decisions to work correctly.
    • When using the Canvas HTML Template, Bootstrap 5 is already bundled — never load the Bootstrap CDN separately alongside it.

    How the Bootstrap 5 Modal Component Works

    The Bootstrap 5 modal is a layered dialog system that consists of three structural parts: the modal wrapper (.modal), the dialog container (.modal-dialog), and the content box (.modal-content). When triggered, Bootstrap adds a backdrop overlay, applies overflow: hidden to the body to prevent scroll, and shifts focus to the modal for accessibility compliance.

    Triggering a modal requires either a data attribute on a button or programmatic invocation via JavaScript. The data attribute approach is the most common and requires zero custom JS:

    <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
      Open Modal
    </button>
    
    <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">Modal Title</h5>
            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
          </div>
          <div class="modal-body">
            <p>Your modal content goes here.</p>
          </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>

    The tabindex="-1" attribute on the outer .modal div ensures the element receives focus when opened without being part of the natural tab order when closed. This is a required accessibility detail, not optional.

    a computer screen with the words the easy way to build marketplaces
    Photo by Team Nocoloco on Unsplash

    Bootstrap 5 provides five size modifier classes applied to the .modal-dialog element. Choosing the right size prevents the common mistake of cramming too much content into a default-width modal or leaving a simple confirmation dialogue feeling oversized.

    • .modal-sm — 300px max-width, ideal for simple confirmations or alerts
    • .modal-lg — 800px max-width, suitable for forms or preview panels
    • .modal-xl — 1140px max-width, for data tables or detailed content
    • .modal-fullscreen — occupies the entire viewport
    • .modal-fullscreen-{breakpoint}-down — fullscreen below a specific breakpoint, useful for mobile UX

    A common pattern for mobile-first projects is the responsive fullscreen variant, which keeps the modal at a fixed size on desktop while expanding to fullscreen on smaller screens:

    <div class="modal-dialog modal-lg modal-fullscreen-md-down">
      <!-- modal-content here -->
    </div>

    If you are working on responsive layout decisions more broadly, the principles covered in Bootstrap 5 Breakpoints: How to Build Truly Responsive Layouts apply directly to modal sizing choices at different viewports.

    Scrollable and Vertically Centred Modals

    By default, a modal that exceeds the viewport height will scroll the entire page. Adding .modal-dialog-scrollable changes this behaviour so that the .modal-body scrolls internally while the header and footer remain fixed — essential for forms with many fields or long terms-and-conditions text.

    Vertical centring is handled by .modal-dialog-centered, which positions the dialogue in the middle of the viewport rather than near the top. These two modifier classes can be combined:

    <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable modal-lg">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title">Terms and Conditions</h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
        <div class="modal-body">
          <p>Long scrollable content here...</p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-success" data-bs-dismiss="modal">I Agree</button>
        </div>
      </div>
    </div>
    a window with a sign that says we're setting up a new show
    Photo by Rapha Wilde on Unsplash

    One of the most practical uses of a Bootstrap popup is a contact or lead-capture form that appears without navigating away from the current page. The key structural rule is to place the <form> tag inside .modal-content but wrapping both .modal-body and .modal-footer, so the submit button in the footer remains part of the form:

    <div class="modal fade" id="contactModal" tabindex="-1" aria-labelledby="contactModalLabel" aria-hidden="true">
      <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
          <form action="/submit" method="POST">
            <div class="modal-header">
              <h5 class="modal-title" id="contactModalLabel">Get in Touch</h5>
              <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
              <div class="mb-3">
                <label for="nameInput" class="form-label">Full Name</label>
                <input type="text" class="form-control" id="nameInput" name="name" required>
              </div>
              <div class="mb-3">
                <label for="emailInput" class="form-label">Email Address</label>
                <input type="email" class="form-control" id="emailInput" name="email" required>
              </div>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
              <button type="submit" class="btn btn-primary">Send Message</button>
            </div>
          </form>
        </div>
      </div>
    </div>

    This pattern is frequently used on landing pages and SaaS product sites — if you are building that type of page, the post on How to Build an AI SaaS Landing Page with Canvas HTML Template shows how these components fit into a complete page structure.

    Controlling Modals Programmatically with JavaScript

    Data attributes handle most use cases, but there are situations — such as showing a modal after an AJAX call completes or dismissing it after successful form validation — where you need programmatic control via the Bootstrap Modal JavaScript API.

    Bootstrap 5 exposes a clean API through bootstrap.Modal. The three most used methods are show(), hide(), and toggle():

    const modalElement = document.getElementById('contactModal');
    const modal = new bootstrap.Modal(modalElement, {
      backdrop: 'static',
      keyboard: false
    });
    
    modal.show();
    
    modalElement.addEventListener('hidden.bs.modal', () => {
      console.log('Modal has been fully hidden');
    });
    

    The backdrop: 'static' option prevents the modal from closing when the user clicks outside it — a necessary UX decision for critical confirmations or multi-step forms where accidental dismissal would cause data loss. The keyboard: false option disables the Escape key dismissal for the same reason.

    Bootstrap 5 also fires lifecycle events — show.bs.modal, shown.bs.modal, hide.bs.modal, and hidden.bs.modal — that let you hook into the open and close transitions to reset form state, load content dynamically, or trigger analytics events.

    Using Bootstrap Modals Inside the Canvas HTML Template

    Because the Canvas HTML Template is built on Bootstrap 5 with its own bundled JS files (js/plugins.min.js and js/functions.bundle.js), Bootstrap modal functionality is available on every Canvas page without any additional setup. You must not load the Bootstrap CDN separately — doing so will cause script conflicts and modal failures.

    To style a modal to match Canvas theme colours, target the .modal-content element using the Canvas CSS variables generator --cnvs-themecolor rather than Bootstrap’s utility colours:

    .modal-content {
      border-top: 3px solid var(--cnvs-themecolor);
    }
    
    .modal .btn-primary {
      background-color: var(--cnvs-themecolor);
      border-color: var(--cnvs-themecolor);
    }

    This approach keeps your modal styling consistent with the rest of the Canvas theme and ensures it updates automatically whenever you change --cnvs-themecolor globally. For a broader look at how Bootstrap components and Canvas work together in team environments, the post on Canvas HTML Template for Agencies: Workflows, Prompts, and Best Practices is worth reading alongside this one.

    If you want to compare how Bootstrap 5 components like modals fit into the wider landscape of CSS frameworks, the detailed breakdown in Bootstrap 5 vs Tailwind CSS: Which Should You Use for HTML Templates? covers the trade-offs well.

    Frequently Asked Questions

    Can I have multiple modals open at the same time in Bootstrap 5?

    Bootstrap 5 does not support multiple simultaneously open modals by default. You can open a second modal after closing the first, but stacking two modals on screen at the same time requires custom CSS and JavaScript to manage z-index and backdrop layering manually. For most projects, chaining modals sequentially is the cleaner approach.

    Why is my Bootstrap modal not working when I include it in a Canvas HTML Template page?

    The most common cause is loading Bootstrap JS from a CDN in addition to Canvas’s bundled scripts. Canvas includes Bootstrap 5 inside js/plugins.min.js — adding a second copy of Bootstrap creates conflicts that break modal initialisation. Remove any separate Bootstrap CDN script tags and rely solely on Canvas’s own JS files.

    How do I prevent a Bootstrap modal from closing when clicking the backdrop?

    Pass backdrop: 'static' as an option when initialising the modal via JavaScript: new bootstrap.Modal(el, { backdrop: 'static' }). You can also use the data attribute approach: add data-bs-backdrop="static" to the outer .modal element.

    Is the Bootstrap 5 modal component accessible?

    Yes, when implemented correctly. The component manages focus trapping automatically, moves focus into the modal on open, returns focus to the trigger element on close, and respects the aria-hidden attribute on the backdrop. You must include tabindex="-1" on the outer .modal div, aria-labelledby pointing to the modal title, and a proper close button with an aria-label to meet WCAG 2.1 AA requirements.

    Can I load content into a Bootstrap modal dynamically via AJAX?

    Yes. Listen for the show.bs.modal event, make your AJAX request inside the handler, and inject the response HTML into the .modal-body element before the modal finishes opening. Use the shown.bs.modal event if you need the modal fully visible before injecting content, such as when initialising a chart or map inside the dialogue.

    If you’re working with the Canvas HTML Template and want to generate production-ready layouts faster, try Canvas Builder free and see how much time you save on every project.

  • Bootstrap 5 Accordion & Tabs: Copy-Paste Examples (2026)

    Bootstrap 5 Accordion & Tabs: Copy-Paste Examples (2026)

    How the Bootstrap 5 Accordion Works

    The Bootstrap 5 Bootstrap accordion is built on the Collapse plugin. Each panel is controlled by a data-bs-toggle="collapse" attribute pointing to a target element. The accordion wrapper ensures only one panel is open at a time by default.

    Here’s a working three-panel accordion:

    <div class="accordion" id="faqAccordion">
    
      <div class="accordion-item">
        <h2 class="accordion-header" id="headingOne">
          <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
            What is included in the starter plan?
          </button>
        </h2>
        <div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#faqAccordion">
          <div class="accordion-body">
            The starter plan includes up to 5 projects, basic analytics, and email support.
          </div>
        </div>
      </div>
    
      <div class="accordion-item">
        <h2 class="accordion-header" id="headingTwo">
          <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
            Can I upgrade my plan later?
          </button>
        </h2>
        <div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#faqAccordion">
          <div class="accordion-body">
            Yes. You can upgrade or downgrade at any time from your account dashboard.
          </div>
        </div>
      </div>
    
      <div class="accordion-item">
        <h2 class="accordion-header" id="headingThree">
          <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
            Is there a free trial available?
          </button>
        </h2>
        <div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#faqAccordion">
          <div class="accordion-body">
            We offer a 14-day free trial with no credit card required.
          </div>
        </div>
      </div>
    
    </div>

    The key mechanics: data-bs-parent="#faqAccordion" links all panels to the wrapper so only one expands at a time. Remove that attribute if you want multiple panels open simultaneously. The collapse show class on the first item marks it as open on load.


    How Bootstrap 5 Tabs Work

    Tabs use the nav-tabs (or nav-pills) component paired with a tab-content container. The connection between tab triggers and panes is made through data-bs-toggle="tab" and matching id / aria-controls values.

    <ul class="nav nav-tabs" id="featureTabs" role="tablist">
      <li class="nav-item" role="presentation">
        <button class="nav-link active" id="design-tab"
          data-bs-toggle="tab"
          data-bs-target="#design"
          type="button" role="tab"
          aria-controls="design"
          aria-selected="true">Design</button>
      </li>
      <li class="nav-item" role="presentation">
        <button class="nav-link" id="development-tab"
          data-bs-toggle="tab"
          data-bs-target="#development"
          type="button" role="tab"
          aria-controls="development"
          aria-selected="false">Development</button>
      </li>
      <li class="nav-item" role="presentation">
        <button class="nav-link" id="deployment-tab"
          data-bs-toggle="tab"
          data-bs-target="#deployment"
          type="button" role="tab"
          aria-controls="deployment"
          aria-selected="false">Deployment</button>
      </li>
    </ul>
    
    
    <div class="tab-content" id="featureTabsContent">
      <div class="tab-pane fade show active" id="design"
        role="tabpanel" aria-labelledby="design-tab">
        <p class="mt-3">Pixel-perfect components built for flexibility across every viewport.</p>
      </div>
      <div class="tab-pane fade" id="development"
        role="tabpanel" aria-labelledby="development-tab">
        <p class="mt-3">Clean, semantic HTML with full Bootstrap 5 utility class support.</p>
      </div>
      <div class="tab-pane fade" id="deployment"
        role="tabpanel" aria-labelledby="deployment-tab">
        <p class="mt-3">One-click deploy to any static host — no build tools required.</p>
      </div>
    </div>

    Swap nav-tabs for nav-pills if you want a rounded button style instead of the underlined tab look. Both work identically under the hood.


    Accordion vs. Tabs: When to Use Each

    They both hide and reveal content, but they serve different UX purposes.

    Use accordions when:

    • Content items are independent of each other (FAQs, feature descriptions, terms)
    • Users may need to compare multiple open panels side by side (disable data-bs-parent)
    • You’re working in a narrow column or sidebar layout
    • Mobile is the primary context — vertical collapse works better on small screens

    Use tabs when:

    • Content represents distinct categories or steps (Pricing tiers, Before/After, Step 1/2/3)
    • Only one view makes sense at a time
    • You want a horizontal layout that mirrors familiar UI patterns (like browser tabs or dashboards)
    • Labeling is short and scannable (one to three words per tab works best)

    A pricing table comparing plans? Tabs. A help center FAQ section? Accordion. A product feature overview with long descriptions? Either works — but accordion handles unequal content lengths more gracefully.

    For a deeper look at how these components fit into full page layouts, the guide on Canvas Template Section Patterns: Building Pages Like a Pro covers practical structure decisions across common page types.


    Customizing Accordion and Tab Styles

    Bootstrap’s defaults are functional but generic. A few CSS overrides go a long way.

    Removing the accordion border and background:

    .accordion-item {
      border: none;
      border-bottom: 1px solid #e5e7eb;
      border-radius: 0 !important;
    }
    
    .accordion-button {
      background-color: transparent;
      font-weight: 600;
      color: #1a1a2e;
      box-shadow: none;
    }
    
    .accordion-button:not(.collapsed) {
      background-color: transparent;
      color: #5c6bc0;
      box-shadow: none;
    }

    Styled pill tabs with custom active state:

    .nav-pills .nav-link {
      border-radius: 50px;
      padding: 0.5rem 1.25rem;
      color: #555;
      font-weight: 500;
      transition: all 0.2s ease;
    }
    
    .nav-pills .nav-link.active {
      background-color: #5c6bc0;
      color: #fff;
    }

    Flush accordion variant (built into Bootstrap — no CSS needed):

    <div class="accordion accordion-flush" id="flushExample">
      
    </div>

    The accordion-flush class removes the outer border and rounded corners, giving you a clean list-style collapse that works well inside cards or sidebars.

    If you’re building out full typography and spacing for these components, Bootstrap 5 Typography: Font Sizes, Weights, and Display Classes is worth a read alongside this — heading weights inside accordion buttons matter more than most people think.


    Accessibility and ARIA Best Practices

    Bootstrap builds accessibility in, but you need to follow the markup conventions correctly for it to hold up.

    For accordions:

    • Always use <button> elements as the toggle — not <a> tags
    • Set aria-expanded="true" on the open panel’s button and "false" on closed ones
    • Link the button to its panel with aria-controls matching the panel’s id
    • Wrap each header in an <h2> (or appropriate heading level for your document outline)

    For tabs:

    • Use role="tablist" on the <ul>, role="tab" on each button, and role="tabpanel" on each pane
    • Set aria-selected="true" on the active tab
    • Link each tab button to its panel via aria-controls and the panel’s aria-labelledby

    Bootstrap’s JavaScript handles keyboard navigation automatically — arrow keys move between tabs, Enter/Space toggles accordions. As long as your markup matches the documented pattern, screen readers and keyboard users get a fully functional experience.

    This matters especially in contexts like healthcare or financial platforms where accessibility compliance isn’t optional. The principles covered in Mental Health Platform Website Design Best Practices go into further depth on building inclusive interactive interfaces.


    Real-World Use Cases and Patterns

    Here’s how these components map to common page sections:

    FAQ page → Accordion with accordion-flush, grouped by topic. Open the most common question by default using collapse show.

    Pricing page → Tabs for plan tiers (Starter / Pro / Enterprise), each pane containing a feature list and CTA button.

    Product features → Nav pills in a horizontal row above a tab content area. Each pane holds a screenshot or short description.

    Onboarding steps → Tabs labeled “Step 1”, “Step 2”, “Step 3” — use JavaScript to programmatically advance tabs as the user completes each step (one line of Bootstrap’s Tab API: bootstrap.Tab.getOrCreateInstance(el).show()).

    Settings panel → Vertical tabs (flex-column nav-pills with col-3 / col-9 grid layout) — Bootstrap supports this with minor layout adjustments.

    <div class="d-flex">
      <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-pills-account" type="button" role="tab">Account</button>
        <button class="nav-link" data-bs-toggle="pill"
          data-bs-target="#v-pills-billing" type="button" role="tab">Billing</button>
        <button class="nav-link" data-bs-toggle="pill"
          data-bs-target="#v-pills-notifications" type="button" role="tab">Notifications</button>
      </div>
      <div class="tab-content" id="v-pills-tabContent">
        <div class="tab-pane fade show active" id="v-pills-account" role="tabpanel">Account settings go here.</div>
        <div class="tab-pane fade" id="v-pills-billing" role="tabpanel">Billing details go here.</div>
        <div class="tab-pane fade" id="v-pills-notifications" role="tabpanel">Notification preferences go here.</div>
      </div>
    </div>

    For a broader look at how these components integrate into complete template systems, 8 Bootstrap 5 Card Components You Should Be Using Right Now covers complementary UI building blocks that pair well with tabs and accordions.


    ✅ Key Takeaways

    • Bootstrap 5 accordions use data-bs-toggle="collapse" and data-bs-parent to create mutually exclusive panels — no custom JavaScript needed
    • Bootstrap tabs use data-bs-toggle="tab" with matching id / aria-controls pairs to link triggers and content panes
    • Accordions suit FAQs and vertical layouts; tabs suit parallel categories and horizontal navigation
    • Accessibility is built in — but only if you follow the correct markup structure with proper role and aria-* attributes
    • accordion-flush and nav-pills give you quick style variations without extra CSS
    • Both components are fully customizable with CSS overrides targeting Bootstrap’s modifier classes

    ❓ FAQ

    Q: Do I need to write any JavaScript to use Bootstrap accordions or tabs?
    No. Both components are powered by Bootstrap’s bundled JavaScript plugin. Include bootstrap.bundle.min.js (which includes Popper) in your page and the data-bs-* attributes handle everything. No custom scripts required.

    Q: Can I have multiple accordion panels open at the same time?
    Yes. Remove the data-bs-parent attribute from each .accordion-collapse element. Without it, panels collapse and expand independently — clicking one won’t close the others.

    Q: How do I open a specific tab or accordion panel on page load?
    Add collapse show to the accordion panel’s classes (and set aria-expanded="true" on its button). For tabs, add active to the tab button and show active to the corresponding tab pane.

    Q: Can I link directly to a specific tab using a URL hash?
    Bootstrap doesn’t do this automatically, but it’s achievable with a small snippet that reads window.location.hash on load and triggers the matching tab using bootstrap.Tab.getOrCreateInstance(el).show().

    Q: What’s the difference between nav-tabs and nav-pills?
    Purely visual. nav-tabs gives you the classic underlined tab style. nav-pills gives you filled rounded buttons. Both use the same data-bs-toggle="tab" mechanism and work identically for content switching.


    🚀 Build Faster With Components That Already Work

    Bootstrap 5’s accordion and tab components are powerful — but building an entire project from scratch still takes time. Canvas is a premium HTML template that ships with pre-built accordion and tab sections, dozens of layout patterns, and clean component code ready to drop into any project.

    Explore Canvas and see what’s included →

    If you’re working with the Canvas HTML Template and want to generate production-ready layouts faster, try Canvas Builder free and see how much time you save on every project.

  • Bootstrap 5 Breakpoints: Responsive Layout Guide (2026)

    Bootstrap 5 Breakpoints: Responsive Layout Guide (2026)

    Responsive design isn’t optional anymore — it’s table stakes. But knowing how Bootstrap 5 handles responsiveness under the hood is what separates a layout that merely looks okay from one that feels intentional on every screen. This guide breaks down Bootstrap 5 breakpoints from first principles, shows you the utility classes that actually matter, and gives you copy-paste snippets you can drop into your next project right now.

    Key Takeaways

    • Bootstrap 5 ships with six named breakpoints: xs, sm, md, lg, xl, and xxl.
    • All breakpoints are mobile-first — styles apply from the given width upward.
    • Grid columns, display utilities, spacing, and typography all accept breakpoint infixes.
    • You can customise breakpoint values in Sass without touching Bootstrap’s source files.
    • Combining breakpoint-aware utilities eliminates the need for most custom media queries.

    What Are Bootstrap 5 Breakpoints?

    A breakpoint is a pixel threshold at which your layout is allowed to reflow. Bootstrap 5 defines six of them, each backed by a Sass variable and an auto-generated set of utility classes:

    Name Infix Min-width Typical target
    Extra small (none) 0px Portrait phones
    Small sm 576px Landscape phones
    Medium md 768px Tablets
    Large lg 992px Laptops
    Extra large xl 1200px Desktops
    Extra extra large xxl 1400px Wide monitors

    The xs tier has no infix — it is the default, unprefixed class. So col-12 means “full-width on all screens”, while col-md-6 means “half-width from 768 px upward, full-width below”.

    This mobile-first philosophy is the most important mental model to internalise. You write the small-screen rule first, then override it as the viewport grows.

    a black and white photo of a pair of shoes
    Photo by Emiliano Vittoriosi on Unsplash

    Grid Columns at Every Breakpoint

    The 12-column grid is Bootstrap’s backbone, and every column class accepts a breakpoint infix. Stack multiple infixes on one element to describe how a column behaves across the full range of devices:

    <div class="container">
      <div class="row g-4">
    
        <!-- Full-width on phones, half on tablets, one-third on desktops -->
        <div class="col-12 col-md-6 col-lg-4">
          <div class="card p-3">Feature A</div>
        </div>
    
        <div class="col-12 col-md-6 col-lg-4">
          <div class="card p-3">Feature B</div>
        </div>
    
        <!-- Sidebar: full-width on phones, full on tablet, one-third on desktop -->
        <div class="col-12 col-lg-4">
          <div class="card p-3">Sidebar</div>
        </div>
    
      </div>
    </div>

    Reading left to right: col-12 covers xs through sm. col-md-6 kicks in at 768 px and overrides the twelve-column rule. col-lg-4 takes over at 992 px. Bootstrap uses a cascade of min-width media queries, so each infix simply overrides the one before it at the appropriate threshold.

    For masonry-style cards and feature grids, 8 Bootstrap 5 Card Components You Should Be Using Right Now pairs well with this technique — it shows how card variants interact with responsive column stacking.

    Display and Visibility Utilities

    Sometimes you don’t want to reflow content — you want to hide it entirely on certain screens. Bootstrap’s responsive display utilities make this clean:

    <!-- Visible only on mobile (xs/sm) -->
    <div class="d-block d-md-none">
      <p>📱 Mobile nav placeholder</p>
    </div>
    
    <!-- Visible only on md and above -->
    <div class="d-none d-md-block">
      <nav class="navbar">Full desktop nav</nav>
    </div>
    
    <!-- Flex layout that becomes a column on small screens -->
    <div class="d-flex flex-column flex-md-row gap-3">
      <div class="p-3 bg-light">Column / Row item 1</div>
      <div class="p-3 bg-light">Column / Row item 2</div>
      <div class="p-3 bg-light">Column / Row item 3</div>
    </div>

    The pattern is always d-{breakpoint}-{value}. Values include none, block, inline, flex, grid, and more. Combining d-none with a breakpoint-specific d-{bp}-block lets you toggle entire sections without a single line of custom CSS.

    The same breakpoint logic governs text alignment, spacing, and type scale. If you’re fine-tuning font sizes across screen sizes, the companion guide Bootstrap 5 Typography: Font Sizes, Weights, and Display Classes covers every responsive typography utility in detail.

    graphical user interface, website
    Photo by PiggyBank on Unsplash

    Responsive Spacing and Sizing

    Padding and margin utilities also accept breakpoint infixes, which is enormously useful for hero sections and call-to-action banners that need generous breathing room on desktop but compact padding on mobile:

    <!-- Hero section: tight on mobile, spacious on desktop -->
    <section class="py-5 py-lg-7 px-3 px-md-5 text-center bg-primary text-white">
      <h1 class="display-4 display-md-2 fw-bold">Build Faster, Launch Smarter</h1>
      <p class="lead mt-3 mb-4">Everything you need, none of what you don't.</p>
      <a href="#" class="btn btn-light btn-lg">Get Started Free</a>
    </section>

    Note the py-5 py-lg-7 pattern: 3 rem of vertical padding on all screens, bumping to a larger custom value at the lg breakpoint. If you’re using the Canvas HTML template, utility spacing up to *-9 is available out of the box — pairing nicely with Bootstrap’s native scale.

    Width and height sizing utilities (w-25, w-50, w-100, etc.) can also be scoped to breakpoints using the same infix pattern, giving you precise control over image and container sizing at every tier.

    Customising Breakpoints with Sass

    The default thresholds won’t fit every project. Bootstrap 5 is built on Sass, so you can override any breakpoint before the framework compiles. The key is to update the $grid-breakpoints and (if you use containers) $container-max-widths maps in your own stylesheet — never in Bootstrap’s source files:

    <!-- In your custom _variables.scss (import BEFORE bootstrap) -->
    
    /*
      Override Bootstrap 5 breakpoints
      Always import this file before @use 'bootstrap'
    */
    
    $grid-breakpoints: (
      xs:   0,
      sm:   480px,   // was 576px — better for modern phones
      md:   768px,
      lg:   1024px,  // was 992px
      xl:   1280px,  // was 1200px
      xxl:  1536px   // was 1400px
    );
    
    $container-max-widths: (
      sm:   460px,
      md:   740px,
      lg:   980px,
      xl:   1240px,
      xxl:  1496px
    );

    After recompiling, every breakpoint-aware utility class in Bootstrap — grids, displays, spacing, flex, order — automatically reflects your new values. You get the full utility API without duplicating a single media query.

    If you’re shipping customised layouts to clients, documenting these overrides is essential. The 11 Things to Check Before Delivering an HTML Template to a Client checklist includes a prompt specifically for flagging Sass customisations so handoffs don’t turn into support tickets.

    Practical Responsive Layout Patterns

    Putting it all together, here are two production-ready patterns that combine breakpoints, grid, flex, and spacing utilities into real-world components:

    Pattern 1 — Responsive pricing row (stacked on mobile, inline on desktop):

    <div class="container py-5">
      <div class="row row-cols-1 row-cols-md-3 g-4 justify-content-center">
    
        <div class="col">
          <div class="card h-100 text-center p-4 border-0 shadow-sm">
            <h3 class="h5 fw-semibold">Starter</h3>
            <p class="display-5 fw-bold my-3">$9</p>
            <a href="#" class="btn btn-outline-primary">Choose Plan</a>
          </div>
        </div>
    
        <div class="col">
          <div class="card h-100 text-center p-4 border-primary shadow">
            <span class="badge bg-primary mb-2">Most Popular</span>
            <h3 class="h5 fw-semibold">Pro</h3>
            <p class="display-5 fw-bold my-3">$29</p>
            <a href="#" class="btn btn-primary">Choose Plan</a>
          </div>
        </div>
    
        <div class="col">
          <div class="card h-100 text-center p-4 border-0 shadow-sm">
            <h3 class="h5 fw-semibold">Enterprise</h3>
            <p class="display-5 fw-bold my-3">$79</p>
            <a href="#" class="btn btn-outline-primary">Choose Plan</a>
          </div>
        </div>
    
      </div>
    </div>

    row-cols-1 stacks all three cards on mobile. row-cols-md-3 switches to a three-column inline layout at the md breakpoint. Zero custom CSS required.

    Pattern 2 — Sidebar layout (content-first on mobile, side-by-side on desktop):

    <div class="container py-5">
      <div class="row g-5">
    
        <!-- Main content: 8/12 cols on lg, full-width below -->
        <main class="col-12 col-lg-8 order-2 order-lg-1">
          <h2>Article Title</h2>
          <p>Your main content goes here...</p>
        </main>
    
        <!-- Sidebar: 4/12 cols on lg, full-width + reordered below -->
        <aside class="col-12 col-lg-4 order-1 order-lg-2">
          <div class="bg-light p-4 rounded">
            <h5>Related Posts</h5>
            <ul class="list-unstyled">
              <li><a href="#">Link one</a></li>
              <li><a href="#">Link two</a></li>
            </ul>
          </div>
        </aside>
    
      </div>
    </div>

    The order-* utilities reorder elements visually without touching the DOM — meaning the main article appears first in source order (better for SEO and screen readers) while the sidebar renders below it on mobile and beside it on desktop.

    Frequently Asked Questions

    What is the default breakpoint in Bootstrap 5?

    The default (unprefixed) tier is xs, which starts at 0 px. Any class without a breakpoint infix — such as col-6 or d-flex — applies from the smallest possible screen size upward. This is the foundation of Bootstrap’s mobile-first approach.

    Can I add a custom breakpoint to Bootstrap 5?

    Yes. Add a new key-value pair to the $grid-breakpoints Sass map before importing Bootstrap, then recompile. Bootstrap will auto-generate all utility classes (grid columns, display, spacing, flex, etc.) for your new breakpoint. Just ensure the map stays in ascending order by pixel value.

    What is the difference between col-md-6 and col-lg-6?

    col-md-6 applies a 6-column (50%) width from 768 px and wider. col-lg-6 does the same but only from 992 px and wider. Below those thresholds, the element falls back to whichever smaller-breakpoint class is also applied — or to full-width (col-12) if none is specified.

    Does Bootstrap 5 still use jQuery for its responsive components?

    No. Bootstrap 5 dropped the jQuery dependency entirely. All interactive components — including the responsive Bootstrap navbar collapse — are powered by vanilla JavaScript bundled with Bootstrap. This reduces page weight and removes a legacy dependency.

    How do I debug which breakpoint is active on my page?

    A simple debugging trick is to add a fixed badge in the corner of your layout that shows the active tier. Add this snippet during development and remove it before going live:

    <div class="position-fixed bottom-0 end-0 p-2 bg-dark text-white small z-3">
      <span class="d-inline d-sm-none">XS</span>
      <span class="d-none d-sm-inline d-md-none">SM</span>
      <span class="d-none d-md-inline d-lg-none">MD</span>
      <span class="d-none d-lg-inline d-xl-none">LG</span>
      <span class="d-none d-xl-inline d-xxl-none">XL</span>
      <span class="d-none d-xxl-inline">XXL</span>
    </div>

    If you’re working with the Canvas HTML Template and want to generate production-ready layouts faster, try Canvas Builder free and see how much time you save on every project.

  • Bootstrap 5 Typography: Every Font Size & Weight Class (2026)

    Bootstrap 5 Typography: Every Font Size & Weight Class (2026)

    Typography is one of the fastest ways to make or break a web layout — and Bootstrap 5 gives you a surprisingly powerful set of tools to get it right without writing much custom CSS. Whether you are setting up a SaaS homepage, a property platform, or a portfolio, understanding how Bootstrap handles font sizes, weights, and display headings will save you hours of tweaking.

    Key Takeaways

    • Bootstrap 5 ships with a complete typographic scale — from utility classes for font size and weight through to oversized display headings — all usable without custom CSS.
    • Display classes (display-1 through display-6) are designed for hero sections and large headings where standard h1h6 tags are too restrained.
    • Font weight and line-height utilities let you fine-tune readability and hierarchy across any section of a page.
    • The Canvas Builder layout generator pairs directly with Bootstrap 5 typography, so you can prototype type-heavy layouts in minutes.

    Bootstrap 5 Typography Defaults: What You Start With

    Before touching a single class, Bootstrap 5 already sets sensible typographic defaults. The base font size is 16px (1rem), with a line height of 1.5 applied to the <body>. Headings h1 through h6 follow a consistent scale using rem units, which means they scale proportionally with the user’s browser font settings — an important accessibility detail that many developers overlook.

    The default heading scale in Bootstrap 5 is:

    Tag Default Size
    h1 2.5rem (40px)
    h2 2rem (32px)
    h3 1.75rem (28px)
    h4 1.5rem (24px)
    h5 1.25rem (20px)
    h6 1rem (16px)

    Bootstrap also ships with .h1 through .h6 classes, which apply identical styles to any element — useful when you need the visual weight of a heading on a <p> or <span> without breaking document semantics.

    <!-- Semantic heading -->
    <h2>This is a heading</h2>
    
    <!-- Same visual style on a paragraph -->
    <p class="h2">This looks like an h2 but stays a paragraph</p>
    a black and white photo of some type of letters
    Photo by Taso Katsionis on Unsplash

    Display Classes: When Standard Headings Are Not Enough

    For hero sections, landing pages, and any place where you need text to command attention, Bootstrap 5 display classes are the right tool. The six classes — display-1 through display-6 — render text at sizes ranging from roughly 5rem down to 2.5rem, with a lighter font weight (300) and tighter line height than standard headings.

    <h1 class="display-1">Massive Hero Title</h1>
    <h1 class="display-2">Slightly Smaller</h1>
    <h2 class="display-3">Section Hero Heading</h2>
    <h2 class="display-4">Feature Block Title</h2>
    <h3 class="display-5">Card Hero Text</h3>
    <h3 class="display-6">Subtle Large Heading</h3>

    A practical pattern for a hero section using the Canvas HTML Template would combine a display-2 or display-3 class with a lead paragraph and a call-to-action button — giving you a clear visual hierarchy without any custom CSS:

    <section class="py-5 text-center">
      <div class="container">
        <h1 class="display-2 fw-bold">Build Better Layouts</h1>
        <p class="lead text-muted mb-4">
          AI-powered HTML generation for the Canvas template.
        </p>
        <a href="#" class="btn btn-primary btn-lg">Get Started Free</a>
      </div>
    </section>

    This same structure works well for free trial landing pages, where clear typographic hierarchy reduces friction and moves users toward conversion.

    Bootstrap Font Size Utilities: The fs- Classes

    Bootstrap 5 introduced fs- utility classes (fs-1 through fs-6) that mirror the heading size scale but apply only the font size — not the heading weight or margin. This is particularly useful for inline elements, labels, badges, and any case where you want size without heading semantics.

    <p class="fs-1">Largest paragraph text (2.5rem)</p>
    <p class="fs-3">Medium text (1.75rem)</p>
    <span class="fs-5">Small label text (1.25rem)</span>
    <small class="fs-6">Fine print at base size (1rem)</small>

    Where display- classes are for impact, fs- classes are for precision. Use them when you need a specific size in a card subtitle, a stat callout, or a testimonials author line — anywhere the standard paragraph size is either too large or too small.

    white and black box on white table
    Photo by Brands&People on Unsplash

    Font Weight and Style: fw- and fst- Classes

    Typographic hierarchy is not just about size — weight and style do just as much work. Bootstrap 5 ships with a complete set of font weight utilities via the fw- prefix and font style utilities via fst-.

    Available fw- classes:

    • fw-bold — weight 700
    • fw-bolder — bolder than the parent element
    • fw-semibold — weight 600
    • fw-medium — weight 500
    • fw-normal — weight 400 (default body)
    • fw-light — weight 300
    • fw-lighter — lighter than the parent element
    <p class="fw-bold">Bold text — draws the eye immediately</p>
    <p class="fw-semibold">Semibold — softer emphasis</p>
    <p class="fw-light">Light weight — great for display captions</p>
    
    <!-- Combine with display classes for refined hero text -->
    <h1 class="display-3 fw-bold">Convert More Visitors</h1>
    <h2 class="display-5 fw-light text-muted">Simple. Fast. Effective.</h2>

    For font style, fst-italic applies font-style: italic and fst-normal resets it. These are particularly useful for quotes, captions, and testimonial blocks — the kind of components explored in detail in the post on Bootstrap 5 card components.

    Lead Paragraphs and Text Utility Classes

    The .lead class is one of Bootstrap’s most underused typographic tools. It increases paragraph font size to 1.25rem and reduces font weight slightly, making it ideal for introductory text, hero subtitles, and section openers that need to feel authoritative without competing with the heading above.

    <h2 class="display-5 fw-bold">Why Typography Matters</h2>
    <p class="lead">
      Good type choices communicate trust before a user reads a single word.
      Bootstrap 5 gives you the classes to get there without a design team.
    </p>

    Beyond .lead, Bootstrap’s text utilities cover a wide range of typographic adjustments:

    • Alignment: text-start, text-center, text-end (with responsive variants like text-md-start)
    • Transform: text-uppercase, text-lowercase, text-capitalize
    • Decoration: text-decoration-underline, text-decoration-none, text-decoration-line-through
    • Wrapping: text-wrap, text-nowrap, text-truncate
    • Colour: text-primary, text-muted, text-dark, text-white
    <!-- Uppercase label above a heading -->
    <span class="text-uppercase fw-semibold text-muted fs-6 d-block mb-2">
      Case Study
    </span>
    <h3 class="fw-bold">How Proptech Platforms Use Canvas</h3>
    <p class="lead">A real-world example of display hierarchy in practice.</p>

    This uppercase label pattern is used consistently in well-structured multi-section layouts — a technique covered thoroughly in Canvas Template section patterns.

    Combining Classes for Real Bootstrap Design Patterns

    Individual typography utilities become powerful when combined. A stat block, a pricing header, and a testimonial all call for different combinations of size, weight, and colour — but all built from the same Bootstrap classes.

    <!-- Stat block -->
    <div class="text-center py-4">
      <p class="display-4 fw-bold text-primary mb-0">98%</p>
      <p class="fs-5 fw-medium text-dark">Customer Satisfaction</p>
      <p class="fs-6 text-muted">Based on 2025 user survey</p>
    </div>
    
    <!-- Section intro -->
    <div class="mb-5">
      <span class="text-uppercase fw-semibold fs-6 text-muted d-block mb-1">Features</span>
      <h2 class="display-6 fw-bold">Everything you need to ship fast</h2>
      <p class="lead text-muted">Built on Bootstrap 5, designed for Canvas.</p>
    </div>
    
    <!-- Testimonial -->
    <blockquote class="border-start border-primary border-3 ps-4">
      <p class="fs-4 fw-light fst-italic">
        "Canvas Builder cut our build time by more than half."
      </p>
      <footer class="fs-6 fw-semibold text-muted">— Sarah T., Lead Developer</footer>
    </blockquote>

    These patterns require no custom stylesheet entries. Every size, weight, colour, and spacing value comes directly from Bootstrap 5’s utility layer — which is exactly what makes the framework so efficient for rapid prototyping and production builds alike. If you want to explore how these patterns translate into full page builds, the AI Prompt Helper can generate Canvas-compatible section prompts based on your layout goals.

    Frequently Asked Questions

    What is the difference between Bootstrap display classes and heading tags?

    Standard heading tags (h1h6) apply a size scale with bold weight and document semantics. Display classes (display-1display-6) apply much larger sizes with a lighter font weight (300), intended purely for visual impact in hero sections and banners — they carry no additional semantic meaning beyond the tag they are applied to.

    Can I use Bootstrap 5 font classes without the full Bootstrap framework?

    The utility classes like fw-bold, fs-3, and text-uppercase are part of Bootstrap’s compiled CSS. You can use Bootstrap’s CDN for just the CSS layer if you do not need the JavaScript components, giving you access to all typography utilities with a single stylesheet link and no build step.

    How do I change the default Bootstrap font to a custom Google Font?

    Bootstrap 5 uses a native font stack by default. To override it, import your chosen Google Font in your <head> and then set body { font-family: 'Your Font', sans-serif; } in your custom CSS file. If you are using Sass, override the $font-family-base variable before importing Bootstrap.

    Are Bootstrap 5 typography classes responsive?

    Font size utilities (fs-) and display classes are not responsive by default — they apply a fixed size at all Bootstrap breakpoint tester. However, you can combine them with Bootstrap’s responsive display utilities or write breakpoint-specific overrides in your custom CSS. Alignment utilities like text-md-center are responsive out of the box.

    What is the .lead class in Bootstrap 5 and when should I use it?

    The .lead class increases paragraph text to 1.25rem with a slightly lighter weight, making it ideal for introductory text directly beneath a heading — in hero sections, feature intros, or the opening paragraph of a content block. It creates visual separation between the heading and the body copy without the full impact of a display class.

    Getting typography right is one of the highest-leverage improvements you can make to any web layout. Bootstrap 5 gives you the full toolkit — from display headings to fine-grained weight and size utilities — and the try Canvas Builder free to see how these classes come together in production-ready Canvas sections without writing a single line of custom CSS.