color (CSS property)
| IE5.5+ | FF1+ | Saf1.3+ | Op9.2+ |
|---|---|---|---|
| Full | Full | Full | Full |
| Inherited | Initial | Version |
|---|---|---|
| Yes | CSS1, 2.1 |
Example
This style rule sets the color
red for text within the element with ID
"example" :
#example {
color: red;
}
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.
Value
color takes any
valid CSS color value. The initial
value for this property depends on the user agent.
Compatibility
| IE | 5.5 | Full |
|---|---|---|
| 6.0 | Full | |
| 7.0 | Full | |
| Firefox | 1.0 | Full |
| 1.5 | Full | |
| 2.0 | Full | |
| Safari | 1.3 | Full |
| 2.0 | Full | |
| 3.0 | Full | |
| Opera | 9.2 | Full |
| 9.5 | Full |
Internet Explorer for Windows versions up to and
including 7 don’t support the value inherit.
User-contributed notes
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

