color-background

color

Sets the foreground text color and inherits by default. Modern browsers support oklch() and color(display-p3) for wider-gamut design systems.

color: <color> (named | #hex | rgb() | hsl() | oklch() | currentColor)

Common values

Value Effect
#111827 Hex color literal
rgb(17 24 39 / .9) RGB with alpha via slash syntax
hsl(220 15% 15%) Hue/saturation/lightness color
oklch(70% 0.15 250) Perceptually uniform color
currentColor Inherits from the element's own color

Examples

body { color: #111827; }

Near-black body text

.muted { color: hsl(220 10% 45%); }

Secondary text color

svg { fill: currentColor; }

Icons match surrounding text color

Gotcha

Alpha in rgba()/hsla() and the newer space-separated syntax both work; stay consistent to simplify design tokens.

Related properties

← All CSS properties · CSS selectors · Grid vs Flexbox