CSS Animated Waves
Layered SVG waves rolling along the bottom of a hero section at different speeds, all in background layers.
Ride the wave
<div class="wave-hero">
<h3>Ride the wave</h3>
</div>
.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;
}
}
About this CSS Animated Waves
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. 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:
#0ea5e9#1e3a8a#fff
How to use this animated waves
- 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
.wave-heroclass 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.