CSS Fish Scale Background
A fish scale pattern in pure CSS: overlapping rows of rounded scales, each one shaded toward its edge, from two radial gradients. Set the scale size live.
.bg-scales {
--bg: #223b8c;
--fg: #7585b7;
--size: 48px;
background-color: var(--bg);
background-image:
radial-gradient(circle at 50% 0, transparent calc(var(--size) / 4), color-mix(in srgb, var(--fg) 35%, transparent) calc(var(--size) / 2 - 2px), var(--fg) calc(var(--size) / 2 - 2px) calc(var(--size) / 2 - 0.5px), transparent calc(var(--size) / 2 + 0.5px)),
radial-gradient(circle at 50% 0, transparent calc(var(--size) / 4), color-mix(in srgb, var(--fg) 35%, transparent) calc(var(--size) / 2 - 2px), var(--fg) calc(var(--size) / 2 - 2px) calc(var(--size) / 2 - 0.5px), transparent calc(var(--size) / 2 + 0.5px));
background-size: var(--size) var(--size);
background-position: 0 0, calc(var(--size) / 2) calc(var(--size) / 2);
}<div class="
[--bg:#223b8c]
[--fg:#7585b7]
[--size:48px]
[background-color:var(--bg)]
[background-image:radial-gradient(circle_at_50%_0,_transparent_calc(var(--size)_/_4),_color-mix(in_srgb,_var(--fg)_35%,_transparent)_calc(var(--size)_/_2_-_2px),_var(--fg)_calc(var(--size)_/_2_-_2px)_calc(var(--size)_/_2_-_0.5px),_transparent_calc(var(--size)_/_2_+_0.5px)),_radial-gradient(circle_at_50%_0,_transparent_calc(var(--size)_/_4),_color-mix(in_srgb,_var(--fg)_35%,_transparent)_calc(var(--size)_/_2_-_2px),_var(--fg)_calc(var(--size)_/_2_-_2px)_calc(var(--size)_/_2_-_0.5px),_transparent_calc(var(--size)_/_2_+_0.5px))]
[background-size:var(--size)_var(--size)]
[background-position: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>Scales — CSS background</title>
<style>
html, body { height: 100%; margin: 0; }
.bg-scales {
--bg: #223b8c;
--fg: #7585b7;
--size: 48px;
background-color: var(--bg);
background-image:
radial-gradient(circle at 50% 0, transparent calc(var(--size) / 4), color-mix(in srgb, var(--fg) 35%, transparent) calc(var(--size) / 2 - 2px), var(--fg) calc(var(--size) / 2 - 2px) calc(var(--size) / 2 - 0.5px), transparent calc(var(--size) / 2 + 0.5px)),
radial-gradient(circle at 50% 0, transparent calc(var(--size) / 4), color-mix(in srgb, var(--fg) 35%, transparent) calc(var(--size) / 2 - 2px), var(--fg) calc(var(--size) / 2 - 2px) calc(var(--size) / 2 - 0.5px), transparent calc(var(--size) / 2 + 0.5px));
background-size: var(--size) var(--size);
background-position: 0 0, calc(var(--size) / 2) calc(var(--size) / 2);
}
</style>
</head>
<body class="bg-scales"></body>
</html>Save the pattern as an image, with your current colors and settings.
Scales 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 scales pattern works
Each scale is the bottom half of a circle. A radial-gradient() centered on the top edge of the tile (at 50% 0) draws a ring with a radius of half the tile, and the tile edge cuts off its top half. What’s left hangs down like a scale, and its tips touch the tile’s top corners.
Inside the ring, the gradient fades from transparent to a 35% mix of --fg, so each scale looks shaded toward its rim. Edges are softened by half a pixel to keep the curves smooth.
The second layer is the same gradient shifted half a tile across and half a tile down. Its scales sit in the gaps between the first row, and each rim lands exactly where two scales above it meet. Together the two layers make the overlapping rows of a fish scale or mermaid pattern.
--size sets the width of each scale. Use it for mermaid and ocean themes, fantasy or dragon game pages, and Japanese-style seigaiha designs.