Search w3schools.com:

SHARE THIS PAGE

CSS Reference

CSS Reference CSS Selectors CSS Reference Aural CSS Web Safe Fonts CSS Units CSS Colors CSS Color Values CSS Color Names CSS Color HEX CSS3 Browser Support

CSS Properties

CSS color Property


Example

Set the text-color for different elements:

body
{
color:red;
}
h1
{
color:#00ff00;
}
p
{
color:rgb(0,0,255);
}

Try it yourself »

Definition and Usage

The color property specifies the color of text.

Default value: not specified
Inherited: yes
Version: CSS1
JavaScript syntax: object.style.color="#FF0000"


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The color property is supported in all major browsers.

Note: The value "inherit" is not supported in IE7 and earlier. IE8 requires a !DOCTYPE. IE9 supports "inherit".


Tips and Notes

Tip: Use a background color and a text color that makes the text easy to read.


Property Values

Value Description Play it
color Specifies the text color. Look at CSS Color Values for a complete list of possible color values. Play it »
inherit Specifies that the color should be inherited from the parent element


Related Pages

CSS tutorial: CSS Text

HTML DOM reference: color property



Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]