# Animated Waves

> Layered SVG waves rolling along the bottom of a hero section at different speeds, all in background layers.

- Category: [CSS Effects](https://copy-css.com/category/effects)
- Tags: waves, svg background, hero, ocean, layered, animation
- Live preview: https://copy-css.com/snippets/animated-waves
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="wave-hero">
  <h3>Ride the wave</h3>
</div>
```

## CSS

```css
.wave-hero {
  position: relative;
  display: grid;
  place-items: center;
  width: 280px;
  height: 160px;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(180deg, #0ea5e9, #1e3a8a);
  color: #fff;
  font-family: system-ui, sans-serif;
}

.wave-hero h3 {
  position: relative;
  z-index: 1;
  margin: 0 0 30px;
  font-size: 22px;
}

.wave-hero::before,
.wave-hero::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 50px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 60' preserveAspectRatio='none'%3E%3Cpath d='M0 30 Q100 0 200 30 T400 30 V60 H0Z' fill='%23fff'/%3E%3C/svg%3E") repeat-x 0 100% / 200px 100%;
  animation: wave-hero-roll 6s linear infinite;
}

.wave-hero::before {
  height: 60px;
  opacity: 0.35;
  animation-duration: 9s;
  animation-direction: reverse;
}

.wave-hero::after {
  opacity: 0.8;
}

@keyframes wave-hero-roll {
  to {
    background-position-x: 200px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wave-hero::before,
  .wave-hero::after {
    animation: none;
  }
}
```

## Notes

- This CSS Animated Waves is 55 lines of pure CSS (1.1 KB) with no JavaScript and no dependencies. It uses keyframe animations, linear gradients, CSS Grid and reduced-motion support.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
