A thick accent bar slides up into the bottom edge of a tinted button, the way a tab marks itself active. Move the bar to the top edge and flip the direction for Hover.css Overline Reveal.
Also known as: hvr-underline-reveal, button bottom border hover, overline reveal hover.
<button class="hfx-underline-reveal">See pricing</button>
.hfx-underline-reveal {
--c: var(--hfx-color, #3b82f6);
display: inline-flex;
align-items: center;
gap: 0.5em;
padding: 0.7em 1.6em;
border-radius: 0.5em;
font: 600 var(--hfx-size, 16px) system-ui, sans-serif;
cursor: pointer;
position: relative;
overflow: hidden;
border: 0;
background: color-mix(in srgb, var(--c) 12%, transparent);
color: var(--c);
transition: background-color 0.3s ease;}
.hfx-underline-reveal::before {
content: "";
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 0.24em;
background: var(--c);
transform: translateY(100%);
transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.hfx-underline-reveal:is(:hover, :focus-visible) {
background: color-mix(in srgb, var(--c) 18%, transparent);
}
.hfx-underline-reveal:is(:hover, :focus-visible)::before {
transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
.hfx-underline-reveal, .hfx-underline-reveal *, .hfx-underline-reveal::before, .hfx-underline-reveal::after, .hfx-underline-reveal *::before, .hfx-underline-reveal *::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.