CSS Chevron Background

A chevron pattern in pure CSS: V-shaped stripes in alternating shades, a wide band, a thin band and a gap, from stacked zigzag gradients. Set the size live.

#cc3f47
#df878c
48px
.bg-chevron {
  --bg: #cc3f47;
  --fg: #df878c;
  --size: 48px;
  background-color: var(--fg);
  background-image:
    linear-gradient(135deg, var(--bg) 25%, transparent 25%),
    linear-gradient(225deg, var(--bg) 25%, transparent 25%),
    linear-gradient(315deg, var(--bg) 25%, transparent 25%),
    linear-gradient(45deg, var(--bg) 25%, transparent 25%),
    linear-gradient(135deg, color-mix(in srgb, var(--fg) 50%, var(--bg)) 25%, transparent 25%),
    linear-gradient(225deg, color-mix(in srgb, var(--fg) 50%, var(--bg)) 25%, transparent 25%),
    linear-gradient(315deg, color-mix(in srgb, var(--fg) 50%, var(--bg)) 25%, transparent 25%),
    linear-gradient(45deg, color-mix(in srgb, var(--fg) 50%, var(--bg)) 25%, transparent 25%);
  background-size: var(--size) var(--size);
  background-position:
    calc(var(--size) / -2) 0,
    calc(var(--size) / -2) 0,
    0 0,
    0 0,
    calc(var(--size) / -2) calc(var(--size) / 4),
    calc(var(--size) / -2) calc(var(--size) / 4),
    0 calc(var(--size) / 4),
    0 calc(var(--size) / 4);
}
<div class="
  [--bg:#cc3f47]
  [--fg:#df878c]
  [--size:48px]
  [background-color:var(--fg)]
  [background-image:linear-gradient(135deg,_var(--bg)_25%,_transparent_25%),_linear-gradient(225deg,_var(--bg)_25%,_transparent_25%),_linear-gradient(315deg,_var(--bg)_25%,_transparent_25%),_linear-gradient(45deg,_var(--bg)_25%,_transparent_25%),_linear-gradient(135deg,_color-mix(in_srgb,_var(--fg)_50%,_var(--bg))_25%,_transparent_25%),_linear-gradient(225deg,_color-mix(in_srgb,_var(--fg)_50%,_var(--bg))_25%,_transparent_25%),_linear-gradient(315deg,_color-mix(in_srgb,_var(--fg)_50%,_var(--bg))_25%,_transparent_25%),_linear-gradient(45deg,_color-mix(in_srgb,_var(--fg)_50%,_var(--bg))_25%,_transparent_25%)]
  [background-size:var(--size)_var(--size)]
  [background-position:calc(var(--size)_/_-2)_0,_calc(var(--size)_/_-2)_0,_0_0,_0_0,_calc(var(--size)_/_-2)_calc(var(--size)_/_4),_calc(var(--size)_/_-2)_calc(var(--size)_/_4),_0_calc(var(--size)_/_4),_0_calc(var(--size)_/_4)]
"></div>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Chevron — CSS background</title>
  <style>
    html, body { height: 100%; margin: 0; }
    .bg-chevron {
      --bg: #cc3f47;
      --fg: #df878c;
      --size: 48px;
      background-color: var(--fg);
      background-image:
        linear-gradient(135deg, var(--bg) 25%, transparent 25%),
        linear-gradient(225deg, var(--bg) 25%, transparent 25%),
        linear-gradient(315deg, var(--bg) 25%, transparent 25%),
        linear-gradient(45deg, var(--bg) 25%, transparent 25%),
        linear-gradient(135deg, color-mix(in srgb, var(--fg) 50%, var(--bg)) 25%, transparent 25%),
        linear-gradient(225deg, color-mix(in srgb, var(--fg) 50%, var(--bg)) 25%, transparent 25%),
        linear-gradient(315deg, color-mix(in srgb, var(--fg) 50%, var(--bg)) 25%, transparent 25%),
        linear-gradient(45deg, color-mix(in srgb, var(--fg) 50%, var(--bg)) 25%, transparent 25%);
      background-size: var(--size) var(--size);
      background-position:
        calc(var(--size) / -2) 0,
        calc(var(--size) / -2) 0,
        0 0,
        0 0,
        calc(var(--size) / -2) calc(var(--size) / 4),
        calc(var(--size) / -2) calc(var(--size) / 4),
        0 calc(var(--size) / 4),
        0 calc(var(--size) / 4);
    }
  </style>
</head>
<body class="bg-chevron"></body>
</html>

Save the pattern as an image, with your current colors and settings.

Chevron in other colors

Click a color to try it in the preview above, then copy the code.

Browse by color: Red · Orange · Yellow · Green · Teal · Blue · Purple · Pink

How the chevron pattern works

A chevron pattern is rows of V-shaped stripes. This one alternates three shades: a wide band of --bg, a thinner band that’s a 50/50 color-mix() of the two colors, and a thin line of --fg.

Each set of chevrons comes from the zigzag trick. Four linear-gradient() layers at 45°, 135°, 225° and 315° each paint one corner triangle of the tile, and two of them are shifted half a tile sideways. Together the triangles join into a continuous zigzag band half a tile tall.

The pattern stacks two of those zigzags. The top four layers draw the --bg band. The bottom four draw the same zigzag in the mixed shade, shifted down a quarter tile, so only its lower edge peeks out below the top band. The background color --fg fills the rest, which leaves a thin light line in every chevron.

--size sets the width of each V. Use chevrons for kids’ and nursery designs, retro and sporty themes, and bold section backgrounds.