Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Bootstrap Pagination

Bootstrap Pagination

Introduction

In this tutorial, we will see how to create pagination with Bootstrap.

Multi-page Pagination

If you want to create pagination for the search results of your online application, website, or app, you can use this type of pagination.

The CSS class "pagination" in bootstrap.css, located at lines 2756 to 1814, holds the styles for creating this type of pagination.

Two other CSS classes, "disabled" and "active", can be used to customize whether the links in the pagination are clickable. Lines 2793 to 2797 hold the styles for the "disabled" class and some other classes used in pagination. Lines 2786 to 2792 hold the styles for the "active" class used in pagination.

To set the alignment of pagination links, use the "pagination-centered" and "pagination-right" CSS classes. These two classes are located at lines 2809 to 2814 in bootstrap.css (version 2.0.1).

Multi-page pagination example

Example

    

     Bootstrap multi-page pagination example

    

    

    

View the example online

Note that the extra style adding margins to the body element is just for the example demonstration.

Pager

Sometimes you may need the first type of pagination mentioned in the first part of this tutorial. But at other times, you may only need simple links like next/previous or old/new to provide navigation for users. This can be achieved with the pager.

The "pager" CSS class is located at lines 2815 to 2850 in bootstrap.css (version 2.0.1). Here you can apply the "disabled" CSS class to make a link non-clickable.

Pager example with next and previous

Example

    

     Bootstrap paging example with next and previous

    

    

    

View the example online

Paging example with old and new

Example

    

     Bootstrap pager example with old and new

    

    

    

View the example online

Click here to download all the HTML, CSS, JS, and image files used in this tutorial.