Fine white and gold flecks twinkle across a pink and accent gradient, like glitter catching the light. Three sparse dot layers jump between offsets with steps(), so the grains blink rather than slide.
Also known as: glitter text css, sparkly text, sequin text effect.
<div class="txt-glitter-text">Celebrate</div>
.txt-glitter-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: 900;
letter-spacing: 0.02em;
background:
radial-gradient(circle, #fff 0 0.03em, transparent 0.06em) 0 0 / 0.43em 0.31em,
radial-gradient(circle, #fef3c7 0 0.035em, transparent 0.065em) 0.2em 0.1em / 0.53em 0.47em,
radial-gradient(circle, color-mix(in srgb, var(--c) 15%, #fff) 0 0.03em, transparent 0.06em) 0.35em 0.22em / 0.61em 0.37em,
linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 45%, #ec4899), var(--c));
-webkit-background-clip: text;
background-clip: text;
color: transparent;
-webkit-text-fill-color: transparent;
animation: txt-glitter-text-twinkle 0.8s steps(1, end) infinite;}
@keyframes txt-glitter-text-twinkle {
0% { background-position: 0 0, 0.2em 0.1em, 0.35em 0.22em, 0 0; }
25% { background-position: 0.21em 0.16em, 0.04em 0.33em, 0.12em 0.05em, 0 0; }
50% { background-position: 0.1em 0.24em, 0.37em 0.2em, 0.48em 0.3em, 0 0; }
75% { background-position: 0.3em 0.07em, 0.27em 0.02em, 0.23em 0.14em, 0 0; }
}
@media (prefers-reduced-motion: reduce) {
.txt-glitter-text, .txt-glitter-text *, .txt-glitter-text::before, .txt-glitter-text::after, .txt-glitter-text *::before, .txt-glitter-text *::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.