We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

color Redirect 2


The CSS color property sets the foreground color of an element's text content, and its decorations. It doesn't affect any other characteristic of the element; it should really be called text-color and would have been named so, save for historical reasons and its appearance in CSS Level 1.

Note that the color value must be a uniform color, which may include a transparency value from CSS3 onwards. It can't be a <gradient> which is an <image> in CSS.

  • Initial value Varies from one browser to another
  • Applies to all elements
  • Inherited yes
  • Media visual
  • Computed value If the value is translucent, the computed value will be the rgba() corresponding one. If it isn't, it will be the rgb() corresponding one. The transparent keyword maps to rgba(0,0,0,0).
  • Animatable yes, as a color
  • Canonical order the unique non-ambiguous order defined by the formal grammar


Formal syntax: <color>
color: red;                     // A CSS Level 1 color.
color: orange;                  // The only color added in CSS Level 2 (Revision 1).
color: antiquewhite;            // A CSS Level 3 color, sometimes called a SVG or X11 color.
color: #0f0;                    // The color 'lime' defined using the 3-character dash notation.
color: #00ff00;                 // The color 'lime' defined using the 6-character dash notation.
color: rgba( 34, 12, 64, 0.3);  // A color defined using the available functional notations.
color: currentColor;            // The special keyword representing the color's value of its direct ancestor.

color: inherit;


Is a <color> value giving the color of the textual elements of the element.


The following are all ways to make the element's text red:

element { color: red }
element { color: #f00 }
element { color: #ff0000 }
element { color: rgb(255,0,0) }
element { color: rgb(100%, 0%, 0%) }
element { color: hsl(0, 100%, 50%) }

/* 50% translucent */
element { color: rgba(255, 0, 0, 0.5) } 
element { color: hsla(0, 100%, 50%, 0.5) }


Specification Status Comment
CSS Transitions Working Draft Defines color as animatable.
CSS Color Module Level 3 Recommendation Deprecated system-colors; added SVG colors; added rgba(), hsl(), hsla() functional notation.
CSS Level 2 (Revision 1) Recommendation Added the orange color and the system-colors.
CSS Level 1 Recommendation  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 1.0 (1.7 or earlier) 3.0 3.5 1.0
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 1.0 1.0 (1) 6.0 6.0 1.0

See also

Document Tags and Contributors

Last updated by: Sheppy,