Little Web Hut

CSS 2.1 Reference: color Property

CSS color Property
Syntax
selector {color: value;}
  • value is specified by using a color-value or one of the following keywords: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, yellow, or inherit.
Usage

The color property is used to specify the foreground color of text.

This property is specified by using a color-value, or a keyword, according to the syntax shown above.


CSS Example: The color properties are set using 5 different color notation types.
  #tst1 {color: red;}
  #tst2 {color: #3c5;}
  #tst3 {color: #ffa500;}
  #tst4 {color: rgb(100,20,255);}
  #tst5 {color: rgb(30%,50%,70%);}
Test It HTML StyleTest It XHTML StyleTest It HTML5 Style

Keywords
  • aqua - aqua = #00ffff = rgb(0,255,255)
  • black - black = #000000 = rgb(0,0,0)
  • blue - blue = #0000ff = rgb(0,0,255)
  • fuchsia - fuchsia = #ff00ff = rgb(255,0,255)
  • gray - gray = #808080 = rgb(128,128,128)
  • green - green = #008000 = rgb(0,128,0)
  • lime - lime = #00ff00 = rgb(0,255,0)
  • maroon - maroon = #800000 = rgb(128,0,0)
  • navy - navy = #000080 = rgb(0,0,128)
  • olive - olive = #808000 = rgb(128,128,0)
  • orange - orange = #ffa500 = rgb(255,165,0)
  • purple - purple = #800080 = rgb(128,0,128)
  • red - red = #ff0000 = rgb(255,0,0)
  • silver - silver = #c0c0c0 = rgb(192,192,192)
  • teal - teal = #008080 = rgb(0,128,128)
  • white - white = #ffffff = rgb(255,255,255)
  • yellow - yellow = #ffff00 = rgb(255,255,0)
  • inherit - The inherit keyword is used to specify that the value for this property should be taken from the parent element. If inherit is used with the root element, then the initial value for this property will be used.
Applies To All elements
Inherited Yes
Initial Value Browser dependent


color Property Examples
Test It HTML StyleTest It HTML StyleTest It HTML5 StyleThe color properties are set using 5 different color notation types.