AI CSS Animations

Pricing Card Hover

A pricing tier lifts, picks up an accent ring, pops a Popular badge and fills its button. The ring is a spread box-shadow, so the border never nudges the layout.

Also known as: pricing table hover effect, pricing plan card css, highlight plan on hover.

Popular

Pro

$24 / month

  • Unlimited projects
  • Priority support
Choose Pro

HTML

<article class="hfx-card-pricing-tier">
  <span class="hfx-card-pricing-tier-badge">Popular</span>
  <h3>Pro</h3>
  <p class="hfx-card-pricing-tier-price"><strong>$24</strong> / month</p>
  <ul>
    <li>Unlimited projects</li>
    <li>Priority support</li>
  </ul>
  <a class="hfx-card-pricing-tier-cta" href="#">Choose Pro</a>
</article>

CSS

.hfx-card-pricing-tier {
  --c: var(--hfx-color, #3b82f6);
  font-size: var(--hfx-size, 16px);
  position: relative;
  box-sizing: border-box;
  width: 11.5em;
  padding: 1em 1.1em 1.1em;
  border-radius: 0.9em;
  background: #fff;
  color: #1f2937;
  font-family: system-ui, sans-serif;
  box-shadow: 0 0 0 1px color-mix(in srgb, #000 10%, transparent), 0 0.3em 0.6em -0.4em color-mix(in srgb, #000 20%, transparent);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s ease;
}
.hfx-card-pricing-tier:hover {
  transform: translateY(-0.35em);
  box-shadow: 0 0 0 0.125em var(--c), 0 1em 1.4em -0.9em color-mix(in srgb, var(--c) 80%, transparent);
}
.hfx-card-pricing-tier h3 {
  font-weight: 700;
  margin: 0;
  font-size: 0.75em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c);
}
.hfx-card-pricing-tier-price {
  margin: 0.35em 0 0.7em;
  font-size: 0.8em;
  line-height: 1;
  color: #6b7280;
}
.hfx-card-pricing-tier-price strong {
  font-size: 2.3em;
  letter-spacing: -0.03em;
  color: #111827;
}
.hfx-card-pricing-tier ul {
  display: grid;
  gap: 0.4em;
  margin: 0 0 1.1em;
  padding: 0;
  list-style: none;
  font-size: 0.78em;
  color: #4b5563;
}
.hfx-card-pricing-tier li {
  display: flex;
  align-items: center;
  gap: 0.6em;
}
.hfx-card-pricing-tier li::before {
  content: "";
  width: 0.35em;
  height: 0.65em;
  margin-left: 0.15em;
  border: solid color-mix(in srgb, var(--c) 45%, transparent);
  border-width: 0 0.15em 0.15em 0;
  transform: translateY(-0.1em) rotate(45deg);
  transition: border-color 0.3s ease;
}
.hfx-card-pricing-tier:hover li::before { border-color: var(--c); }
.hfx-card-pricing-tier-cta {
  display: block;
  padding: 0.6em;
  border-radius: 0.55em;
  background: color-mix(in srgb, var(--c) 12%, transparent);
  color: var(--c);
  font-size: 0.8em;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}
.hfx-card-pricing-tier:hover .hfx-card-pricing-tier-cta {
  background: var(--c);
  color: #fff;
}
.hfx-card-pricing-tier-badge {
  position: absolute;
  top: 1.35em;
  right: 1.35em;
  padding: 0.3em 0.7em;
  border-radius: 99em;
  background: var(--c);
  color: #fff;
  font-size: 0.62em;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateY(0.5em) scale(0.7);
  transition: opacity 0.25s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hfx-card-pricing-tier:hover .hfx-card-pricing-tier-badge {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .hfx-card-pricing-tier, .hfx-card-pricing-tier *, .hfx-card-pricing-tier::before, .hfx-card-pricing-tier::after, .hfx-card-pricing-tier *::before, .hfx-card-pricing-tier *::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