DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk3 min

How to Build Bootstrap Pagination with Clear Page States

Build Bootstrap pagination with a labeled navigation landmark, accurate current-page state, and keyboard-safe handling for unavailable controls.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Bootstrap pagination uses a labeled navigation landmark containing a list: apply .pagination to the <ul>, .page-item to each list item, and .page-link to each link. Before copying markup, check which Bootstrap version your project uses and consult its matching component documentation.

Check your Bootstrap version first

The examples below follow the Bootstrap 5.3 pagination component. If your project uses Bootstrap 4 or another Bootstrap 5 release, check that version’s documentation before using the markup or classes. Bootstrap 5.0 migration notes, for example, document pagination changes including customizable left margin and transitions; do not assume component behavior is identical across versions. See the Bootstrap 5.3 pagination documentation, the Bootstrap 5.0 pagination documentation, and the Bootstrap 5.0 migration notes.

As an Amazon Associate I earn from qualifying purchases.

Build the pagination navigation

Wrap the list in a <nav> landmark and give it a descriptive accessible name. The name should explain what the controls navigate; for example, Bootstrap uses “Search results pages” for search pagination. Use links that point to actual pages, and make previous and next controls understandable without relying on an icon alone.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<nav aria-label="Search results pages">
  <ul class="pagination">
    <li class="page-item">
      <a class="page-link" href="/search?page=1">Previous</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="/search?page=1">1</a>
    </li>
    <li class="page-item active">
      <a class="page-link" href="/search?page=2" aria-current="page">2</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="/search?page=3">3</a>
    </li>
    <li class="page-item">
      <a class="page-link" href="/search?page=3">Next</a>
    </li>
  </ul>
</nav>

Replace the example destinations with the routes and page numbers used by your application. When the list is generated dynamically, ensure it reflects the actual result set: links should not lead to nonexistent pages, and the current-page state should match the page being shown.

Mark the current page accurately

Apply .active to the current page’s .page-item. If the current page is an anchor, add aria-current="page" to that anchor so its status is available to assistive technology. Only one page in a given pagination control should be marked current.

If the current page should not be clickable, use a <span class="page-link" aria-current="page"> within the active list item instead of an anchor. A non-interactive span does not need aria-current according to Bootstrap’s component guidance, though including it can explicitly communicate the current-page state. Choose one approach consistently with the interaction your interface intends.

Handle unavailable previous and next controls

When there is no previous or next page, Bootstrap’s .disabled class changes the item’s appearance, but it does not by itself make an anchor fully unavailable to keyboard users. Bootstrap warns that pointer-event suppression alone does not handle keyboard navigation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Prefer a span when the control is unavailable: replacing the anchor with a non-interactive <span class="page-link"> removes the link from keyboard focus and prevents activation.
  • If you retain an anchor: add tabindex="-1" and implement custom JavaScript to prevent activation as well as keyboard access. Merely applying .disabled is not sufficient.

Do not leave a disabled-looking link pointing to a valid or misleading destination. The visual state, keyboard behavior, and actual destination should agree.

Choose size and alignment

After the navigation works correctly, use Bootstrap’s documented pagination size classes and flexbox utilities to fit the layout.

Need Bootstrap option
Default size .pagination
Smaller controls .pagination.pagination-sm
Larger controls .pagination.pagination-lg
Center the list .pagination.justify-content-center
Align the list to the end .pagination.justify-content-end

For example, to center a small pagination list, put both classes on the list: <ul class="pagination pagination-sm justify-content-center">. See the Bootstrap 5.3 component examples for the documented variants.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check accessibility and behavior in the finished page

Bootstrap provides component styles, not an automatic accessibility guarantee. Its accessibility guidance says a project’s overall accessibility depends substantially on the author’s markup, additional styling, and scripting. It also cautions that some default foreground and background color combinations may fall below WCAG 2.1 contrast recommendations. Review the actual combinations in your interface rather than assuming the defaults meet your needs. Read Bootstrap’s accessibility guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Use the keyboard to move through the controls; confirm disabled items cannot receive focus or activate.
  • Confirm the navigation landmark has a purpose-specific accessible name, especially when the page contains more than one pagination region.
  • Check that exactly the displayed page is identified as current.
  • Verify visible focus, text/background contrast, and that every active link reaches the intended page.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.