# Compact Pagination

> A small pager that shows "Page 2 of 9" between previous and next arrows, ideal for mobile.

- Category: [CSS Navigation](https://copy-css.com/category/navigation)
- Tags: pagination, page x of y, mobile, arrows, pager
- Live preview: https://copy-css.com/snippets/compact-pagination
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<nav class="compact-pager" aria-label="Pagination">
  <a href="#" aria-label="Previous page">‹</a>
  <span>Page <b>2</b> of 9</span>
  <a href="#" aria-label="Next page">›</a>
</nav>
```

## CSS

```css
.compact-pager {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 0 0 1px #e2e8f0;
  color: #475569;
  font: 500 14px system-ui, sans-serif;
}

.compact-pager span {
  padding: 0 16px;
  border-inline: 1px solid #e2e8f0;
  line-height: 40px;
}

.compact-pager b {
  color: #0f172a;
}

.compact-pager a {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: #0f172a;
  font-size: 22px;
  text-decoration: none;
}

.compact-pager a:hover {
  background: #f1f5f9;
}

.compact-pager a:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

/* Add aria-disabled="true" on the first and last page */
.compact-pager [aria-disabled="true"] {
  color: #cbd5e1;
  pointer-events: none;
}
```

## Notes

- This CSS Compact Pagination is 45 lines of pure CSS (0.8 KB) with no JavaScript and no dependencies. It uses box shadows, CSS Grid, Flexbox and keyboard focus styles.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
