# Pill Nav

> A rounded navigation bar where the current link sits in a solid pill.

- Category: [CSS Navigation](https://copy-css.com/category/navigation)
- Tags: pill, nav, links, rounded, active
- Live preview: https://copy-css.com/snippets/pill-nav
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<nav class="pill-nav" aria-label="Main">
  <a href="#" aria-current="page">Home</a>
  <a href="#">Work</a>
  <a href="#">About</a>
  <a href="#">Contact</a>
</nav>
```

## CSS

```css
.pill-nav {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: #27272a;
  font: 500 14px/1 system-ui, sans-serif;
}

.pill-nav a {
  padding: 9px 16px;
  border-radius: 999px;
  color: #a1a1aa;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.pill-nav a:hover {
  color: #fafafa;
}

.pill-nav a[aria-current="page"] {
  background: #fafafa;
  color: #18181b;
}
```

## Notes

- This CSS Pill Nav is 26 lines of pure CSS (0.5 KB) with no JavaScript and no dependencies. It uses transitions and Flexbox.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
