🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #158

CSS Pagination


CSS Pagination

Learn how to create a responsive pagination using CSS.

If you have a website with lots of pages, you may want to add some sort of pagination on each page.

Pagination is typically a series of links, wrapped in an unordered list (<ul>). Each link represents an individual page number. In addition there are "previous" and "next" controls:

  • «
  • 1
  • 2
  • 3
  • 4
  • 5
  • »

Example

  .pagination {
  display: flex;
  justify-content: center;

  list-style: none; /* remove list bullets */
  padding: 0px;
}

.pagination li a
  {
  display: block; /* let links fill the list item */

  padding: 8px 12px;
  text-decoration: none;
  border: 1px
  solid gray;
  color: black;
  margin: 0 4px;
  border-radius: 5px; /* add
  rounded borders */
}

Example Explained

Style the pagination container with:

  • display: flex; to arrange the page numbers horizontally
  • justify-content: center; to center align them
  • list-style: none; to remove the list bullets

The style the <a> elements within the <li> elements for the look of the page numbers, with properties like display, padding, text-decoration, border, background-color, color, font-size, and border-radius.


Pagination With an Active Class

Highlight the currently active page with an .active class, to indicate which page the user is on:

  • «
  • 1
  • 2
  • 3
  • 4
  • 5
  • »

Example

  .pagination li a.active {
  background-color: #4CAF50;

  color: white;
}

Pagination With a Disabled Class

If the user are currently on the last page, the "Next" button should be disabled.

Here, we add a .disabled class, and sets the color , cursor and pointer-events properties, to make the "Next" button disabled:

  • «
  • 1
  • 2
  • 3
  • 4
  • 5
  • »

Example

  .pagination li a.disabled {
  color: #dddddd;
  cursor:
  not-allowed;
  pointer-events: none;
}

Pagination Subpages

Continue learning about CSS pagination:

  • Pagination Styles - hover effects, transitions, breadcrumbs

Want to go beyond the notes?

Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

CSS Pagination – FAQs

Quick answers about learning CSS Pagination in CSS.

This free note from CodingNow 2.0 explains CSS Pagination in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including CSS Pagination, is 100% free with no signup required.
With focused practice, most students grasp CSS Pagination in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now