Skip to content
UniKit

CSS stripe background generator

Generate horizontal, vertical, diagonal, checkerboard, grid, zigzag and soft repeating stripe backgrounds: 2–4 colours, stripe width and repeat period, angle and smooth transitions, with a live preview and ready-to-copy CSS.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Live preview

Stripe type

Colours

Enable a third colour

Stripe options

20px
40px

Minimum period:40px

45°
Smooth transition

Code

CSS
.stripes {
  background-image: repeating-linear-gradient(45deg, #1E3A8A 0px 20px, #60A5FA 20px 40px);
}

Checkerboard, grid and zigzag only use the first two colours (any extra colour is ignored) and take their sizes from "stripe width" and "grid line width"; horizontal and vertical stripes are locked to 180° / 90° and ignore the angle slider.

What this tool does

  • Decorate a page background: switch between horizontal, vertical, diagonal, checkerboard, grid, zigzag and soft stripes, tweak the colours and widths, then copy the CSS.
  • Build a warning or progress strip: pick diagonal, set the two colours to yellow and black and the width to 8–12px to get hazard tape.
  • Build graph-paper or tablecloth backgrounds: the grid type draws its lines with two perpendicular repeating gradients, so the base colour and the line colour are configured separately and the cell size comes from the stripe width.
  • Turn on "smooth transition" to soften the stripes: the hard stops become interpolated colour stops, which suits ribbons and metallic sheens.

Example

Input

Defaults: diagonal, colours #1E3A8A / #60A5FA, stripe width 20px, repeat period 40px, angle 45°, no smoothing

Output

.stripes {
  background-image: repeating-linear-gradient(45deg, #1E3A8A 0px 20px, #60A5FA 20px 40px);
}

The stops use the two-position syntax: `#1E3A8A 0px 20px` means the first colour fills 0–20px and `#60A5FA 20px 40px` means the second fills 20–40px, so the whole gradient repeats every 40px — the repeat period.

Frequently asked questions

What is the difference between stripe width and repeat period?

The stripe width is how much space each colour takes; the repeat period is the total length of one loop. With two colours, a width of 20px and a period of 40px the bands meet exactly; raise the period to 60px and the second colour stretches from 20px to 60px (the extra space stays the last colour). The period can never be shorter than colours × stripe width.

What about browser support?

repeating-linear-gradient works from IE10 / Chrome 26 / Safari 6.1, so horizontal, vertical, diagonal and soft stripes are safe everywhere. The checkerboard uses repeating-conic-gradient (Chrome 69+, Safari 12.1+, Firefox 83+); without support the background degrades to nothing, so pair it with a background-color. The zigzag uses four ordinary linear-gradients, the same support as repeating gradients.

Why do checkerboard, grid and zigzag only use two colours?

Those patterns rely on transparency layered over the background, so extra colours have no defined place to go. The tool takes the first two colours and ignores the rest; only the linear types cycle through 2–4 colours.

Why does the angle slider do nothing for horizontal and vertical stripes?

Horizontal stripes are fixed at 180deg (bands stacked vertically) and vertical stripes at 90deg — that is what those types mean. For an arbitrary angle pick diagonal or soft stripes, where the angle is normalised into 0–360 (so -45° is emitted as 315deg).

How does smoothing differ from hard-edged stripes?

Hard edges use two-position stops (`colour start end`) so neighbouring colours switch abruptly. With smoothing the stops become single positions (`colour position`) and the browser interpolates linearly between them before returning to the first colour, giving a ribbon effect. The soft stripe type always uses smooth stops.

Can dense stripes hurt performance?

Repeating gradients are painted natively by the browser and are normally cheap, but a 1–2px stripe tiled across a full screen can produce moiré (visible wave interference) in some browsers while scrolling or zooming. Increasing the width or using an image is safer at that density.

Keywords:repeating-linear-gradientzigzag

Related tools