Visit Mozilla.org

CSS:color

From MDC

« CSS Reference

[edit] Summary

color sets the foreground color of an element's text content.

[edit] Syntax

border-bottom-color: color | inherit

[edit] Values

color 
The color can be specified in any of the following ways:
  • as a hexidecimal RGB value
  • as a regular RGB or RGBA New in Firefox 3 value
  • as a regular HSL or HSLA New in Firefox 3 value
  • as one of the pre-defined color keywords

[edit] Examples

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%) }

If you wish to include an alpha channel in the color to allow translucency, you can use RGBA or HSLA colors:

element { color: rgba(255, 0, 0, 0.5) } New in Firefox 3
element { color: hsla(0, 100%, 50%, 0.5) } New in Firefox 3

These two examples create a color with its opacity set at 0.5, or 50%.

[edit] Notes

[edit] Specifications

[edit] Browser Compatibility