# Previous Next Post Links

> Previous and next article links as two cards with titles and arrows, for the end of blog posts.

- Category: [CSS Navigation](https://copy-css.com/category/navigation)
- Tags: pagination, blog, article, rel prev, next post
- Live preview: https://copy-css.com/snippets/prev-next-links
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<nav class="post-nav" aria-label="More posts">
  <a class="post-nav-prev" href="#" rel="prev">
    <span>Previous</span>
    Getting started with Grid
  </a>
  <a class="post-nav-next" href="#" rel="next">
    <span>Next</span>
    Mastering flex gaps
  </a>
</nav>
```

## CSS

```css
.post-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  font: 600 14px/1.35 system-ui, sans-serif;
}

.post-nav a {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid #e7e5e4;
  border-radius: 12px;
  background: #ffffff;
  color: #1c1917;
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.post-nav a:hover {
  border-color: #1c1917;
}

.post-nav a:focus-visible {
  outline: 2px solid #ea580c;
  outline-offset: 2px;
}

.post-nav span {
  color: #78716c;
  font-size: 12px;
  font-weight: 500;
}

.post-nav-prev span::before {
  content: "← ";
  content: "← " / "";
}

.post-nav-next {
  text-align: right;
}

.post-nav-next span::after {
  content: " →";
  content: " →" / "";
}
```

## Notes

- This CSS Previous Next Post Links is 47 lines of pure CSS (0.8 KB) with no JavaScript and no dependencies. It uses transitions, CSS Grid and keyboard focus styles.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
