AI CSS Animations

Animated Chevron Button

A ghost button whose three chevrons light up one after another like runway lights, pointing the way forward. Each chevron runs the same opacity and nudge keyframe, staggered by a custom property.

Also known as: get started button css, animated arrows button, ghost button with arrows.

HTML

<button class="btn-chevrons" type="button">
  Get started
  <span class="btn-chevrons-arrows" aria-hidden="true">
    <svg viewBox="0 0 12 24" style="--i:0"><path d="M3 6l6 6-6 6"/></svg><svg viewBox="0 0 12 24" style="--i:1"><path d="M3 6l6 6-6 6"/></svg><svg viewBox="0 0 12 24" style="--i:2"><path d="M3 6l6 6-6 6"/></svg>
  </span>
</button>

CSS

.btn-chevrons {
  --c: var(--btn-color, #3b82f6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.75em 1.6em;
  border: 0;
  border-radius: 0.6em;
  font: 600 var(--btn-size, 18px)/1.1 system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  gap: 0.6em;
  padding: 0.75em 1.3em 0.75em 1.6em;
  border: 2px solid var(--c);
  border-radius: 0.6em;
  background: transparent;
  color: var(--c);
  transition: background-color 0.25s ease, transform 0.2s ease;}
.btn-chevrons-arrows { display: inline-flex; }
.btn-chevrons-arrows svg {
  display: block;
  width: 0.55em;
  height: 1.1em;
  margin-left: -0.08em;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.2;
  animation: btn-chevrons-run 1.4s ease-in-out calc(var(--i) * 0.18s) infinite;
}
.btn-chevrons:is(:hover, :focus-visible) { background-color: color-mix(in srgb, var(--c) 10%, transparent); }
.btn-chevrons:active { transform: scale(0.97); }
@keyframes btn-chevrons-run {
  0%, 70%, 100% { opacity: 0.2; transform: translateX(0); }
  30%           { opacity: 1; transform: translateX(0.18em); }
}

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

Customizing this snippet

  • Color: set --btn-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --btn-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 18px.
  • 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 buttons