webdevpuneet.com

Card Grid Hover Focus Dim — Sibling Blur Snippet

Card Grid Hover Focus Dim · Animations · Plain HTML, CSS & JS · Live preview

CategoryAnimations

Copy & paste

Source Code

<div class="fd-stage">
  <p class="fd-hint">Hover any card — the rest of the grid dims and blurs slightly to focus attention</p>
  <div class="fd-grid" id="fdGrid">
    <div class="fd-card"><span class="fd-icon">⚡</span><h3>Fast by default</h3><p>Sub-100ms responses across every region.</p></div>
    <div class="fd-card"><span class="fd-icon">🔒</span><h3>Secure at rest</h3><p>AES-256 encryption on every stored byte.</p></div>
    <div class="fd-card"><span class="fd-icon">📈</span><h3>Scales with you</h3><p>From ten users to ten million, no rewrite.</p></div>
    <div class="fd-card"><span class="fd-icon">🧩</span><h3>Composable</h3><p>Small primitives that combine into anything.</p></div>
    <div class="fd-card"><span class="fd-icon">🌍</span><h3>Global edge</h3><p>Deployed to 34 regions out of the box.</p></div>
    <div class="fd-card"><span class="fd-icon">🛠️</span><h3>Open API</h3><p>Every feature is available as a typed endpoint.</p></div>
  </div>
</div>

Extend with AI

Take This Snippet Further With AI

The AI prompt for this one is for Patreon supporters ($3 a month), along with a site with no ads. Supporters enter the passcode once and it is remembered in this browser.

· Become a supporter

What's included

Features

A single shared grid-level class drives the dim state for all sibling cards at once
One .fd-focused marker toggled across all cards per hover, not per-card isolated :hover rules
Non-focused siblings dim via opacity, filter: blur + saturate, and a subtle scale-down together
Focused card lifts with scale, a colored border, and a matching box-shadow
grid.mouseleave resets the whole group in one pass — moving between cards never triggers a flicker
All property changes share the same 0.3s transition timing for one coordinated motion
No JavaScript animation loop — every visual change is a CSS transition off two class toggles
Fully responsive grid-template-columns with a mobile breakpoint
Export as HTML file, React JSX, or React + Tailwind CSS
Mobile (375px), Tablet (768px), Desktop device preview buttons
Live split-pane editor — preview updates as you type

About this UI Snippet

Card Grid Hover Focus Dim — Whole-Grid Sibling Dim Driven by a Single Focused Card

Screenshot of the Card Grid Hover Focus Dim snippet rendered live

A plain :hover on a card grid only ever affects the card the cursor is directly over — every sibling card stays fully visible, unaware anything happened. This effect instead treats the entire grid as one connected surface: hovering any single card dims, slightly desaturates, and softly blurs every other card at once, while the hovered card lifts and gains a colored border, pulling all visual attention onto it. It's the same "spotlight the one, recede the rest" idea used in feature grids on sites like Linear and Stripe.

Why the state lives on the grid, not per-card

Rather than giving every card its own isolated :hover rule, the JS adds an .fd-active class to the shared .fd-grid container the moment any card is entered, and a .fd-focused class to that one specific card. The CSS selector .fd-grid.fd-active .fd-card:not(.fd-focused) then targets every sibling that is NOT the focused card — this is what makes the dimming apply to the whole group simultaneously rather than needing a separate rule per card-pair combination.

Toggling the focused card

On every card's mouseenter, cards.forEach(c => c.classList.toggle('fd-focused', c === card)) runs a single pass that adds .fd-focused to the entered card and removes it from every other card in one loop — so moving directly from one card to an adjacent one (without the cursor leaving the grid) instantly reassigns which card is exempt from the dim treatment.

The dimmed-sibling treatment

Non-focused siblings get three coordinated CSS changes: opacity: 0.4 for the recede, filter: blur(1.5px) saturate(0.7) for a subtle depth-of-field feel without making the text fully illegible, and transform: scale(0.97) so they visually shrink back, reinforcing that they're no longer the subject of attention.

