THE BEST WEB DEVELOPER SITE

How TO - CSS Pagination


Learn how to create a pagination with CSS.


How To Create a Pagination


Step 1) Add HTML:

Example

<div class="pagination">
  <a href="#">&laquo;</a>
  <a href="#">1</a>
  <a class="active" href="#">2</a>
  <a href="#">3</a>
  <a href="#">4</a>
  <a href="#">5</a>
  <a href="#">6</a>
  <a href="#">&raquo;</a>
</div>
Step 2) Add CSS:

Example

.pagination a {
    color: black;
    float: left;
    padding: 8px 16px;
    text-decoration: none;
    transition: background-color .3s;
}

.pagination a.active {
    background-color: #F78628;
    color: white;
}

.pagination a:hover:not(.active) {background-color: #ddd;}
Try it Yourself »

Go to our CSS Pagination Tutorial to learn more about pagination.