Learn how to create a pagination with CSS.
How To Create a Pagination
- «
- 1
- 2
- 3
- 4
- 5
- 6
Step 1) Add HTML:
Example
html
<div class="pagination">
<a href="#">«</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="#">»</a>
</div>
Step 2) Add CSS:
Example
css
/* Pagination links */
.pagination a {
color:
black;
float: left;
padding: 8px
16px;
text-decoration: none;
transition: background-color .3s;
}
/* Style the active/current link
*/
.pagination a.active {
background-color: dodgerblue;
color: white;
}
/*
Add a grey background color on mouse-over */
.pagination a:hover:not(.active) {background-color: #ddd;}
Go to the CSS Pagination Tutorial to learn more about pagination.