CSS repeating-linear-gradient() Function

❮ Previous Functions Next ❯


div {
  background-image: repeating-linear-gradient(-45deg, transparent, transparent 20px, black 20px, black 40px);


The repeating-linear-gradient() css function creates an image consisting of repeating linear gradients.

It is similar to linear-gradient() and takes the same arguments, but it repeats the color stops infinitely in all directions so as to cover its entire container.

Version: CSS3

Standard Syntax

repeating-linear-gradient(angle | to side-or-corner, colorStop1, colorStop2, ...)

Browser Support

The numbers in the table specify the first browser version that fully supports the property.


Function Arguments

The following table describes the arguments of this function.

Argument Description
angle Default value is 180deg. Defines an angle of direction for the gradient. From 0deg to 360deg.
side-or-corner Defines the position of the starting-point of the gradient line. It consists of two keywords: the first one indicates the horizontal side, left or right, and the second one the vertical side, top or bottom. The order is not relevant and each of the keyword is optional.
colorStop1, colorStop2,... Color stops are the colors you want to render smooth transitions among. This value consists of a color value, followed by an optional stop position (a percentage between 0% and 100% or a length along the gradient axis).

More Example

The following example uses repeating-radial-gradient() to create a gradient that radiates repeatedly from a central point.

The colors get cycled over and over as the gradient repeats.


div {
  height: 200px;
  width: 200px;
  background: repeating-radial-gradient(black, black 5px, white 5px, white 10px);
❮ Previous Functions Next ❯