A plain underlined link whose line splits in two on hover: a copy drops below with a springy overshoot and a softer tint. Two pseudo-elements stacked on the same spot at rest.
Also known as: split underline hover, two line underline css, double line link animation.
<a class="hfx-link-double-underline" href="#">Press and media</a>
.hfx-link-double-underline {
--c: var(--hfx-color, #3b82f6);
position: relative;
display: inline-block;
color: var(--c);
font: 600 calc(var(--hfx-size, 16px) * 1.25)/1.3 system-ui, sans-serif;
text-decoration: none;
color: inherit;
padding-bottom: 0.45em;
transition: color 0.3s ease;}
.hfx-link-double-underline::before,
.hfx-link-double-underline::after {
content: "";
position: absolute;
left: 0;
right: 0;
bottom: 0.3em;
height: 0.09em;
border-radius: 1em;
background: var(--c);
}
.hfx-link-double-underline::after {
transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
.hfx-link-double-underline:is(:hover, :focus-visible) { color: var(--c); }
.hfx-link-double-underline:is(:hover, :focus-visible)::after {
transform: translateY(0.24em);
opacity: 0.5;
}
@media (prefers-reduced-motion: reduce) {
.hfx-link-double-underline, .hfx-link-double-underline *, .hfx-link-double-underline::before, .hfx-link-double-underline::after, .hfx-link-double-underline *::before, .hfx-link-double-underline *::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.