AI CSS Animations

Scroll Line Indicator Button

The quiet hero hint: a small Scroll to explore caption above a hairline track where a bead of light keeps sliding down. Hover dips the caption and the track brightens. One gradient bead, one keyframe.

Also known as: scroll down button css, scroll to explore indicator, scroll indicator line animation, hero scroll hint.

HTML

<button class="btn-scroll-line" type="button">
  <span class="btn-scroll-line-label">Scroll to explore</span>
  <span class="btn-scroll-line-track" aria-hidden="true"></span>
</button>

CSS

.btn-scroll-line {
  --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;
  flex-direction: column;
  gap: 0.8em;
  padding: 0.7em 1em 0.4em;
  border-radius: 0.8em;
  background: transparent;
  color: var(--c);
  transition: background-color 0.25s ease;}
.btn-scroll-line-label {
  font-size: 0.66em;
  font-weight: 600;
  letter-spacing: 0.22em;
  margin-right: -0.22em;
  text-transform: uppercase;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn-scroll-line-track {
  position: relative;
  width: 0.1em;
  height: 3.4em;
  border-radius: 0.1em;
  background: color-mix(in srgb, var(--c) 22%, transparent);
  clip-path: inset(0 -1em);
  transition: background-color 0.25s ease;
}
.btn-scroll-line-track::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 45%;
  border-radius: 0.1em;
  background: linear-gradient(transparent, var(--c) 75%, color-mix(in srgb, var(--c) 30%, #fff));
  box-shadow: 0 0.3em 0.5em -0.1em color-mix(in srgb, var(--c) 60%, transparent);
  animation: btn-scroll-line-drop 2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
.btn-scroll-line:is(:hover, :focus-visible) { background-color: color-mix(in srgb, var(--c) 8%, transparent); }
.btn-scroll-line:is(:hover, :focus-visible) .btn-scroll-line-label { transform: translateY(0.2em); }
.btn-scroll-line:is(:hover, :focus-visible) .btn-scroll-line-track { background-color: color-mix(in srgb, var(--c) 40%, transparent); }
.btn-scroll-line:focus-visible {
  outline: 2px solid var(--c);
  outline-offset: 0.15em;
}
.btn-scroll-line:active .btn-scroll-line-label { transform: translateY(0.35em); }
@keyframes btn-scroll-line-drop {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(225%); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-scroll-line-track::after { animation: none; top: 55%; }
  .btn-scroll-line-label { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-scroll-line, .btn-scroll-line *, .btn-scroll-line::before, .btn-scroll-line::after, .btn-scroll-line *::before, .btn-scroll-line *::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