All effectsHover & follow

Hover Glare

悬停掠光

A diagonal highlight crosses a surface like light reflecting on glass.

Hover, focus, or tap the preview

Where to use it

Suggest a polished surface on a card, badge, or promotional button. Use the reflection sparingly on surfaces that are meant to feel like coated paper, glass, or polished metal.

Practical example

In a stationery catalog, hovering over a foil-stamped notebook cover sends a thin diagonal highlight across the card. The moving reflection suggests the finish on the physical cover.

AI prompt

Add Hover Glare to [target]. Clip a narrow angled linear-gradient layer to the surface and move it across the element once per activation. Keep the content readable in reduced-motion mode and preserve keyboard navigation.

Example code

Save the standalone HTML as a file and open it in your browser. It uses the same code as the preview.

View HTML
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Hover Glare</title>
  <style>
    :root {
      color-scheme: dark;
      --demo-bg: #171629;
      --demo-ink: #f8f5ff;
      --demo-accent: #b9a6ff;
      --demo-muted: #bfbbd3;
      font-family: system-ui, sans-serif;
      color: var(--demo-ink);
      background: var(--demo-bg);
    }

    *, *::before, *::after { box-sizing: border-box; }
    body { margin: 0; min-width: 0; }
    button, input { font: inherit; }

    .demo {
      display: grid;
      place-items: center;
      align-content: center;
      min-height: 100vh;
      padding: 14px;
      overflow: hidden;
      background: radial-gradient(ellipse at 50% 24%, #28233f, var(--demo-bg) 78%);
    }

    .demo-button {
      border: 1px solid #ffffff3d;
      border-radius: 7px;
      background: #ffffff12;
      color: var(--demo-ink);
      padding: 6px 11px;
      font-size: 12px;
      cursor: pointer;
    }

    :focus-visible {
      outline: 2px solid var(--demo-accent);
      outline-offset: 3px;
    }

    .target {
      position: relative;
      display: grid;
      place-items: center;
      width: min(100%, 208px);
      min-height: 84px;
      padding: 10px;
      color: #f5efff;
      border: 1px solid #aa91ee80;
      border-radius: 13px;
      background: #29213f;
      cursor: pointer;
      font: 680 15px system-ui, sans-serif;
    }
    .target[aria-pressed="true"] { outline: 2px solid #d9c9ff; outline-offset: 3px; }
    @media (prefers-reduced-motion: reduce) {
      .target, .target *, .target::before, .target::after, .target *::before, .target *::after {
        transition: none !important;
        animation: none !important;
      }
    }

    .target { isolation: isolate; overflow: hidden; background: linear-gradient(145deg,#6f50a2,#33264f); }
    .target::after {
      position: absolute; content: ''; inset: -20% -30%;
      background: linear-gradient(110deg,transparent 45%,#ffffff86 51%,transparent 57%);
      transform: translateX(-80%); pointer-events: none;
    }
    .target:is(:hover, :focus-visible, [aria-pressed="true"])::after { transform: translateX(80%); transition: transform .55s ease; }
    @media (prefers-reduced-motion: reduce) { .target:is(:hover, :focus-visible, [aria-pressed="true"])::after { transform: none; opacity: .5; } }
  </style>
</head>
<body>
  <main class="demo">
    <button class="target" type="button" aria-pressed="false" aria-label="Prism"><span>Prism</span></button>
  </main>
  <script>
    const target = document.querySelector('.target');
    target.addEventListener('click', () => {
      target.setAttribute('aria-pressed', String(target.getAttribute('aria-pressed') !== 'true'));
    });
  </script>
</body>
</html>

Original example by UI Skills