CSS color property
Examples
Different elements to set text-color:
body
{
color:red;
}
h1
{
color:#00ff00;
}
p
{
color:rgb(0,0,255);
}
{
color:red;
}
h1
{
color:#00ff00;
}
p
{
color:rgb(0,0,255);
}
try it"
Attribute definitions and instructions
Color attribute specifies the color of the text.
Defaults: | not specified |
---|---|
inherit: | no |
version: | CSS1 |
JavaScript syntax: | object .style.color = "# FF0000" |
Browser Support
Figures in the table represent the first browser to support the version number of the property.
Immediately following the digital -webkit-, -ms- or -moz- ago in support of the prefix attribute first browser version number.
属性 | |||||
---|---|---|---|---|---|
color | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
Tips and Notes
Tip: Use a reasonable background colors and text colors, so you can improve the readability of text.
Property Values
value | description |
---|---|
color_name | Predetermined color is the color name of the color (such as red). |
hex_number | Predetermined color values hexadecimal color values (such as # ff0000). |
rgb_number | Rgb color value of a predetermined color code (eg rgb (255,0,0)). |
inherit | Provisions should inherit from the color of the parent element. |
related articles
CSS tutorial: CSS the Text