Bootstrap Pagination

Pagination is used to sort the web pages of your website in an organized manner. It becomes very necessary if your website has a lot of web pages.

Following is a list of classes that Bootstrap provides to handle pagination.Table:

ClassDescription
.paginationAdd this class to get the pagination on your page.
.disabled,.activeyou can customize links by using .disabled for unclickable links and .active to indicate the current page.
.pagination-lg,.pagination-smuse these classes to get different size items.

Bootstrap Pagination Example

Add the .pagination class to an <ul> element to create a basic pagination.

See this example:

 <!DOCTYPE html>  

<html lang="en">  

<head>  

  <title>Bootstrap Example</title>  

  <meta charset="utf-8">  

  <meta name="viewport" content="width=device-width, initial-scale=1">  

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">  

    

</head>  

<body>  

  

<div class="container">  

  <h2>A basic pagination example:</h2>  

  <p>The .pagination class provides pagination links:</p>                    

  <ul class="pagination">  

    <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>  

  </ul>  

</div>  

  

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>  

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>  

  

</body>  

</html>

Bootstrap Active State

The active state specifies the current page on which user is active.

The class .active is used to specify active state.

See this example:

<!DOCTYPE html>  

<html lang="en">  

<head>  

  <title>Bootstrap Example</title>  

  <meta charset="utf-8">  

  <meta name="viewport" content="width=device-width, initial-scale=1">  

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">  

   

</head>  

<body>  

  

<div class="container">  

  <h2>Active State Pagination: Example</h2>  

<p>Specify the current active state of the user.</p>  

  <ul class="pagination">  

    <li><a href="#">1</a></li>  

    <li class="active"><a href="#">2</a></li>  

    <li><a href="#">3</a></li>  

    <li><a href="#">4</a></li>  

    <li><a href="#">5</a></li>  

  </ul>  

</div>  

  

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>  

 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>  

  

</body>  

</html> 

Bootstrap Disabled State

The disabled state specifies that you cannot click on the link.

Add class .disabled to disable the links you don’t need more.

See this example:

<!DOCTYPE html>  

<html lang="en">  

<head>  

  <title>Bootstrap Example</title>  

  <meta charset="utf-8">  

  <meta name="viewport" content="width=device-width, initial-scale=1">  

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">  

   

</head>  

<body>  

  

<div class="container">  

  <h2>Disabled State Pagination Example:</h2>  

  <p>Here, 4 and 5 links are disabled.</p>  

  <ul class="pagination">  

    <li><a href="#">1</a></li>  

    <li><a href="#">2</a></li>  

    <li><a href="#">3</a></li>  

    <li class="disabled"><a href="#">4</a></li>  

    <li><a href="#">5</a></li>  

  </ul>  

</div>  

  

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>  

 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>  

  

</body>  

</html>  

Bootstrap Pagination Sizing

You can also size pagination blocks larger or smaller accordingly.

Add class .pagination-lg for larger blocks or .pagination-sm for smaller blocks.

See this example:

<!DOCTYPE html>  

<html lang="en">  

<head>  

  <title>Bootstrap Example</title>  

  <meta charset="utf-8">  

  <meta name="viewport" content="width=device-width, initial-scale=1">  

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">  

    

</head>  

<body>  

  

<div class="container">  

  <h2>Pagination - Sizing</h2>  

  <p>Add class .pagination-lg for larger blocks or .pagination-sm for smaller blocks:</p>  

  <ul class="pagination pagination-lg">  

    <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>  

  </ul>  

  

  <ul class="pagination pagination-sm">  

    <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>  

  </ul>  

</div>  

  

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>  

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>  

  

</body>  

</html> 

Bootstrap Breadcrumbs

It is another form of pagination. It indicates the current page’s location within a navigational hierarchy.

The .breadcrumb class is used to create breadcrumbs.

See this example:

<!DOCTYPE html>  

<html>  

<head>  

  <meta name="viewport" content="width=device-width, initial-scale=1">  

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">  

    

</head>  

<body>  

  

<div class="container">  

  <h2>Breadcrumbs Example:</h2>  

  <p>The .breadcrumb class indicates the current page's location within a navigational hierarchy:</p>                    

  <ul class="breadcrumb">  

    <li><a href="#">Java</a></li>  

    <li><a href="#">SQL</a></li>  

    <li><a href="#">Php</a></li>  

    <li class="active">.Net</li>          

  </ul>  

</div>  

  

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>  

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>  

  

</body>  

</html>

Comments

Leave a Reply

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