A full-spectrum rainbow cycles through the text. Fixed colors rather than your accent, on purpose: this one is for playful moments, not brand moments.
Also known as: rainbow gradient text, spectrum text.
<div class="txt-rainbow">Taste the rainbow</div>
.txt-rainbow {
--c: var(--txt-color, #3b82f6);
font-size: var(--txt-size, 32px);
font-family: system-ui, sans-serif;
font-weight: 700;
line-height: 1.2;
background: linear-gradient(90deg, #f43f5e, #f59e0b, #10b981, #3b82f6, #a855f7, #f43f5e);
background-size: 200% 100%;
-webkit-background-clip: text;
background-clip: text;
color: transparent;
-webkit-text-fill-color: transparent;
animation: txt-rainbow-cycle 3s linear infinite;}
@keyframes txt-rainbow-cycle {
to { background-position: 200% 0; }
}
@media (prefers-reduced-motion: reduce) {
.txt-rainbow, .txt-rainbow *, .txt-rainbow::before, .txt-rainbow::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--txt-color on the element or a parent.
Currently previewing #3b82f6.--txt-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 40px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.