Last updated: March 13, 2026
How to Create CSS Pagination (7 Styles)
The complete guide to building beautiful, accessible pagination with pure CSS. From minimal to fully-featured designs with live demos and copy-paste code.
Building Pagination the Right Way
Good pagination helps users navigate through large sets of content. It should be visually clear, accessible to all users, and responsive across devices. Here are the key elements of well-designed pagination:
Semantic HTML
Use <nav> with aria-label, <ul>/<li> for structure, and aria-current for active page.
Clear Visual States
Distinct styles for default, hover, active, and disabled states help users understand what's clickable and where they are.
Responsive Design
Adapt pagination for mobile by hiding page numbers or using a compact layout with just prev/next and page indicator.
Basic Pagination Structure
Before diving into styles, let's understand the proper HTML structure for accessible pagination.
Semantic HTML Template
Key Accessibility Features
- +
<nav>landmark for screen readers - +
aria-labeldescribes navigation purpose - +
aria-current="page"marks current page - +Descriptive labels for prev/next buttons
Structure Elements
- *
<nav>- Navigation landmark - *
<ul>- List container - *
<li>- List items for each page - *
<a>or<button>- Interactive elements
Style Comparison
Compare pagination styles to find the best fit for your design.
| Style | Hover | Active State | Responsive | Accessible |
|---|---|---|---|---|
| Minimal | Yes | Yes | - | Yes |
| Rounded | Yes | Yes | - | Yes |
| Outlined | Yes | Yes | - | Yes |
| Filled | Yes | Yes | - | Yes |
| With Dots | Yes | Yes | - | Yes |
| Responsive | Yes | Yes | Yes | Yes |
| First/Last | Yes | Yes | - | Yes |
Minimal
Rounded
Outlined
Filled
With Dots
Responsive
First/Last
Minimal Clean Style
A simple, clean pagination with subtle hover effects. Perfect for minimalist designs and content-focused websites.
Live Preview
HTML + CSS Code
Rounded Button Style
Pagination with rounded buttons and a filled active state. Great for modern, friendly interfaces.
Live Preview
HTML + CSS Code
Outlined Border Style
A classic outlined pagination with borders. Works well for professional and corporate designs.
Live Preview
HTML + CSS Code
Filled Solid Style
Bold pagination with solid colored buttons. Ideal for dark themes or when you want pagination to stand out.
Live Preview
HTML + CSS Code
With Truncation Dots
Pagination with ellipsis for large page counts. Shows first, last, and pages around current selection.
Live Preview
HTML + CSS Code
Responsive Mobile-Friendly
ResponsiveAdapts to screen size by hiding page numbers on mobile and showing only prev/next navigation with current page indicator.
Live Preview
HTML + CSS Code
With First & Last Buttons
Complete pagination with buttons to jump to the first and last pages. Useful for long lists where users may want to quickly navigate to extremes.
Live Preview
HTML + CSS Code
Pro Tips for Pagination
1. Always Use Semantic HTML
Wrap pagination in a <nav> element with aria-label. This helps screen readers identify the navigation and its purpose.
<nav aria-label="Pagination"> <!-- pagination content --> </nav>
2. Mark the Current Page
Use aria-current="page" to indicate the current page for screen readers, in addition to visual styling.
<a href="#" aria-current="page" class="active"> 2 </a>
3. Use Flexbox for Layout
Flexbox makes pagination layouts easy to maintain and responsive. Use gap for consistent spacing between items.
.pagination {
display: flex;
list-style: none;
gap: 8px;
}4. Handle Disabled States
Disable prev/next buttons when on first/last page. Use aria-disabled="true" and appropriate styling.
.pagination a[aria-disabled] {
opacity: 0.5;
pointer-events: none;
cursor: not-allowed;
}Frequently Asked Questions
Use a <nav> element with aria-label='Pagination' as the wrapper, containing an unordered list (<ul>) with list items (<li>) for each page link. Use <a> tags for clickable pages and <span> for non-clickable elements like ellipsis. Add aria-current='page' to the active page link for accessibility.
Use semantic HTML with <nav> and aria-label. Add aria-label to prev/next buttons describing their action. Mark the current page with aria-current='page'. Ensure sufficient color contrast (4.5:1 for text). Make all interactive elements keyboard focusable with visible focus states.
Use <a> tags if clicking changes the URL (traditional page navigation). Use <button> elements for JavaScript-based pagination that updates content without changing the URL (like infinite scroll or SPA pagination). Both are accessible when implemented correctly.
Add a distinct visual style using background color, text color, or border. Common approaches include: filled background with contrasting text, underline or bottom border, or bold text. Also add aria-current='page' for screen readers.
On mobile, consider hiding numbered pages and showing only prev/next buttons with a 'Page X of Y' indicator. This saves space while maintaining functionality. Use media queries to switch between desktop and mobile layouts.
Use ellipsis when you have many pages (typically 7+). Show the first page, last page, current page, and 1-2 pages on either side of current. Replace the gaps with ellipsis. This keeps pagination compact while allowing navigation to any page.
More CSS Tutorials
Copy CSS from Website
Extract styles with 2 clicks
Center a Div (CSS)
Flexbox, Grid, and more
Center a Div (Tailwind)
Utility classes for centering
Convert CSS to Tailwind
CSS to utility classes
Glassmorphism Effect
Frosted glass UI style
Neumorphism Button
Soft UI button design
Responsive Navbar
Mobile-friendly navigation
Sticky Header
Fixed navigation on scroll
CSS Accordion
Expandable content sections
Dropdown Menu
Hover and click dropdowns
CSS Modal
Popup dialog boxes
Toast Notifications
Animated alert messages
Hamburger Menu
Animated menu icon
Animate Gradients
Moving gradient backgrounds
Skeleton Loader
Loading placeholder UI
Element Screenshot
Capture any element as image
Pick Color from Website
Eyedropper tool comparison
Identify Fonts
Find fonts on any website
Download All Images
Bulk save images from any site
Measure Elements
Page ruler and measurements
Extract Colors from Website
Get any color palette instantly
Dark Mode Toggle
CSS variables and localStorage
Responsive Grid
CSS Grid auto-fit and minmax
Center Text in CSS
text-align, Flexbox, and Grid
Make Text Bold
font-weight values explained
Add Shadow in CSS
box-shadow, text-shadow, drop-shadow
Round Corners in CSS
border-radius and pill shapes
Style File Input
Custom upload buttons
