The color property determines the color of text, which can be specified using:
Refer to CSS Color Values for a comprehensive list of potential color values.
The default text color for a webpage is established within the body selector.
Example
| body { color: blue; } h1 { color: green; } |
| body { background-color: lightgrey; color: blue; } h1 { background-color: black; color: white; } div { background-color: blue; color: white; } |
| Attention: Adequate contrast is crucial for individuals with vision impairments. Thus, consistently verify that there is strong contrast between text and background colors (or images)! |
|
Property |
Description |
|
color |
Specifies the color of the text. |