The Wayback Machine - https://web.archive.org/web/20240930191344/https://www.geeksforgeeks.org/bootstrap-4-pagination/
Open In App

Bootstrap 4 | Pagination

Last Updated : 23 Jan, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Pagination is used to enable navigation between pages in a website. The pagination used in Bootstrap has a large block of connected links that are hard to miss and are easily scalable. 

Basic Pagination: The basic pagination can be specified using the following classes.

  • The .pagination class is used to specify pagination on a list group.
  • The .page-item class is used to specify each pagination item in the group.
  • The .page-link class is used to specify the link in the pagination item.

Example: 

HTML




<!DOCTYPE html>
<html>
<head>
    <title>Bootstrap 4 | Pagination</title>
    <meta charset="utf-8">
    <meta name="viewport"
        content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href=
    <script src=
    </script>
    <script src=
    </script>
    <script src=
    </script>
</head>
<body>
    <div class="container">
        <h1>Bootstrap 4 | Basic Pagination</h1>
        <!-- Declare the pagination class -->
        <ul class="pagination">
            <!-- Declare the item in the group -->
            <li class="page-item">
                <!-- Declare the link of the item -->
                <a class="page-link" href="#">Previous</a>
            </li>
            <!-- Rest of the pagination items -->
            <li class="page-item">
                <a class="page-link" href="#">1</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">2</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">3</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">Next</a>
            </li>
        </ul>
    </div>
</body>
</html>


Output:

 basic-pagination 

Disabled State: The pagination links could be styled to make them appear unclickable by using the .disabled class. This may be used for disabling the ‘Previous’ or ‘Next’ button. The .disabled class internally makes use of ‘pointer-events: none’ to make the link unclickable, however, as this specification is not always implemented, it is preferred to make it not possible to be navigated to by setting the ‘tabindex’ property to -1. This property controls whether an element can be navigated using the tab key. 

Example: 

HTML




<!DOCTYPE html>
<html>
<head>
    <title>Bootstrap 4 | Pagination</title>
    <meta charset="utf-8">
    <meta name="viewport"
        content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href=
    <script src=
    </script>
    <script src=
    </script>
    <script src=
    </script>
</head>
<body>
    <div class="container">
        <h1>Bootstrap 4 | Pagination Disabled State</h1>
        <!-- Declare the pagination class -->
        <ul class="pagination">
            <!-- Specify the disabled class to style this item disabled -->
            <li class="page-item disabled">
                <!-- Specify tabindex to make the link non navigable -->
                <a class="page-link" href="#" tabindex="-1">
                    Previous
                </a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">
                    1
                </a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">2</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">
                    3
                </a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">Next</a>
            </li>
        </ul>
    </div>
</body>
</html>


Output:

 disabled-pagination 

Active State: The pagination links could be styled to highlight them as the current active page by using the .active class on the pagination item. 

Example: 

HTML




<!DOCTYPE html>
<html>
<head>
    <title>Bootstrap 4 | Pagination</title>
    <meta charset="utf-8">
    <meta name="viewport"
        content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href=
    <script src=
    </script>
    <script src=
    </script>
    <script src=
    </script>
</head>
<body>
    <div class="container">
        <h1>Bootstrap 4 | Pagination Active State</h1>
        <!-- Declare the pagination class -->
        <ul class="pagination">
            <li class="page-item">
                <a class="page-link" href="#">
                    Previous
                </a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">
                    1
                </a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">
                    2
                </a>
            </li>
            <!-- Specify the active class to style this item active -->
            <li class="page-item active">
                <a class="page-link" href="#">3</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">Next</a>
            </li>
        </ul>
    </div>
</body>
</html>


Output:

 active-pagination 

Sizing the pagination group: The pagination group could be made larger or smaller by using additional classes. There are 3 possible sizes of input groups.

  • The .pagination-sm class is used for a smaller size.
  • The .pagination-lg class is used for a larger size.
  • The .pagination class is the default size.

Example: 

HTML




<!DOCTYPE html>
<html>
<head>
    <title>Bootstrap 4 | Pagination</title>
    <meta charset="utf-8">
    <meta name="viewport"
        content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href=
    <script src=
    </script>
    <script src=
    </script>
    <script src=
    </script>
</head>
<body>
    <div class="container">
        <h1>Bootstrap 4 | Pagination Sizing</h1>
        <b>Large Pagination</b>
        <!-- Specify pagination-lg for large pagination group -->
        <ul class="pagination pagination-lg">
            <li class="page-item">
                <a class="page-link" href="#">Previous</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">1</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">2</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">3</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">Next</a>
            </li>
        </ul>
        <b>Small Pagination</b>
        <!-- Specify pagination-sm for small pagination group -->
        <ul class="pagination pagination-sm">
            <li class="page-item">
                <a class="page-link" href="#">Previous</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">1</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">2</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">3</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">Next</a>
            </li>
        </ul>
        <b>Normal Pagination</b>
        <!-- Normal size pagination -->
        <ul class="pagination">
            <li class="page-item">
                <a class="page-link" href="#">Previous</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">1</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">2</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">3</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">Next</a>
            </li>
        </ul>
    </div>
