CSS Isometric Grid Background
An isometric grid in pure CSS: vertical lines plus two 30° diagonals that form a field of equal triangles. Set the triangle size live and copy the code.
.bg-isometric-grid {
--bg: #167364;
--fg: #6da89e;
--size: 40px;
background-color: var(--bg);
background-image:
linear-gradient(to top right, transparent calc(50% - 1px), var(--fg) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 1px)),
linear-gradient(to top left, transparent calc(50% - 1px), var(--fg) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 1px)),
linear-gradient(90deg, var(--fg) 1px, transparent 0);
background-size:
calc(round(calc(var(--size) * 0.866), 1px) * 2) var(--size),
calc(round(calc(var(--size) * 0.866), 1px) * 2) var(--size),
round(calc(var(--size) * 0.866), 1px) var(--size);
}<div class="
[--bg:#167364]
[--fg:#6da89e]
[--size:40px]
[background-color:var(--bg)]
[background-image:linear-gradient(to_top_right,_transparent_calc(50%_-_1px),_var(--fg)_calc(50%_-_0.5px)_calc(50%_+_0.5px),_transparent_calc(50%_+_1px)),_linear-gradient(to_top_left,_transparent_calc(50%_-_1px),_var(--fg)_calc(50%_-_0.5px)_calc(50%_+_0.5px),_transparent_calc(50%_+_1px)),_linear-gradient(90deg,_var(--fg)_1px,_transparent_0)]
[background-size:calc(round(calc(var(--size)_*_0.866),_1px)_*_2)_var(--size),_calc(round(calc(var(--size)_*_0.866),_1px)_*_2)_var(--size),_round(calc(var(--size)_*_0.866),_1px)_var(--size)]
"></div><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Isometric Grid — CSS background</title>
<style>
html, body { height: 100%; margin: 0; }
.bg-isometric-grid {
--bg: #167364;
--fg: #6da89e;
--size: 40px;
background-color: var(--bg);
background-image:
linear-gradient(to top right, transparent calc(50% - 1px), var(--fg) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 1px)),
linear-gradient(to top left, transparent calc(50% - 1px), var(--fg) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 1px)),
linear-gradient(90deg, var(--fg) 1px, transparent 0);
background-size:
calc(round(calc(var(--size) * 0.866), 1px) * 2) var(--size),
calc(round(calc(var(--size) * 0.866), 1px) * 2) var(--size),
round(calc(var(--size) * 0.866), 1px) var(--size);
}
</style>
</head>
<body class="bg-isometric-grid"></body>
</html>Save the pattern as an image, with your current colors and settings.
Isometric Grid 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 isometric grid pattern works
An isometric grid has three sets of lines: one vertical and two that slope at 30°. Together they cut the surface into equal triangles, which is the guide artists use for isometric drawings.
The trick is the tile shape. When a tile is √3 times as wide as it is tall, its diagonals slope at exactly 30°. The first two linear-gradient() layers use the corner keywords to top right and to top left, which always put the 50% line on the tile’s diagonal, so each draws one sloped line that meets its neighbors at the corners. The third layer adds a vertical line every half tile, through the points where the diagonals cross.
--size is the triangle’s side length. round() snaps the tile width to whole pixels so no seams appear between columns.
Use this isometric grid CSS for game sites, 3D and illustration tools, map or city-builder themes, and sketch-style hero sections.