Bootstrap Pagination
This chapter will explain the pagination features supported by Bootstrap. Pagination is an unordered list, and Bootstrap handles pagination just like other interface elements.
Pagination (Pagination)
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. |
- «
- 1(current) .......
- ...
- ...
- ...
Default Pagination
The following example demonstrates the classes discussed in the table above .pagination :
Example
<ul class="pagination">
<li>
<a href="" «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 li ul>Try it »
The result is as follows:
Pagination States
The following example demonstrates the classes discussed in the table above .disabled、.active :
Example
<ul class="pagination">
<li>
<a href="" «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 li ul>Try it »
The result is as follows:
Pagination Sizes
The following example demonstrates the classes discussed in the table above .pagination-* Usage:
Example
<ul class=">pagination pagination-lg
"
<li>
<a href="" «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 li ul>
<br>
<ul class="pagination">
<li>
<a href="" «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 li ul>
<br>
<ul class=">pagination pagination-sm
"
<li>
<a href="" «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 li ul>Try it »
The result is as follows:
Pager (Pager)
If you want to create simple pagination links to provide navigation for users, you can use the pager. Like pagination links, the pager is also an unordered list. By default, links are centered. The following table lists the classes Bootstrap uses to handle pagers.
| Class | Description | Example Code |
|---|---|---|
| .pager | Add this class to get pager links. |
Default Pager
The following example demonstrates the classes discussed in the table above .pager :
Example
<ul class="pager">
<li>
<a href="" Previous a li>
<li>
<a href="" Next a li ul>Try it »
The result is as follows:
Aligned Links
The following example demonstrates the classes discussed in the table above .previous、.next :
Example
<ul class="pager">
<li class="previous">
<a href="" ←Older a li>
<li class="next">
<a href="" Newer→a li ul>Try it »
The result is as follows:
Pager States
The following example demonstrates the classes discussed in the table above .disabled :
Example
<ul class="pager">
<li class=">previous disabled
"
<a href="" ←Older a li>
<li class="next">
<a href="" Newer→a li ul>Try it »
The result is as follows:
More Pagination Examples
| class | Description | Example |
|---|---|---|
| .pager | A simple pagination link, with links centered. | Try it |
| .previous | Previous page button style in .pager, left-aligned | Try it |
| .next | Next page button style in .pager, right-aligned | Try it |
| .disabled | Disabled link | Try it |
| .pagination | Pagination Links | Try it |
| .pagination-lg | Larger Pagination Links | Try it |
| .pagination-sm | Smaller Pagination Links | Try it |
| .disabled | Disabled link | Try it |
| .active | Current Page Link Style | Try it |