English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
This chapter will explain the pagination features supported by Bootstrap. Pagination is an unordered list, Bootstrap handles pagination in the same way as other interface elements.
The following table lists the classes provided by Bootstrap for handling pagination.
Class | Description | Example code |
---|---|---|
.pagination | Add this class to display pagination on the page. | <ul> <li><a href="#">«</a>/a></li> <li><a href="#">1</a></li> ...... </ul> |
.disabled, .active | You can customize the links by using .disabled to define non-clickable links by using .active to indicate the current page. | <ul> <li><a href="#">«</a>/a></li> <li><a href="#">1<span>(current)</<span></a></li> ...... </ul> |
.pagination-lg, .pagination-sm | Use these classes to get items of different sizes. | <ul>.../ul> <ul>.../ul> <ul>.../ul> |
The following examples demonstrate the class discussed in the table above .pagination Usage:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Bootstrap Example - Default pagination</title> <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js>/script> <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js>/script> </head> <body> <ul class="pagination"> <li><a href="#">«</a>/a></li> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li><a href="#">»</a>/a></li> </ul> </body> </html>Test to see ‹/›
The results are as follows:
The following examples demonstrate the class discussed in the table above .disabled, .active Usage:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Bootstrap Example - Page status</title> <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js>/script> <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js>/script> </head> <body> <ul class="pagination"> <li><a href="#">«</a>/a></li> <li class="active"><a href="#">1</a></li> <li class="disabled"><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li><a href="#">»</a>/a></li> </ul> </body> </html>Test to see ‹/›
The results are as follows:
The following examples demonstrate the class discussed in the table above .pagination-* Usage:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Bootstrap Example - Page size</title> <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js>/script> <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js>/script> </head> <body> <ul class="pagination pagination-lg"> <li><a href="#">«</a>/a></li> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li><a href="#">»</a>/a></li> </ul><br> <ul class="pagination"> <li><a href="#">«</a>/a></li> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li><a href="#">»</a>/a></li> </ul><br> <ul class="pagination pagination-sm"> <li><a href="#">«</a>/a></li> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li><a href="#">»</a>/a></li> </ul> </body> </html>Test to see ‹/›
The results are as follows:
If you want to create a simple pagination link to provide navigation for users, you can do so through pagination. Like pagination links, pagination is also an unordered list. By default, the links are centered. The table below lists the classes that Bootstrap handles for pagination.
Class | Description | Example code |
---|---|---|
.pager | Add this class to get pagination links. | <ul> <li><a href="#">Previous/a></li> <li><a href="#">Next/a></li> </ul> |
.previous, .next | Use class .previous Align the links to the left, using .next Align the links to the right. | <ul> <li><a href="#">← Older</a>/a></li> <li><a href="#">Newer →</a>/a></li> </ul> |
.disabled | Add this class to disable the corresponding button. | <ul> <li><a href="#">← Older</a>/a></li> <li><a href="#">Newer →</a>/a></li> </ul> |
The following examples demonstrate the class discussed in the table above .pager Usage:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Bootstrap Example - Default pagination/title> <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js>/script> <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js>/script> </head> <body> <ul class="pager"> <li><a href="#">Previous/a></li> <li><a href="#">Next/a></li> </ul> </body> </html>Test to see ‹/›
The results are as follows:
The following examples demonstrate the class discussed in the table above .previous, .next Usage:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Bootstrap Example - Aligned links in pagination/title> <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js>/script> <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js>/script> </head> <body> <ul class="pager"> <li class="previous"><a href="#">← Older</a>/a></li> <li class="next"><a href="#">Newer →</a>/a></li> </ul> </body> </html>Test to see ‹/›
The results are as follows:
The following examples demonstrate the class discussed in the table above .disabled Usage:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Bootstrap Example - Status of pagination</title> <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js>/script> <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js>/script> </head> <body> <ul class="pager"> <li class="previous disabled"><a href="#">← Older</a>/a></li> <li class="next"><a href="#">Newer →</a>/a></li> </ul> </body> </html>Test to see ‹/›
The results are as follows:
Class | Description | Example |
---|---|---|
.pager | A simple pagination link, aligned to the center. | Try It |
.previous | Button style for the previous page button in .pager, aligned to the left | Try It |
.next | Button style for the next page button in .pager, aligned to the right | Try It |
.disabled | Disabled Links | Try It |
.pagination | Pagination Links | Try It |
.pagination-lg | Larger Pagination Links | Try It |
.pagination-sm | Smaller Pagination Links | Try It |
.disabled | Disabled Links | Try It |
.active | Current Page Link Style | Try It |