Hollow outlined letters fill with liquid on hover, a rippling wave line rising to the top. A registered @property carries the level, so the fill height transitions smoothly.
Also known as: water fill text, outline text fill on hover, wave fill text css.
<div class="hfx-text-liquid-fill">Water</div>
@property --hfx-text-liquid-fill-level {
syntax: "<length-percentage>";
inherits: false;
initial-value: 0%;
}
.hfx-text-liquid-fill {
--c: var(--hfx-color, #3b82f6);
font-size: calc(var(--hfx-size, 16px) * 2.5);
font-family: system-ui, sans-serif;
font-weight: 800;
line-height: 1.15;
cursor: default;
display: inline-block;
font-family: "Arial Black", Arial, sans-serif;
font-weight: 900;
-webkit-text-fill-color: transparent;
-webkit-text-stroke: 0.035em var(--c);
background:
radial-gradient(0.34em 0.2em at 50% 100%, var(--c) 96%, transparent)
left 0 bottom var(--hfx-text-liquid-fill-level) / 0.6em 0.2em repeat-x,
linear-gradient(var(--c), var(--c))
left 0 bottom 0 / 100% var(--hfx-text-liquid-fill-level) no-repeat;
-webkit-background-clip: text;
background-clip: text;
transition: --hfx-text-liquid-fill-level 1s cubic-bezier(0.45, 0, 0.2, 1);}
.hfx-text-liquid-fill:hover {
--hfx-text-liquid-fill-level: 110%;
animation: hfx-text-liquid-fill-flow 0.9s linear infinite;
}
@keyframes hfx-text-liquid-fill-flow {
to { background-position-x: 0.6em, 0; }
}
@media (prefers-reduced-motion: reduce) {
.hfx-text-liquid-fill, .hfx-text-liquid-fill *, .hfx-text-liquid-fill::before, .hfx-text-liquid-fill::after, .hfx-text-liquid-fill *::before, .hfx-text-liquid-fill *::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.