</body>
</html>


Output:

 size-pagination 

Alignment of the pagination group: The pagination group could be aligned to the right or center by using the flexbox utility classes.

  • The .justify-content-center class is used to align the group to the center.
  • The .justify-content-end class is used to align the group to the right.

Example: 

HTML




<!DOCTYPE html>
<html>
<head>
    <title>Bootstrap 4 | Pagination</title>
    <meta charset="utf-8">
    <meta name="viewport"
        content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href=
    <script src=
    </script>
    <script src=
    </script>
    <script src=
    </script>
</head>
<body>
    <div class="container">
        <h1>Bootstrap 4 | Pagination Alignment</h1>
        <b>Align to the center</b>
        <!-- Specify justify-content-center to align to the center -->
        <ul class="pagination justify-content-center">
            <li class="page-item">
                <a class="page-link" href="#">Previous</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">1</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">2</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">3</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">Next</a>
            </li>
        </ul>
        <b>Align to the right</b>
        <!-- Specify justify-content-end to align to the right -->
        <ul class="pagination justify-content-end">
            <li class="page-item">
                <a class="page-link" href="#">Previous</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">1</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">2</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">3</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#">Next</a>
            </li>
        </ul>
    </div>
</body>
</html>


Output:

 alignment-pagination



Previous Article
Next Article

Similar Reads

