CSS Wiggle on Hover
A playful wiggle you can add to any icon or badge with one class, triggered on hover and keyboard focus.
<a class="wiggle-link" href="#">
<svg class="wiggle" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="8" width="18" height="13" rx="2"/><path d="M12 8v13M3 12h18M12 8S10 3 7.5 4 8 8 12 8m0 0s2-5 4.5-4S16 8 12 8"/></svg>
Claim your gift
</a>
.wiggle-link {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 12px 18px;
border-radius: 12px;
background: #fff;
box-shadow: 0 4px 14px -6px rgba(190, 24, 93, 0.35);
color: #9d174d;
font: 700 15px system-ui, sans-serif;
text-decoration: none;
}
.wiggle-link svg {
width: 26px;
height: 26px;
fill: #fce7f3;
stroke: #db2777;
stroke-width: 1.8;
stroke-linejoin: round;
}
.wiggle-link:hover .wiggle,
.wiggle-link:focus-visible .wiggle {
animation: wiggle-shake 0.6s ease-in-out;
}
.wiggle-link:focus-visible {
outline: 2px solid #db2777;
outline-offset: 3px;
}
@keyframes wiggle-shake {
0%, 100% { transform: rotate(0); }
20% { transform: rotate(-14deg); }
40% { transform: rotate(12deg); }
60% { transform: rotate(-8deg); }
80% { transform: rotate(4deg); }
}
@media (prefers-reduced-motion: reduce) {
.wiggle-link:hover .wiggle,
.wiggle-link:focus-visible .wiggle {
animation: none;
}
}
About this CSS Wiggle on Hover
This CSS Wiggle on Hover is 46 lines of pure CSS (0.9 KB) with no JavaScript and no dependencies. It uses keyframe animations, transforms, box shadows and Flexbox. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
CSS features used
Customize it
The colors in this snippet. Search and replace them to match your brand:
#fff#9d174d#fce7f3#db2777
How to use this wiggle on hover
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.wiggle-linkclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.