Description & Usage

The color property defines text and text-decoration color for an element.

Because color is an inherited property, setting color on body or a top-level wrapper applies to all child text nodes unless overridden.

Modern CSS supports hex (#2563eb), rgb/rgba(), hsl/hsla(), and CSS custom property variables for theme toggles.

Property Specifications

Property FeatureSpecification
CategoryTypography
Initial ValueCanvasText / black
InheritedYes (inherited from parent)
Applies ToAll elements

Syntax

color: #0f172a | rgb(15, 23, 42) | hsl(222, 47%, 11%) | red;

Property Values

ValueDescription
#2563ebHexadecimal color code for vibrant blue.
rgba(0,0,0,0.85)RGB with alpha transparency.

Code Examples

Setting Body Text Color
body { color: #1e293b; background-color: #ffffff; }
Applies readable dark grey text across all child elements.