AI CSS Animations

Pricing Card Glow Border

The featured plan on a pricing page: a beam of light circles the card, a soft glow follows it outside the edge and a Most popular pill rides the top border. One @property angle drives both.

Also known as: glowing pricing card css, pricing card border animation, most popular plan card css.

Most popular Pro $20 per month
  • Unlimited projects
  • Priority support
Upgrade to Pro

HTML

<div class="bdr-pricing-card-glow-border">
  <span class="bdr-pricing-card-glow-border-face" aria-hidden="true"></span>
  <span class="bdr-pricing-card-glow-border-badge">Most popular</span>
  <span class="bdr-pricing-card-glow-border-plan">Pro</span>
  <span class="bdr-pricing-card-glow-border-price"><b>$20</b> per month</span>
  <ul class="bdr-pricing-card-glow-border-list">
    <li>Unlimited projects</li>
    <li>Priority support</li>
  </ul>
  <a class="bdr-pricing-card-glow-border-cta" href="#">Upgrade to Pro</a>
</div>

CSS

@property --bdr-pricing-card-glow-border-a {
  syntax: "<angle>";
  inherits: true;
  initial-value: 0deg;
}
.bdr-pricing-card-glow-border {
  --c: var(--bdr-color, #3b82f6);
  font-size: var(--bdr-size, 16px);
  --arc: conic-gradient(from var(--bdr-pricing-card-glow-border-a), transparent 0 62%, color-mix(in srgb, var(--c) 55%, transparent) 80%, color-mix(in srgb, var(--c) 45%, #fff) 96%, transparent 97%);
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 0.45em;
  width: 13em;
  box-sizing: border-box;
  padding: 1.3em 1.25em 1.15em;
  border-radius: 1em;
  color: #f1f5f9;
  font-family: system-ui, sans-serif;
  animation: bdr-pricing-card-glow-border-orbit 4.5s linear infinite;
}
.bdr-pricing-card-glow-border::before,
.bdr-pricing-card-glow-border::after,
.bdr-pricing-card-glow-border-face {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}
.bdr-pricing-card-glow-border::before {
  z-index: -1;
  background: var(--arc);
  filter: blur(0.9em);
  opacity: 0.8;
}
.bdr-pricing-card-glow-border-face {
  z-index: -1;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 14%, #0b0f19), color-mix(in srgb, var(--c) 10%, #0b0f19) 60%);
}
.bdr-pricing-card-glow-border::after {
  padding: 1px;
  background: var(--arc), color-mix(in srgb, #fff 12%, transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.bdr-pricing-card-glow-border-badge {
  position: absolute;
  top: 0;
  left: 50%;
  translate: -50% -50%;
  padding: 0.3em 0.7em;
  border-radius: 1em;
  background: var(--c);
  color: #fff;
  font-size: 0.62em;
  font-weight: 650;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 0.3em 0.9em -0.2em var(--c);
}
.bdr-pricing-card-glow-border-plan {
  font-size: 0.78em;
  font-weight: 600;
  color: color-mix(in srgb, var(--c) 45%, #fff);
}
.bdr-pricing-card-glow-border-price {
  font-size: 0.75em;
  font-weight: 450;
  color: color-mix(in srgb, #f1f5f9 60%, transparent);
}
.bdr-pricing-card-glow-border-price b {
  margin-right: 0.15em;
  font-size: 2.2em;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}
.bdr-pricing-card-glow-border-list {
  display: grid;
  gap: 0.3em;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.72em;
  font-weight: 450;
  color: color-mix(in srgb, #f1f5f9 80%, transparent);
}
.bdr-pricing-card-glow-border-list li::before {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.38em;
  margin: 0 0.55em 0.15em 0.1em;
  border: solid var(--c);
  border-width: 0 0 0.15em 0.15em;
  rotate: -45deg;
}
.bdr-pricing-card-glow-border-cta {
  margin-top: 0.35em;
  padding: 0.6em;
  border-radius: 0.55em;
  background: var(--c);
  color: #fff;
  font-size: 0.75em;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  box-shadow: inset 0 1px color-mix(in srgb, #fff 30%, transparent);
  transition: filter 0.2s ease;
}
.bdr-pricing-card-glow-border-cta:hover { filter: brightness(1.1); }
.bdr-pricing-card-glow-border-cta:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--c) 45%, #fff);
  outline-offset: 2px;
}
@keyframes bdr-pricing-card-glow-border-orbit {
  to { --bdr-pricing-card-glow-border-a: 360deg; }
}
@media (prefers-reduced-motion: reduce) {
  .bdr-pricing-card-glow-border { animation: none; --bdr-pricing-card-glow-border-a: 200deg; }
}

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

Customizing this snippet

  • Color: set --bdr-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --bdr-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 border animations