Set the text-color for different elements:
body {
color: red;
}h1 {
color: #00ff00;
}p.ex {
color: rgb(0,0,255);
}
More “Try it Yourself” examples below.
Definition and Usage
The color property specifies the color of text.
Tip: Use a background color combined with a text color that makes the text easy to read.
| Default value: | not specified |
|---|---|
| Inherited: | yes |
| Animatable: | yes. Read about animatable – Try it |
| Version: | CSS1 |
| JavaScript syntax: | object.style.color=”#0000FF” Try it |
CSS Syntax
color: color|initial|inherit;
Property Values
| Value | Description |
|---|---|
| color | Specifies the text color. Look at CSS Color Values for a complete list of possible color values. |
| initial | Sets this property to its default value. Read about initial |
| inherit | Inherits this property from its parent element. Read about inherit |
