AI CSS Animations

CSS Animated Backgrounds

90 pure CSS animated backgrounds: moving gradients, aurora, mesh gradients, waves, starfields, particles and grids. Each one is a single layer you drop into a hero or section, with no canvas and no JavaScript.

How to use these animated backgrounds

Each background is one element that fills its container. Give your hero or section position: relative, put the background element inside it as the first child, and lift your content above it with position: relative; z-index: 1. For a full-page background, use position: fixed on the layer instead.

To change the accent color, set --bgx-color. To change the scale of the pattern (stars, grid cells, blobs, waves), set --bgx-size: everything inside is in em. Keep text contrast in mind on busy backgrounds.

Every snippet ships with a prefers-reduced-motion rule that freezes the background for people who asked their OS for less motion. The layers animate transform, opacity and background-position, which stay smooth on large areas.

Frequently asked questions

How do I make an animated background with only CSS?

Put an oversized gradient or a few layered pseudo-elements behind your content and animate background-position or transform with @keyframes. No canvas or JavaScript is needed.

How do I animate a gradient background?

Either animate background-position on a gradient with background-size: 400%, or register the colors or angle with @property so the gradient itself can animate.

Do animated backgrounds hurt performance?

They can. Prefer animating transform and opacity on a few layers, keep large blur() areas to a minimum, and honor prefers-reduced-motion. The backgrounds here follow those rules.

How do I use it as a full-page or hero background?

Put the layer inside the hero with the hero set to position: relative, or on a position: fixed; inset: 0; z-index: -1 element for the whole page, so your content stays on top.

Can I make a moving stars or particles background without JavaScript?

Yes. Draw many dots with one element's box-shadow list or with repeating radial gradients, then move the layer in a loop. The space and particle entries above work that way.