| Inherited | Initial | Version |
|---|---|---|
| Yes | CSS1, 2.1 |
| IE5.5+ | FF1+ | SA1.3+ | OP9.2+ | CH2+ |
|---|---|---|---|---|
| Full | Full | Full | Full | Full |
Syntax
Description
The color
property defines the foreground color of an element; in essence, this
means it defines the color of the text content. If a
border-color value hasn’t been defined explicitly for
the element, the color value will be used
instead.
It’s always good practice to set a
background-color, as we set color to
ensure that conflicts don’t arise between these values and any previous
declarations or styles contained within user style
sheets.
Example
This style rule sets the color
red for text within the element with ID
"example" :
#example {
color: red;
}
Value
color takes any
valid CSS color value. The initial
value for this property depends on the user agent.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 8.0 | 1.0 | 1.5 | 2.0 | 3.0 | 3.5 | 1.3 | 2.0 | 3.1 | 4.0 | 9.2 | 9.5 | 10.0 | 2.0 |
| Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full |
Internet Explorer for Windows versions up to and
including 7 don’t support the value inherit.
User-contributed notes
- ID:
- #5
- Date:
- Thu, 27 Jan 2011 17:52:53 GMT
It would seem that the color property should affect elements created on a canvas element (don't they qualify as "foreground" elements?), but from my testing, this doesn't seem to be the case.
Not sure if that can or should be incorporated into the description here.