CSS Sibling Dim Hover
Hovering or focusing one link fades and blurs its siblings, using :has() on the list so it needs no JavaScript.
<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>
.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;
}
}
About this CSS Sibling Dim Hover
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. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
CSS features used
- transitions
- transforms
- filters
- CSS Grid
- the :has() selectorChrome 105+, Safari 15.4+, Firefox 121+.
- keyboard focus styles
- reduced-motion support
Customize it
The colors in this snippet. Search and replace them to match your brand:
#fafaf9#fbbf24
How to use this sibling dim hover
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.dim-listclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.