Gradients

Syntax

Define your gradients


There are two main types of gradients:


Linear Gradients

General:

Syntax:

Example:

.gradient {
    /* Fallback for browsers that don't support gradients */
    background: red;

    /* Standard syntax */
    background-image: linear-gradient(red, yellow);
    // Or shorthand
    background: linear-gradient(red, yellow);
}

Radial Gradients

The syntax is similar to that for linear gradients, except you can specify the gradient's ending shape (whether it should be a circle or ellipse) as well as its size. By default, the ending shape is an ellipse with the same proportions than the container's box.

Syntax:

Example:

.gradient {
    /* Fallback for browsers that don't support gradients */
    background: red;

    /* Standard syntax */
    background-image: radial-gradient(red, yellow, rgb(30, 144, 255));
    // Or shorthand
    background: radial-gradient(red, yellow, rgb(30, 144, 255));
}