StealThis .dev

Grid Pattern

An SVG-based grid pattern background with customizable size, color, and stroke width via CSS custom properties. Perfect for dark-themed hero sections and landing pages.

Open in Lab
css javascript vue svelte
Targets: TS JS HTML React Vue Svelte

Code

Grid Pattern

A clean SVG-based grid pattern background built with CSS custom properties for full customization.

How it works

The pattern is created using an inline SVG encoded as a background-image data URI. CSS custom properties (--grid-size, --grid-color, --grid-stroke) control the grid dimensions, line color, and thickness without touching the markup.

Customization

VariableDefaultDescription
--grid-size40pxCell width & height
--grid-colorrgba(255,255,255,0.08)Line color
--grid-stroke1SVG stroke width

When to use it

  • Hero section backgrounds
  • Dashboard or admin panel backdrops
  • Landing page decorative layers
  • Behind feature card sections