Each line slides up out of an invisible mask, one after another, the way editorial sites reveal headlines. Every line is a clipping wrapper around a moving inner span.
Also known as: text slide up mask, overflow hidden reveal, staggered lines.
<div class="txt-mask-reveal"> <span><span>Design that</span></span> <span><span>earns attention.</span></span> </div>
.txt-mask-reveal {
--c: var(--txt-color, #3b82f6);
font-size: var(--txt-size, 32px);
font-family: system-ui, sans-serif;
font-weight: 700;
line-height: 1.2;
color: var(--c);}
.txt-mask-reveal > span {
display: block;
overflow: hidden;
}
.txt-mask-reveal > span > span {
display: block;
transform: translateY(110%);
animation: txt-mask-reveal-up 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.txt-mask-reveal > span:nth-child(2) > span { animation-delay: 0.15s; }
.txt-mask-reveal > span:nth-child(3) > span { animation-delay: 0.3s; }
@keyframes txt-mask-reveal-up {
to { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
.txt-mask-reveal, .txt-mask-reveal *, .txt-mask-reveal::before, .txt-mask-reveal::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.