AI CSS Animations

Sunset Gradient Text

Warm amber letters slowly turn pink, then dusky violet, while a glowing sun sinks below the baseline, and back again. A tall vertical gradient slides up and down behind the text.

Also known as: sunset text css, golden hour gradient text, warm gradient text.

Golden Hour

HTML

<div class="txt-sunset-gradient-text">Golden Hour</div>

CSS

.txt-sunset-gradient-text {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  font-weight: 800;
  background:
    radial-gradient(ellipse 22% 45% at 50% 50%, rgb(251 191 36 / 0.95), transparent 75%) 0 0 / 100% 200% no-repeat,
    linear-gradient(180deg, color-mix(in srgb, var(--c) 45%, #4c1d95) 0%, #db2777 32%, #f97316 58%, #f59e0b 78%, #ea580c 100%) 0 0 / 100% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: txt-sunset-gradient-text-set 5s ease-in-out infinite alternate;}
@keyframes txt-sunset-gradient-text-set {
  from { background-position: 0 50%, 0 100%; }
  to   { background-position: 0 -40%, 0 0%; }
}

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

Customizing this snippet

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