A lip of wet paint with a few drips hangs from the top edge; on hover the paint pours down and fills the button. Drips and sags are gradient layers on one pseudo-element that only moves.
Also known as: dripping paint hover, melting fill button, drip effect css.
<button class="hfx-paint-drip">Start a project</button>
.hfx-paint-drip {
--c: var(--hfx-color, #3b82f6);
position: relative;
isolation: isolate;
overflow: hidden;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5em;
padding: 0.75em 1.75em;
border-radius: 0.5em;
font: 600 var(--hfx-size, 16px)/1.2 system-ui, sans-serif;
white-space: nowrap;
cursor: pointer;
border: 2px solid var(--c);
background: transparent;
color: var(--c);
transition: color 0.3s ease 0.15s;
}
.hfx-paint-drip::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: -1;
height: calc(100% + 1em);
background:
linear-gradient(var(--c) 0 0) 0 0 / 100% calc(100% - 1em),
radial-gradient(closest-side, var(--c) 96%, transparent) left 24% bottom 0.82em / 2em 0.36em,
radial-gradient(closest-side, var(--c) 96%, transparent) left 52% bottom 0.87em / 1.3em 0.26em,
radial-gradient(closest-side, var(--c) 96%, transparent) left 76% bottom 0.8em / 2.2em 0.4em,
linear-gradient(var(--c) 0 0) 7% 0 / 0.5em calc(100% - 0.4em),
radial-gradient(closest-side, var(--c) 96%, transparent) left 7% bottom 0.15em / 0.5em 0.5em,
linear-gradient(var(--c) 0 0) 38% 0 / 0.34em calc(100% - 0.79em),
radial-gradient(closest-side, var(--c) 96%, transparent) left 38% bottom 0.62em / 0.34em 0.34em,
linear-gradient(var(--c) 0 0) 92% 0 / 0.42em calc(100% - 0.61em),
radial-gradient(closest-side, var(--c) 96%, transparent) left 92% bottom 0.4em / 0.42em 0.42em;
background-repeat: no-repeat;
transform: translateY(calc(-100% + 1.3em));
transition: transform 0.6s cubic-bezier(0.55, 0, 0.25, 1);
}
.hfx-paint-drip:is(:hover, :focus-visible) {
background-color: var(--c); /* hides the hairline where the fill meets the border */
color: #fff;
transition: color 0.3s ease 0.15s, background-color 0s 0.6s;
}
.hfx-paint-drip:is(:hover, :focus-visible)::before { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
.hfx-paint-drip, .hfx-paint-drip *, .hfx-paint-drip::before, .hfx-paint-drip::after, .hfx-paint-drip *::before, .hfx-paint-drip *::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.