# Sibling Dim Hover

> Hovering or focusing one link fades and blurs its siblings, using :has() on the list so it needs no JavaScript.

- Category: [CSS Effects](https://copy-css.com/category/effects)
- Tags: hover, has, dim, focus, menu, blur siblings
- Live preview: https://copy-css.com/snippets/sibling-dim-hover
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<ul class="dim-list">
  <li><a href="#">Work</a></li>
  <li><a href="#">About</a></li>
  <li><a href="#">Journal</a></li>
  <li><a href="#">Contact</a></li>
</ul>
```

## CSS

```css
.dim-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  font: 800 30px/1.1 system-ui, sans-serif;
  letter-spacing: -0.02em;
}

.dim-list a {
  display: inline-block;
  color: #fafaf9;
  text-decoration: none;
  transition: opacity 0.3s ease, filter 0.3s ease, transform 0.3s ease;
}

.dim-list:has(a:hover, a:focus-visible) a:not(:hover, :focus-visible) {
  opacity: 0.25;
  filter: blur(1.5px);
}

.dim-list a:hover,
.dim-list a:focus-visible {
  transform: translateX(8px);
}

.dim-list a:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .dim-list a {
    transition: none;
  }

  .dim-list a:hover,
  .dim-list a:focus-visible {
    transform: none;
  }
}
```

## Notes

- This CSS Sibling Dim Hover is 42 lines of pure CSS (0.7 KB) with no JavaScript and no dependencies. It uses transitions, transforms, filters and CSS Grid.
- the :has() selector: Chrome 105+, Safari 15.4+, Firefox 121+.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
