CSS PROPERTIES
Expand All|Collapse All
CSS AT-RULES
SPONSORED LINKS

CSS color Property

Topic: CSS3 Properties Reference« Prev|Next »

Description

The color CSS property sets the color for an element's text content.

The following table summarizes the usages context and the version history of this property.

Default value: Depends on the browser
Applies to: All elements
Inherited: Yes
Animatable: Yes. See animatable properties.
Version: CSS 1, 2, 3

Syntax

The syntax of the property is given with:

color color | initial | inherit

The example below shows the color property in action.

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

Property Values

The following table describes the values of this property.

Value Description
color Takes any valid CSS Color Values.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element color property.

Browser Compatibility

The color property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 3+
  • Apple Safari 1+
  • Opera 3.5+

Further Reading

See tutorial on: CSS Color.

Related properties: background

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.