CSS color
Property
Topic: CSS3 Properties ReferencePrev|Next
Description
The color
CSS property sets the color for an element's text content.
The following table summarizes the usages context and the version history of this property.
Default value: | Depends on the browser |
---|---|
Applies to: | All elements |
Inherited: | Yes |
Animatable: | Yes. See animatable properties. |
Version: | CSS 1, 2, 3 |
Syntax
The syntax of the property is given with:
The example below shows the color
property in action.
Example
Try this code »body {
color: red;
}
h1 {
color: #00ff00;
}
p {
color: rgb(0,0,255);
}
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
color | Takes any valid CSS Color Values. |
initial |
Sets this property to its default value. |
inherit |
If specified, the associated element takes the computed value of its parent element color property. |
Browser Compatibility
The color
property is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: CSS Color.
Related properties: background