AI CSS Animations

Card Shine

A diagonal sheen crosses the whole card on hover, the same trick as the shine button but scaled up. Works especially well on dark cards and pricing tiers.

Also known as: card shimmer hover, glossy card, holographic card.

Starter

Everything you need to launch.

HTML

<article class="hfx-card-shine">
  <div class="hfx-card-shine-body">
    <h3>Starter</h3>
    <p>Everything you need to launch.</p>
  </div>
</article>

CSS

.hfx-card-shine {
  --c: var(--hfx-color, #3b82f6);
  font-size: var(--hfx-size, 16px);
  width: 15em;
  border-radius: 0.75em;
  overflow: hidden;
  background: #fff;
  border: 1px solid color-mix(in srgb, #000 10%, transparent);
  color: #1f2937;
  font-family: system-ui, sans-serif;
  position: relative;}
.hfx-card-shine::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, color-mix(in srgb, var(--c) 35%, transparent) 50%, transparent 65%);
  transform: translateX(-100%);
  transition: transform 0.7s ease;
  pointer-events: none;
}
.hfx-card-shine:hover::after { transform: translateX(100%); }
.hfx-card-shine-body {
  padding: 0.9em 1em 1.1em;
}
.hfx-card-shine h3 {
  margin: 0 0 0.25em;
  font-size: 1.05em;
}
.hfx-card-shine p {
  margin: 0;
  font-size: 0.85em;
  color: #6b7280;
  line-height: 1.4;
}

@media (prefers-reduced-motion: reduce) {
  .hfx-card-shine, .hfx-card-shine *, .hfx-card-shine::before, .hfx-card-shine::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --hfx-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --hfx-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 16px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar hover effects