Skip to content
Visual CSS Tools logo visual.css.toolsGradient studio Open the editor
Reference

A complete guide to the gradient editor

Everything the generator can do, explained in the order you will use it. Start with a type, shape the fill, tune the stops, then take the code.

Overview

The editor turns a set of color stops and a direction or shape into a gradient. It writes CSS, SVG, and Canvas output from the same values, so you can move between formats without rebuilding the gradient.

The preview and the code share one state. Change a color, a position, or an angle, and both update together.

Who this is for

Visual CSS Generator is built for generating CSS3, Canvas, and SVG code for every linear and radial gradient, so it targets modern browsers including IE9. It can also generate code for the old Webkit syntax.

Before IE9, use a fallback. For IE8, include the generated inline PNG data URL in your CSS. For IE7 and lower, save the generated Canvas image as a PNG file.

Getting started

Type a value directly, or use the arrow keys, the mouse wheel, or the arrows beside a field. Hover between the arrows, click, and drag up or down. Hold Shift to move sideways and Control to reverse the direction.

The gear icon sets precision. Valid values include 100, 10, 1, 0.1, and 0.01. The choices depend on the unit or angle that is being edited.

Use the output buttons to change the rendered preview. Legacy is enabled only in Webkit based browsers such as Chrome or Safari. Hover any control to see a short tooltip.

If you have a feature suggestion, send a note to the address on the contact section of the home page.

Linear gradients

A linear gradient moves along a line. Set the line with a direction keyword such as to left top, or with an angle in degrees. Zero degrees points to the top, 90 to the right, 180 to the bottom, and 270 to the left.

The editor converts a keyword to its computed angle, and an angle back to the nearest keyword. The direction pad gives you the eight standard directions as a shortcut.

Radial gradients

A radial gradient spreads from a center point. Choose a circle or an ellipse, then pick an extent keyword: near side, near corner, far side, or far corner. Set the center with horizontal and vertical position keywords.

The editor converts an extent keyword and shape, such as far corner circle, into a computed size. It also converts a position keyword such as top left into a computed position.

For an exact size, enter a width and height in the radial panel. When both are filled, they override the extent keyword.

Color stops

Each stop has a color and a position. Add, remove, and sort stops from the stop panel. Select a stop to edit it in the color editor, where you can set a hex value, an alpha value, or red, green, and blue channels.

All positions in one gradient must use the same unit type. Available units are percent, px, pc, pt, mm, cm, and in. The preview and the code stay in sync as you type.

Choose the position unit from the stop panel. Switching units converts the existing positions so the gradient keeps its shape.

Alpha values below one are written as rgba in CSS so the backdrop shows through.

Output formats

CSS

The CSS tab returns a background image declaration. Repeating gradients use the native repeating keyword.

SVG

The SVG tab returns a standalone SVG document with a linear or radial gradient definition. Repeating gradients use the native repeat spread.

Canvas

The Canvas tab returns a short JavaScript snippet that paints the gradient on a 2D context. Use Download PNG to save the result.

Legacy

The Legacy tab returns the old Webkit syntax, followed by the standard property as a fallback.

Import

Paste a standard CSS gradient into the import dialog. Angle, shape, position, and color stops are read back into the controls.

Limitations

  • Values cannot use em or ex units.
  • All color stop positions must share one unit type, such as percent, px, pc, pt, mm, cm, or in.
  • The old Webkit radial syntax cannot express an elliptical gradient, so elliptical gradients render as circles there.

Browser notes

Some older browser versions could not render a CSS radial gradient whose size is set explicitly as a width and height. If a gradient looks different in an older engine, use SVG or Canvas output when you need an exact size.

Small differences between CSS and SVG or Canvas rendering are normal, because engines compute gradients in different ways. If a difference looks wrong across browsers, send the CSS code to the contact address.

Troubleshooting

  • If a stop looks wrong, check its position and its unit type first.
  • If the preview is blank, confirm the preview target is set to CSS or SVG.
  • If legacy output is unavailable, your browser is not Webkit based.
  • If an import fails, check that the pasted value uses standard CSS gradient syntax.

References

These references cover the standards and tools behind the editor.

Ready

Try it on your own gradient

The editor opens with a default gradient. Change one stop and watch the code update.

Start the generator