The link text rolls up and out while an identical copy rolls in from below in the accent color. The copy comes from a data attribute, so the markup stays a single word.
Also known as: text roll link, duplicate text hover.
<a class="hfx-link-slide-text" href="#" data-text="About us"><span>About us</span></a>
.hfx-link-slide-text {
--c: var(--hfx-color, #3b82f6);
font-size: var(--hfx-size, 16px);
position: relative;
display: inline-block;
color: var(--c);
font: 600 1em system-ui, sans-serif;
text-decoration: none;
overflow: hidden;
color: inherit;
line-height: 1.2;}
.hfx-link-slide-text span {
display: block;
transition: transform 0.3s ease;
}
.hfx-link-slide-text::after {
content: attr(data-text);
position: absolute;
left: 0;
top: 100%;
color: var(--c);
transition: transform 0.3s ease;
}
.hfx-link-slide-text:hover span,
.hfx-link-slide-text:hover::after { transform: translateY(-100%); }
@media (prefers-reduced-motion: reduce) {
.hfx-link-slide-text, .hfx-link-slide-text *, .hfx-link-slide-text::before, .hfx-link-slide-text::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--hfx-color on the element or a parent.
Currently previewing #3b82f6.--hfx-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 16px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.