</> Code Corner

CSS · CSS Advanced · Lesson 54

CSS Pagination

Style page number links.

If you have a website with lots of pages, you may wish to add pagination to each page.

Example

<style>
.pagination { display: flex; gap: 4px; font-family: Arial; }
.pagination a { color: black; padding: 8px 14px; text-decoration: none; border: 1px solid #ddd; border-radius: 6px; }
.pagination a.active { background: #04AA6D; color: white; border-color: #04AA6D; }
.pagination a:hover:not(.active) { background: #ddd; }
</style>
<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="#">&raquo;</a>
</div>

Keep reading “CSS Pagination”

Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.

Chat with us 👋