Bootstrap Alerts , Wells, Pagination and Pager
Introduction and InstallationGrid SystemButtons, Glyphicons, TablesVertical Forms, Horizontal Forms, Inline FormsDropDowns and Responsive TabsProgress Bar and Jumbotron Alerts: We often see certain alerts on some websites before or after completing an action. These alert messages are highlighted texts that are important to take into consideration w
4 min read
How to make Pagination using Angular UI Bootstrap ?
In this article, we will see how to make Dropdown using Angular UI bootstrap Angular UI Bootstrap is an Angular JS framework created by Angular UI developers for providing better UI which can be used easily. Syntax: <div uib-pagination></div> Download AngularUI from the link: https://angular-ui.github.io/bootstrap Approach: First, add A
1 min read
How to customize links for pagination in Bootstrap ?
In many websites, we notice that when we search for something then all the related content is shown but if the number of content is large then it will make the website longer. To solve this, there is pagination in the webpage i.e, the contents are divided into many pages and on clicking the user can navigate through the related contents. Note: Pagi
4 min read
How to align pagination in Bootstrap 4 ?
In this article, we will learn how to align pagination on the website using the Bootstrap classes. The Pagination is a very useful component present in the Bootstrap. Pagination is used to enable navigation between pages in a website as it divides the document into different pages and provides them with numbers. This will create a large block of co
8 min read
How to create pagination in Bootstrap 4 ?
Bootstrap is a free and open-source tool collection for creating responsive websites and web applications. It is the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites. It solves many problems which we had once, one of which is the cross-browser compatibility issue. Pagination is an element used to ind
5 min read
How to customize the labels for previous and next buttons in React Bootstrap pagination?
In this article, we will learn how to customize the labels for previous and next buttons in React Bootstrap pagination. The Pagination component in React-Bootstrap provides a convenient way to create pagination controls for a list of items, such as a list of pages or data entries. By default, it shows "Previous" and "Next" labels on the respective
3 min read
Angular ngx bootstrap Pagination Component
Angular ngx bootstrap is a bootstrap framework used with angular to create components with great styling and this framework is very easy to use and is used to make responsive websites. In this article, we will know how to use Pagination in angular ngx bootstrap. Installation syntax: npm install ngx-bootstrap --save Approach: First, install the angu
2 min read
React-Bootstrap Pagination Component
React-Bootstrap is a front-end framework that was designed keeping react in mind. Pagination Component provides a way for users to switch between pages easily. It is basically a set of presentational components for providing a better UI experience to the user. We can use the following approach in ReactJS to use the react-bootstrap Pagination Compon
2 min read
How to use Ellipsis in react-bootstrap pagination
While developing the React JS application, we came up with the requirement of making the Pagination for accessing more content without going to other tabs or pages. In react-bootstrap, we have the component of Pagination that allows us to go through any page using the sequence of numbers. Along with the Pagination in react-bootstrap, we can use the
5 min read
Angular ng Bootstrap Pagination Component
Angular ng bootstrap is a bootstrap framework used with angular to create components with great styling and this framework is very easy to use and is used to make responsive websites. In this article, we will see how to use Pagination in angular ng bootstrap. Pagination is used to make a group of pages. Installation syntax: ng add @ng-bootstrap/ng-
2 min read
CSS Pagination
Pagination is the process of dividing the document into pages and providing them with numbers. Types of Pagination: There are many types of pagination in CSS. Some of them are given below: Simple PaginationActive and Hoverable PaginationRounded Active and Hoverable ButtonsHoverable Transition EffectBordered PaginationRounded Border PaginationCenter
7 min read
React Suite <Pagination> Props
A React suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we'll learn about React suite Prop <Pagination>. <Pagination> component is used to a
3 min read
PHP Pagination | Set 1
PHP is mostly used to store and show data from a database according to the user's requirements. For example, let us think that we have organized a competition and now have the challenge to show the leaderboard. Our event was very successful and had a participation of over Ten Thousand. Now if we have to show the whole list on one page, the page wil
5 min read
PHP Pagination | Set 2
In the previous article on PHP Pagination, we had seen why pagination is needed and also developed a basic structure for implementing a pagination system using PHP. In continuation, let us start with our development process and first create a script to connect to our Database. Connecting to Database Connecting to Database is often a required task f
7 min read
PHP Pagination | Set 3
In the previous article PHP Pagination | Set 2, we developed a simple pagination system that was logically correct but it was not visually appealing because of all the page numbers stacked and occupied a lot of screen space. Then what is the remedy? It is simple when a user is looking up a particular page number it can be assumed that he will be mo
6 min read
Primer CSS Previous/Next Pagination
Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by Object-Oriented CSS principles, functional CSS, an
2 min read
React Suite Pagination Advanced
React Suite is a front-end library designed for the middle platform and back-end products. React Suite Pagination component allows the user to select a specific page from various pages. The component also allows us to customize the component, for doing it we use the layout prop. The layout prop accepts an array. The values in the array can be 'tota
3 min read
Materialize CSS Pagination
Pagination is used to separate the content into discrete pages that is short and easy to understand. Materialize CSS provide classes to create a pagination bar that holds the links to the other pages. The pagination class is used to set the <ul> list element as a pagination component. The pages that have to be shown are defined inside this co
2 min read
Bulma | Pagination
Bulma is a FLexbox based open-source CSS framework and its completely free. It is component rich, compatible, and well documented. It is highly responsive in nature. It uses classes to implement its design. The 'pagination' is a component used to indicate the existence of a series of related content across multiple pages. Pagination is used to enab
6 min read
React Suite Pagination Component
React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. Pagination component allows the user to select a specific page from a range of pages. We can use the following approach in ReactJS to use the React Suite Pagination Component. Pagination Props: activePage: It is
3 min read
How to make table searchable and sortable with pagination using jQuery?
The jQuery fancyTable plugin helps the developers to design HTML tables that are searchable and sortable with pagination feature. This plugin is totally based on JavaScript and HTML. Official website for plugin: Please take care of file paths while implementing the codes. https://github.com/myspace-nu/jquery.fancyTable Example 1: The following code
3 min read
EasyUI jQuery pagination widget
In this article, we will learn how to design a pagination widget using jQuery EasyUI. The pagination widget allows the user to navigate data by pages. It helps in building features for interactive web and mobile applications saving a lot of time for developers. Downloads for EasyUI for jQuery: https://www.jeasyui.com/download/index.phpSyntax: var a
2 min read
How to integrate jQuery Pagination Plugin ?
simplePagination.js is a jQuery plugin that provides simple yet fully customizable pagination in our websites. It is a robust and highly customizable jQuery-based pagination system for your long content to improve webpage readability. Its major features are listed below. You can paginate any group of HTML elements on the webpage.It is easy to use a
5 min read
ReactJS UI Ant Design Pagination Component
Ant Design Library has this component pre-built, and it is very easy to integrate as well. Pagination Component allows the user to show the page number and switch between pages easily with the next and previous button. We can use the following approach in ReactJS to use the Ant Design Pagination Component. Syntax: <Pagination defaultCurrent={ }
3 min read
ReactJS Evergreen Pagination Component
React Evergreen is a popular front-end library with a set of React components for building beautiful products as this library is flexible, sensible defaults, and User friendly. Pagination Component allows the user to navigate between pages. A user can select a specific page from a range of pages. We can use the following approach in ReactJS to use
2 min read
ReactJS Semantic UI Pagination Addons
Semantic UI is a modern framework used in developing seamless designs for the website, It gives the user a lightweight experience with its components. It uses the predefined CSS, JQuery language to incorporate in different frameworks. In this article we will know how to use Pagination Addons in ReactJS Semantic UI. Pagination Addons is used to make
2 min read
How to we create Pagination in Materialize CSS ?
Materialize CSS is a front-end UI library that is created by Google using the combination of HTML, CSS, and JavaScript. It is basically a design language that combines classic design along with modern innovations and technology. The purpose of Google behind developing Materialize CSS is to provide a unified system design for all their products acro
3 min read
Bulma Pagination Styles
Bulma is a free and open-source CSS framework based on flexbox which enables web developers to make beautiful and responsive websites for all screen sizes. In this article, we will be seeing the styles of the pagination component in Bulma. Bulma pagination component has only one style variation which can be applied by appending an is-rounded modifi
2 min read
Spectre Pagination
Spectre Pagination is used to create a pagination, it's basically is used to enable navigation between pages in a website. The pagination used in spectre has a large block of connected links that are hard to miss and are easily scalable. To create a pagination you need to add a container element with the pagination class. And add child elements wit
2 min read
React Suite Pagination Size
React Suite is a front-end library designed for the middle platform and back-end products. React Suite Pagination component allows the user to select a specific page from a range of pages. Size Prop is used to set the size of the Pagination component. There are four alternatives that are available. xs: the smallest size that is availablesm: it is t
2 min read