A glossy candy button that wobbles like jelly on hover, skewing left and right with each swing smaller than the last. The keyframe stops match Hover.css Wobble Skew, on a button that suits the motion.
Also known as: hvr-wobble-skew, jello button hover, jelly wobble css.
<button class="hfx-wobble-skew">Join the party</button>
.hfx-wobble-skew {
--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;
border: 0;
border-radius: 0.8em;
background: linear-gradient(color-mix(in srgb, var(--c) 78%, #fff), var(--c) 55%);
color: #fff;
box-shadow: inset 0 0.15em 0 rgb(255 255 255 / 0.35), 0 0.35em 0.8em -0.35em color-mix(in srgb, var(--c) 70%, transparent);
text-shadow: 0 1px 1px color-mix(in srgb, var(--c) 60%, #000);}
.hfx-wobble-skew:is(:hover, :focus-visible) {
animation: hfx-wobble-skew-jelly 1s ease-in-out;
}
@keyframes hfx-wobble-skew-jelly {
16% { transform: skewX(-12deg); }
33% { transform: skewX(10deg); }
50% { transform: skewX(-6deg); }
66% { transform: skewX(4deg); }
83% { transform: skewX(-2deg); }
}
@media (prefers-reduced-motion: reduce) {
.hfx-wobble-skew, .hfx-wobble-skew *, .hfx-wobble-skew::before, .hfx-wobble-skew::after, .hfx-wobble-skew *::before, .hfx-wobble-skew *::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.