The focused card's own lift

The focused card itself doesn't dim — it scales up slightly (scale(1.035)), gains an indigo border-color, and picks up a colored box-shadow, all transitioning with the same 0.3s timing as the dimmed siblings so the whole grid's state change reads as one coordinated motion rather than two unrelated animations running independently.

Clean reset on mouseleave

A single mouseleave listener on the grid container (not on each card) removes .fd-active from the grid and .fd-focused from every card, restoring the whole grid to its neutral state the moment the cursor leaves the grid area entirely — moving between cards inside the grid never triggers this reset, only exiting the grid does.

Step by step

How to Use

  1. 1
    Hover any cardMove your cursor over one card — every other card in the grid dims, softens, and slightly shrinks while the hovered card lifts forward.
  2. 2
    Move directly to an adjacent cardSlide the cursor to a neighboring card without leaving the grid — the focus reassigns instantly to the new card.
  3. 3
    Move the cursor off the grid entirelyLeave the whole grid and every card returns to its neutral, undimmed state together.
  4. 4
    Adjust the dim intensityIn the CSS panel, change the opacity, blur, and saturate values on the .fd-grid.fd-active .fd-card:not(.fd-focused) rule.
  5. 5
    Change the focused card treatmentEdit the border-color, scale, and box-shadow on .fd-grid.fd-active .fd-focused to match your brand color.
  6. 6
    Export in your formatClick "HTML" for a standalone file, "JSX" for a React component, or "Tailwind" for a React + Tailwind version.

Real-world uses

Common Use Cases

SaaS feature grids on marketing pages
A features section where hovering one card focuses attention on it while the rest recede reads as noticeably more polished than a flat grid with independent hover cards.
CARD
Pricing plan comparison grids
Apply to a multi-plan layout so hovering a plan visually emphasizes it against the others without needing a separate "recommended" badge treatment.
Learn shared-state hover patterns
A clean example of coordinating many siblings' styles from one hovered element via a container-level class plus a single per-item marker, instead of N independent hover rules.
Team/people directory grids
A grid of team member cards benefits from the same focus-dim treatment — hovering one person visually isolates their card from the crowd.
Dashboard widget/module galleries
Use in a dashboard customization screen where users pick from a gallery of available widgets, helping the currently considered widget stand out.
Related: Spotlight Card
See the Spotlight Card for a per-card cursor-tracking glow effect that pairs well with this sibling-dim treatment on the same grid.

Got questions?

Frequently Asked Questions

A per-card :hover rule can only ever style the card the cursor is directly over — it has no way to reach into sibling elements. By adding a class to the shared grid container plus a single "focused" marker on one card, one CSS selector (.fd-grid.fd-active .fd-card:not(.fd-focused)) can target every OTHER card at once.

Each card's mouseenter handler runs a full pass over all cards, toggling .fd-focused on based on cards.forEach(c => c.classList.toggle('fd-focused', c === card)). Moving directly between adjacent cards (without the cursor leaving the grid) reassigns the focused class in one step, so the transition is smooth with no flicker back to the neutral state.

Opacity alone can look like the cards are simply fading, which reads as less intentional. Adding a slight blur and reduced saturation together produces a soft depth-of-field quality, similar to a camera focusing on the foreground, that better communicates "these are receding from focus" rather than "these are disabled."

No. The reset (removing .fd-active and .fd-focused) only happens on the grid container's own mouseleave event, which fires only when the cursor exits the entire grid area — not when it moves from one card to another within the grid.

Yes. The JS queries all .fd-card elements inside the grid dynamically with querySelectorAll, so adding or removing cards in the HTML requires no changes to the JavaScript.

Yes. Click "JSX" for a React component. Track a single hoveredIndex state on the parent, and derive each card's className from whether its own index matches — React's conditional class rendering maps directly onto the same .fd-active / .fd-focused pattern.