This works similarly to the standard linear gradients as described by
, but it automatically repeats the color stops infinitely in both directions, with their positions shifted by multiples of the difference between the last color stop's position and the first one's position.
Like any other gradient, a repeating CSS linear gradient is not a CSS
<color> but an image with no intrinsic dimensions; that is, it has no natural or preferred size, nor ratio. Its concrete size will match the one of the element it applies to.
repeating-linear-gradient( [ [ <angle> | to <side-or-corner> ,]? <color-stop> [, <color-stop>]+ )
Vendor prefixes: See the compatibility table below for detail on the vendor prefixes you'll need to use for gradients.
- Represents the position of the starting-point of the gradient line. It consists of two keywords: the first one indicates the horizontal side,
right, and the second one the vertical side,
bottom. The order is not relevant and each of the keyword is optional.
to rightare translated into the angles
90degrespectively. The others are translated into an angle that let the starting-point to be in the same quadrant than the described corner and so that the line defined by the starting-point and the corner is perpendicular to the gradient line. That way, the color described by the
<color-stop>will exactly apply to the corner point. This is sometimes called the "magic corner" property. The end-point of the gradient line is the symmetrical point of the starting-point on the other direction of the center box.
- An angle of direction for the gradient. See
- This value is comprised of a
<color>value, followed by an optional stop position (either a percentage between 0% and 100% or a
<length>along the gradient axis).
Rendering of color-stops in CSS gradients follows the same rules as color-stops in SVG gradients.
background: repeating-linear-gradient(to bottom right, red, red 5px, white 5px, white 10px);
|CSS Image Value and Replaced Content Module Level 3||Candidate Recommendation|
|Feature||Firefox (Gecko)||Chrome||Internet Explorer||Opera||Safari|
|Basic support||3.6 (1.9.2) bug 479220 ||10.0 (534.16) ||10.0 ||11.10 ||5.1 |
|Legacy from syntax (without ||3.6 (1.9.2) ||10.0 (534.16)||10.0 ||11.10||5.1|
 Internet Explorer 5.5 through 8.0 supports proprietary
filter: progid:DXImageTransform.Microsoft.Gradient() filter.
 Firefox 3.6 implemented, prefixed, an early syntax where the starting corner or side was indicated without the
to keyword, and effectively considered as a from position. The
to syntax has been added in Firefox 10, without removing the deprecated syntax and translation between the two is trivial:
-moz-repeating-linear-gradient(to top left, blue, red); is the same as: -moz-repeating-linear-gradient(bottom right, blue, red);
The legacy syntax, without
to, is planned to go away when the prefix will be removed.
 Gecko, Opera & Webkit considers
to start to the right, instead of the top. I.e. it considered an angle of
0deg as a direction indicator pointing to the right. This is different from the latest specification where an angle of
0deg as a direction indicator points to the top.