# Wiggle on Hover

> A playful wiggle you can add to any icon or badge with one class, triggered on hover and keyboard focus.

- Category: [CSS Effects](https://copy-css.com/category/effects)
- Tags: wiggle, shake, hover, icon, attention, keyframes
- Live preview: https://copy-css.com/snippets/wiggle-on-hover
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<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>
```

## CSS

```css
.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;
  }
}
```

## Notes

- 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.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
