# Outline Offset Hover

> A ring that springs out from the element on hover and focus by animating outline-offset and outline color.

- Category: [CSS Effects](https://copy-css.com/category/effects)
- Tags: outline, outline-offset, ring, hover, focus, avatar
- Live preview: https://copy-css.com/snippets/outline-offset-hover
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="ring-row">
  <a class="ring-hover" href="#" aria-label="Profile of Kai">K</a>
  <a class="ring-hover" href="#" aria-label="Profile of Noa">N</a>
  <a class="ring-hover" href="#" aria-label="Profile of Eli">E</a>
</div>
```

## CSS

```css
.ring-row {
  display: flex;
  gap: 18px;
}

.ring-hover {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0d9488;
  color: #fff;
  font: 700 20px system-ui, sans-serif;
  text-decoration: none;
  outline: 2px solid transparent;
  outline-offset: 0;
  transition: outline-offset 0.25s ease, outline-color 0.25s ease;
}

.ring-hover:hover,
.ring-hover:focus-visible {
  outline-color: #0d9488;
  outline-offset: 5px;
}

@media (prefers-reduced-motion: reduce) {
  .ring-hover {
    transition: none;
  }
}
```

## Notes

- This CSS Outline Offset Hover is 31 lines of pure CSS (0.6 KB) with no JavaScript and no dependencies. It uses transitions, CSS Grid, Flexbox and keyboard focus styles.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
