The color property describes the foreground color of an element's text content. In addition it is used to provide a potential indirect value (currentColor) for any other properties that accept color values.

  • Initial valueDepends on the user agent. For example, your browser sets its own default colors for different elements.
  • Applies toAll elements
  • InheritedYes
  • MediaVisual
  • Computed valueFor a non-translucent color, an hexadecimal equivalent is used. Otherwise it is the RGBa equivalent
  • AnimatableYes
  • CSS VersionCSS1, CSS2, CSS3
  • JavaScript
Formal syntax: <color> | inherit

color: blue;                   /* Color name */
color: #3366FF;                /* 6 Digit hex color code */
color: #CCC;                   /* 3 Digit hex color code */
color: rbga(28, 28, 28, 0.5);  /* RGBA color code */
  • <color>Is a color value giving the color of the textual elements of the element.
  • inherit
.class {
   background-color: inherit;
   color: #0000FF;

Click the button below to experiment with this property.

Give it a Try!


Last updated on 23rd March 2014 By Rene Spronk

View All CSS Properties

Errors? Please help to keep this list up to date, If you find any errors, please contact us, so that we can get them fixed.