# Animated Gradient Button

> A pill button whose multi-color gradient drifts slowly and speeds up when you hover it.

- Category: [CSS Buttons](https://copy-css.com/category/buttons)
- Tags: moving, background-position, colorful, cta, hover
- Live preview: https://copy-css.com/snippets/animated-gradient-button
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<button class="btn-shift">Start creating</button>
```

## CSS

```css
.btn-shift {
  padding: 14px 32px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #c2410c, #db2777, #7c3aed, #c2410c);
  background-size: 300% 100%;
  color: #fff;
  font: 600 16px/1 system-ui, sans-serif;
  cursor: pointer;
  animation: btn-shift-move 8s linear infinite;
}

.btn-shift:hover {
  animation-duration: 2.5s;
}

.btn-shift:focus-visible {
  outline: 3px solid #7c3aed;
  outline-offset: 3px;
}

@keyframes btn-shift-move {
  to { background-position: 300% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-shift { animation: none; }
}
```

## Notes

- This CSS Animated Gradient Button is 28 lines of pure CSS (0.6 KB) with no JavaScript and no dependencies. It uses keyframe animations, linear gradients, keyboard focus styles and reduced-motion support.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
