# Hue Rotate Gradient

> A gradient that cycles through every hue using a hue-rotate filter on a layer behind the content.

- Category: [CSS Gradients & Patterns](https://copy-css.com/category/gradients)
- Tags: animated, color cycle, filter, rainbow, background
- Live preview: https://copy-css.com/snippets/hue-rotate-gradient
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="gradient-hue"></div>
```

## CSS

```css
.gradient-hue {
  position: relative;
  isolation: isolate;
}

/* The filter sits on its own layer so text inside is not recolored */
.gradient-hue::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(135deg, #f43f5e, #f59e0b);
  animation: gradient-hue-cycle 12s linear infinite;
}

@keyframes gradient-hue-cycle {
  to { filter: hue-rotate(1turn); }
}

@media (prefers-reduced-motion: reduce) {
  .gradient-hue::before { animation: none; }
}
```

## Notes

- This CSS Hue Rotate Gradient is 22 lines of pure CSS (0.5 KB) with no JavaScript and no dependencies. It uses keyframe animations, linear gradients, filters and reduced-motion support.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
