Figma plugin liveInstall

GradientLab field guide

CSS vs WebGL Gradients: Which Should You Use?

A gradient does not need a shader just because it moves. Start with the simplest rendering method that can produce the design you need, then choose how the result will reach your audience.

Use CSS for simple fills and lightweight interfaces

CSS linear-gradient(), radial-gradient(), and conic-gradient() are good starting points for buttons, cards, text treatments, and page backgrounds. They need no image download and scale with the element. Use multiple background layers when a single transition is not enough.

CSS can also produce motion. Moving or transforming a gradient-bearing element can create a slow ambient background. Performance depends on the properties you animate and the area being painted; CSS is not automatically free to render. Test on a phone, not just a desktop browser.

Choose this route when your design is primarily a color transition and you want the result to live directly in your stylesheet. GradientLab’s shader effects are not exported as equivalent CSS declarations.

Use a WebGL shader for procedural shape and surface

A fragment shader computes pixel colors on the GPU. Its inputs can include coordinates, time, color stops, and effect parameters. That makes it useful for warped fields, procedural grain, reflective-looking materials, and motion that changes the field itself rather than sliding a flat layer.

In GradientLab, begin with a gradient type, set the palette, and then add a warp or material. A wave changes the field’s geometry; a metallic or iridescent treatment changes its appearance. Adjust one effect at a time so you can understand what each layer contributes.

WebGL is a rendering technique, not a performance guarantee. Canvas resolution, device pixel ratio, effect complexity, and simultaneous animations all affect cost. A full-screen shader behind a busy interface deserves testing on a lower-powered device.

Use exported video when you need fixed, repeatable motion

A shader can be the authoring tool without being the delivery format. Export a finished animation when the background does not need to respond to its viewer. This preserves the appearance of a complex effect without running that effect as a live shader on the destination page.

Video trades shader computation for download size and video decoding. Start with MP4 for broad compatibility; consider WebM as an additional source after checking your target browsers. A short, carefully sized loop is usually a better starting point than a long 4K background. GIF is convenient in some workflows, but should not be the default for a full-width website hero.

Match the method to the actual requirement

For a card fill, start with CSS. For a fixed cinematic hero, try exported video with a still poster. For a procedural field whose parameters must change live, evaluate WebGL. For an email, use a still image and test the result in your target email clients.

Whichever method you choose, keep headings and calls to action as HTML above the artwork. Check text contrast against the brightest and darkest frames, provide a reduced-motion alternative, and reserve the background’s dimensions so the layout does not jump.