CSS Brick Pattern Background
A brick wall background in pure CSS: mortar lines and offset rows from three gradients. Set the brick size and mortar width live, then copy the CSS or Tailwind.
.bg-bricks {
--bg: #167364;
--fg: #6da89e;
--size: 64px;
--line: 3px;
background-color: var(--bg);
background-image:
linear-gradient(var(--fg) var(--line), transparent 0),
conic-gradient(at var(--line) 50%, transparent 75%, var(--fg) 0),
conic-gradient(at var(--line) 50%, transparent 75%, var(--fg) 0);
background-size: var(--size) calc(var(--size) / 2), var(--size) var(--size), var(--size) var(--size);
background-position: 0 0, 0 0, calc(var(--size) / 2) calc(var(--size) / 2);
}<div class="
[--bg:#167364]
[--fg:#6da89e]
[--size:64px]
[--line:3px]
[background-color:var(--bg)]
[background-image:linear-gradient(var(--fg)_var(--line),_transparent_0),_conic-gradient(at_var(--line)_50%,_transparent_75%,_var(--fg)_0),_conic-gradient(at_var(--line)_50%,_transparent_75%,_var(--fg)_0)]
[background-size:var(--size)_calc(var(--size)_/_2),_var(--size)_var(--size),_var(--size)_var(--size)]
[background-position:0_0,_0_0,_calc(var(--size)_/_2)_calc(var(--size)_/_2)]
"></div><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bricks — CSS background</title>
<style>
html, body { height: 100%; margin: 0; }
.bg-bricks {
--bg: #167364;
--fg: #6da89e;
--size: 64px;
--line: 3px;
background-color: var(--bg);
background-image:
linear-gradient(var(--fg) var(--line), transparent 0),
conic-gradient(at var(--line) 50%, transparent 75%, var(--fg) 0),
conic-gradient(at var(--line) 50%, transparent 75%, var(--fg) 0);
background-size: var(--size) calc(var(--size) / 2), var(--size) var(--size), var(--size) var(--size);
background-position: 0 0, 0 0, calc(var(--size) / 2) calc(var(--size) / 2);
}
</style>
</head>
<body class="bg-bricks"></body>
</html>Save the pattern as an image, with your current colors and settings.
Bricks 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 bricks pattern works
A brick wall is two kinds of mortar line: horizontal lines between rows, and short vertical joints that switch position every other row.
The horizontal lines are a plain linear-gradient(): --fg for --line pixels, then transparent, repeated every half brick (calc(var(--size) / 2)), so there’s one line per row.
The vertical joints use a conic-gradient() corner trick. On a tile one brick wide and two rows tall, at var(--line) 50% with the last quarter painted fills only the area left of --line and above the middle, which is a short joint in the top row only. The third layer is the same joint shifted half a brick across and one row down with background-position, which gives the staggered running-bond layout of a real wall.
--size sets the brick width (bricks are half as tall as they are wide) and --line the mortar width. Use bricks for construction, restaurant and rustic themes, footers and 404 pages. The Tailwind tab outputs the same layers for Tailwind v4.