color Description:
The color property defines the foreground color (usually the text) of the element.
color in CSS Versions:
color Syntax:
color: <color> | attr(<identifier>,color) |inherit
- <color> - a color code
- attr(<identifier>,color) - use the color value assigned to the attribute identified in this line (CSS 3)
color Initial Value:
Depends upon the user-agent.
color Applies To:
All elements.
color Inheritance:
This property is inherited.
color Browser Support:
color Examples:
Standard color property
<p style="color : #f00;">This paragraph is red.</p>
Use the text attribute of the body element
body { color: attr(text,color); }
See other CSS color examplescolor Special Notes:
- This value is inherited by any borders of the element (the border-color property overrides this).
- Colors can be defined as hexadecimal (
#ff0000), RGB (rgb(255,0,0)), HSL (hsl(240,80%,50%)) in CSS 3, or color names (red). - Transparent (
color: transparent;) is a valid keyword and lets any color below the current foreground show through. This keyword was added in CSS 3 to the color property.

