Everyday Tools

Background Patterns With Pure CSS: Grids, Stripes, Dots and Checks

How CSS gradients draw grids, blueprint lines, polka dots, stripes, checks and isometric grids without images, plus tips for readable patterns.

Saizul Amin
Saizul Amin30 Oct 2026 · 3 min read
Background Patterns With Pure CSS: Grids, Stripes, Dots and Checks

Background Patterns With Pure CSS: Grids, Stripes, Dots and Checks

A subtle background pattern can make a page, slide or card feel designed rather than plain. Years ago that meant tiling small image files. Today CSS gradients can draw most simple patterns directly, keeping pages fast and patterns sharp on high-resolution screens. The CSS background pattern generator creates seven popular patterns; this guide explains the techniques so you can adapt them.

The core trick: hard colour stops

A gradient normally blends smoothly from one colour to another. If two colour stops sit at the same position, the change is instant, drawing a hard edge. For example, linear-gradient(#93c5fd 1px, transparent 1px) draws a one-pixel line at the top of the element and nothing else. Combine it with background-size: 24px 24px and the browser repeats the tile, so the line appears every 24 pixels.

Building each pattern

Grid. Two gradients: one from top to bottom for horizontal lines, one at 90 degrees for vertical lines.

Blueprint. Four gradients: thick major lines with a large tile size and faint minor lines with a small tile size, layered together.

Polka dots. A radial-gradient that is coloured near the centre and transparent beyond a radius draws one dot per tile.

Stripes. repeating-linear-gradient repeats bands without needing a background size, and its angle sets the direction: 0 degrees for horizontal stripes, 45 for diagonal.

Checkerboard. A conic-gradient sweeps around a point; colouring two opposite quarters creates a four-square tile that repeats as a chessboard.

Gingham. Two semi-transparent bands, one vertical and one horizontal, overlap to give the darker crossing squares of picnic cloth.

Isometric grid. Lines at 30 degrees are easier with a tiny inline SVG used as a background image, which the generator writes for you.

Exporting for other tools

CSS is ideal for websites, but slides, documents and design software need images. The generator also exports a matching SVG, which stays sharp at any size and is easy to recolour, and a 1200 × 800 PNG for tools that do not accept SVG.

Keep it readable

Patterns should support content, not compete with it:

  • Keep contrast between line and background colours low.
  • Put text on a solid panel above any busy pattern.
  • Avoid very fine, high-contrast patterns, which can shimmer on screens and bother some readers.
  • Check that text over a pattern still meets WCAG contrast.

Align with your layout

Use a grid size that matches your spacing system, such as 8 or 24 pixels, so content lines up with the pattern. Designers often use a faint grid like this while sketching layouts and remove it for production.

Printing graph paper and worksheets

A plain grid exported as SVG makes printable graph paper. At typical screen resolution of 96 pixels per inch, about 38 pixels equals one centimetre; set your print scale to 100 percent and check with a ruler. Isometric grids are useful for technical drawing practice and game level sketches.

Dark mode

Patterns need a dark-mode version: swap line and background colours, then lower the line contrast, since bright lines on dark backgrounds look stronger than dark lines on light ones.

Custom properties

Store the pattern colours and size in CSS custom properties, such as a line colour and a tile size, so one change updates the pattern everywhere and themes can override it. This also makes it easy to offer a "no pattern" option for people who prefer plain backgrounds.

Performance

Gradients are drawn by the browser and need no network requests, so they load instantly. Very large numbers of layered gradients on huge areas can slow scrolling on old phones; one or two layers are fine everywhere.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages