Lessons Community Resources Tools

Color

Syntax: color: <color>
Initial Value: Determined by browser
Applies to: All elements
Inherited: Yes

The color property allows authors to specify the color of an element. See the Units section for color value descriptions. Some example color rules include:

Example:

H1 { color: red }

H3 { color: #0000A0 }

H4 { color: #008040 }


See example in action

To help avoid conflicts with user style sheets, background and color properties should always be specified together.