CSS color property
Set text-color for different elements:
{
color:red;
}
h1
{
color:#00ff00;
}
p
{
color:rgb(0,0,255);
}
Try it out . . .
Description of property definition and use
The Color property specifies the color of the text.
Default: | not specified |
---|---|
Inherited: | no |
Version: | CSS1 |
JavaScript syntax: | object .style.color="#FF0000" |
Browser support
The numbers in the table support the first browser version number of the property.
The number immediately before -webkit-, -ms- or -moz- is the first browser version number that supports the prefix property.
Attributes | |||||
---|---|---|---|---|---|
color | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
Tips and comments
Tip: Use a reasonable background color and text color combination to improve the readability of the text.
Property Values
Value | Describe |
---|---|
color_name | A color (such as red) that specifies a color value as a color name. |
hex_number | A color that specifies a color value of hete sixteen-#ff0000). |
rgb_number | Specifies a color value of rgb code (e.g. rgb (255,0,0)." |
inherit | Specifies that colors should be inherited from the parent element. |
Related articles
CSS tutorial: CSS Text