Style color Property
The Style object
Definition and Usage
The color property sets or returns the color of text.
Syntax
Set the color property:
Object.style.color="
color
|inherit"
Return the color property:
Object.style.color
| Value | Description |
|---|---|
| color | Specifies the color of the text. In A CSS color value the CSS color reference you can find a complete list of possible color values. |
| inherit | The value of the color property is inherited from the parent element. |
Browser support





All major browsers support the color property.
**Note:** IE7 and earlier versions do not support the "inherit" value. IE8 supports "inherit" only if a !DOCTYPE is specified. IE9 supports "inherit".
Example
Example
Change the color of the text:
This is a sample paragraph.
This is also a sample paragraph.
Try it »
The Style object