CSS Linen Texture Background

A linen texture in pure CSS, no image: fine woven threads plus a few thicker, uneven ones, from six repeating linear gradients. Pick the two colors and copy it.

#f09f33
#f6c380
.bg-linen {
  --bg: #f09f33;
  --fg: #f6c380;
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--fg) 35%, transparent) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--fg) 35%, transparent) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--fg) 30%, transparent) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--fg) 30%, transparent) 0 2px, transparent 2px 11px),
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--fg) 25%, transparent) 0 2px, transparent 2px 17px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--fg) 20%, transparent) 0 1px, transparent 1px 23px);
}
<div class="
  [--bg:#f09f33]
  [--fg:#f6c380]
  [background-color:var(--bg)]
  [background-image:repeating-linear-gradient(0deg,_color-mix(in_srgb,_var(--fg)_35%,_transparent)_0_1px,_transparent_1px_3px),_repeating-linear-gradient(90deg,_color-mix(in_srgb,_var(--fg)_35%,_transparent)_0_1px,_transparent_1px_3px),_repeating-linear-gradient(0deg,_color-mix(in_srgb,_var(--fg)_30%,_transparent)_0_1px,_transparent_1px_7px),_repeating-linear-gradient(90deg,_color-mix(in_srgb,_var(--fg)_30%,_transparent)_0_2px,_transparent_2px_11px),_repeating-linear-gradient(0deg,_color-mix(in_srgb,_var(--fg)_25%,_transparent)_0_2px,_transparent_2px_17px),_repeating-linear-gradient(90deg,_color-mix(in_srgb,_var(--fg)_20%,_transparent)_0_1px,_transparent_1px_23px)]
"></div>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Linen — CSS background</title>
  <style>
    html, body { height: 100%; margin: 0; }
    .bg-linen {
      --bg: #f09f33;
      --fg: #f6c380;
      background-color: var(--bg);
      background-image:
        repeating-linear-gradient(0deg, color-mix(in srgb, var(--fg) 35%, transparent) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(90deg, color-mix(in srgb, var(--fg) 35%, transparent) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(0deg, color-mix(in srgb, var(--fg) 30%, transparent) 0 1px, transparent 1px 7px),
        repeating-linear-gradient(90deg, color-mix(in srgb, var(--fg) 30%, transparent) 0 2px, transparent 2px 11px),
        repeating-linear-gradient(0deg, color-mix(in srgb, var(--fg) 25%, transparent) 0 2px, transparent 2px 17px),
        repeating-linear-gradient(90deg, color-mix(in srgb, var(--fg) 20%, transparent) 0 1px, transparent 1px 23px);
    }
  </style>
</head>
<body class="bg-linen"></body>
</html>

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

Linen 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 linen pattern works

Linen is a fine weave with a few slubs: threads that are thicker or darker than the rest. This version builds that from six repeating-linear-gradient() layers, three running across (0deg) and three running down (90deg).

The first two layers are the base weave, a 1px thread every 3px in both directions, at 35% strength of --fg. The other four add irregular threads on longer cycles of 7, 11, 17 and 23 pixels. Those numbers share no common factor, so the thick threads drift in and out of step with each other and the texture never looks like a plain grid.

Every thread is a see-through color-mix() of --fg, so where threads cross they stack and get a little stronger, like real cloth. The pattern has no size control because the thread spacing is the texture. Change the two colors for natural, grey or dark linen.

Use this CSS linen texture behind wedding and stationery sites, home and fashion brands, recipe pages and soft section backgrounds.