CSS Honeycomb Pattern Background

A honeycomb pattern in pure CSS: hexagon cells outlined by thin lines, built from conic gradients with no images. Set cell size and line width live.

#4b9c41
#8fc188
80px
3px
.bg-honeycomb {
  --bg: #4b9c41;
  --fg: #8fc188;
  --size: 80px;
  --line: 3px;
  background-color: var(--fg);
  background-image:
    conic-gradient(from 270deg at var(--line) 33.333%, var(--fg) 90deg, transparent 0),
    conic-gradient(from 270deg at var(--line) 33.333%, var(--fg) 90deg, transparent 0),
    conic-gradient(from 120deg at 50% calc(66.667% + var(--line) * 0.577), var(--bg) 120deg, transparent 0),
    conic-gradient(from 120deg at 50% calc(66.667% + var(--line) * 0.577), var(--bg) 120deg, transparent 0),
    conic-gradient(from -60deg at 50% calc(33.333% - var(--line) * 0.577), var(--bg) 120deg, transparent 0),
    conic-gradient(from -60deg at 50% calc(33.333% - var(--line) * 0.577), var(--bg) 120deg, transparent 0);
  background-size: calc(round(calc(var(--size) * 0.2887), 1px) * 2) var(--size);
  background-position:
    calc(var(--line) / -2) calc(var(--size) / 3),
    calc(round(calc(var(--size) * 0.2887), 1px) - var(--line) / 2) calc(var(--size) * 5 / 6),
    0 calc(var(--size) / -2),
    round(calc(var(--size) * 0.2887), 1px) 0,
    0 calc(var(--size) / 2),
    round(calc(var(--size) * 0.2887), 1px) 0;
}
<div class="
  [--bg:#4b9c41]
  [--fg:#8fc188]
  [--size:80px]
  [--line:3px]
  [background-color:var(--fg)]
  [background-image:conic-gradient(from_270deg_at_var(--line)_33.333%,_var(--fg)_90deg,_transparent_0),_conic-gradient(from_270deg_at_var(--line)_33.333%,_var(--fg)_90deg,_transparent_0),_conic-gradient(from_120deg_at_50%_calc(66.667%_+_var(--line)_*_0.577),_var(--bg)_120deg,_transparent_0),_conic-gradient(from_120deg_at_50%_calc(66.667%_+_var(--line)_*_0.577),_var(--bg)_120deg,_transparent_0),_conic-gradient(from_-60deg_at_50%_calc(33.333%_-_var(--line)_*_0.577),_var(--bg)_120deg,_transparent_0),_conic-gradient(from_-60deg_at_50%_calc(33.333%_-_var(--line)_*_0.577),_var(--bg)_120deg,_transparent_0)]
  [background-size:calc(round(calc(var(--size)_*_0.2887),_1px)_*_2)_var(--size)]
  [background-position:calc(var(--line)_/_-2)_calc(var(--size)_/_3),_calc(round(calc(var(--size)_*_0.2887),_1px)_-_var(--line)_/_2)_calc(var(--size)_*_5_/_6),_0_calc(var(--size)_/_-2),_round(calc(var(--size)_*_0.2887),_1px)_0,_0_calc(var(--size)_/_2),_round(calc(var(--size)_*_0.2887),_1px)_0]
"></div>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Honeycomb — CSS background</title>
  <style>
    html, body { height: 100%; margin: 0; }
    .bg-honeycomb {
      --bg: #4b9c41;
      --fg: #8fc188;
      --size: 80px;
      --line: 3px;
      background-color: var(--fg);
      background-image:
        conic-gradient(from 270deg at var(--line) 33.333%, var(--fg) 90deg, transparent 0),
        conic-gradient(from 270deg at var(--line) 33.333%, var(--fg) 90deg, transparent 0),
        conic-gradient(from 120deg at 50% calc(66.667% + var(--line) * 0.577), var(--bg) 120deg, transparent 0),
        conic-gradient(from 120deg at 50% calc(66.667% + var(--line) * 0.577), var(--bg) 120deg, transparent 0),
        conic-gradient(from -60deg at 50% calc(33.333% - var(--line) * 0.577), var(--bg) 120deg, transparent 0),
        conic-gradient(from -60deg at 50% calc(33.333% - var(--line) * 0.577), var(--bg) 120deg, transparent 0);
      background-size: calc(round(calc(var(--size) * 0.2887), 1px) * 2) var(--size);
      background-position:
        calc(var(--line) / -2) calc(var(--size) / 3),
        calc(round(calc(var(--size) * 0.2887), 1px) - var(--line) / 2) calc(var(--size) * 5 / 6),
        0 calc(var(--size) / -2),
        round(calc(var(--size) * 0.2887), 1px) 0,
        0 calc(var(--size) / 2),
        round(calc(var(--size) * 0.2887), 1px) 0;
    }
  </style>
</head>
<body class="bg-honeycomb"></body>
</html>

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

Honeycomb 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 honeycomb pattern works

This honeycomb is a hexagon pattern made of filled cells, with the line color showing through the gaps between them. The background color is the line color (--fg), and each hexagon is painted on top in --bg.

A hexagon is a band with a pointed top and bottom. Each point is a 120° conic-gradient() wedge: a downward wedge fills the top half of a cell and an upward wedge fills the bottom half. Each layer is shifted so its tile edge cuts the wedge off at the cell’s middle. The wedge tips are pulled in by --line × 0.577, which leaves sloped gaps of exactly --line width. The same two layers, offset by half a tile, fill the next row. Two small conic rectangles draw the short vertical walls.

--size is the tile height, which is 1.5 hexagons tall. --line sets the wall thickness.

Use this CSS hexagon background for science and biotech pages, honey or nature brands, game boards and data-heavy dashboards.