CHAPTER 63
CSS Pagination
Learn how to style pagination links for multi-page content.
01. What is CSS Pagination?
Pagination divides large content into multiple pages.
CSS can style page numbers, previous and next links.
Active and hover states help users understand their current page.
02. Syntax
.pagination a {
padding: 10px 15px;
text-decoration: none;
}
03. Example
CSS / HTML Example
AIFA Coding Lab
<!DOCTYPE html>
<html>
<head>
<style>
.pagination {
display: flex;
gap: 8px;
}
.pagination a {
padding: 10px 15px;
border-radius: 8px;
background: #e2e8f0;
color: #0f172a;
text-decoration: none;
}
.pagination a.active {
background: #2563eb;
color: white;
}
.pagination a:hover {
background: #38bdf8;
}
</style>
</head>
<body>
<div class="pagination">
<a href="#">1</a>
<a href="#" class="active">2</a>
<a href="#">3</a>
<a href="#">4</a>
</div>
</body>
</html>
04. Important Points
✓
Clearly identify the active page.
✓
Keep pagination easy to use.
✓
Provide enough spacing between page links.
✓
Consider mobile responsiveness.
05. Common Mistakes
⚠
Creating tiny page links.
⚠
Not showing the active page.
⚠
Creating pagination that overflows on mobile.
06. Real World Use
Pagination is used in blogs, search results, product listings, student records and admin dashboards.
Ready to Practice? 🚀
Open the AIFA CSS Editor and practice this chapter live.
Try It Yourself →
Practice Exercise
Create Pagination
Create pagination from page 1 to page 5 and highlight page 3.