CSS Color Values

 <  Day Day Up  >  


CSS Color Values

Cascading style sheets (CSS) support the color names and values listed above and also offer a number of other formats not available in HTML.

Three-Digit Hexadecimal Color Values

Under CSS, color values can be defined using three-digit hexadecimal color values, a concise version of the six-digit values just noted. This approach is supported by Internet Explorer 3 and higher and Netscape Navigator 4 and higher.

 span {font-family: Helvetica; font-size: 14pt; color: #0CF;} 

RGB Color Values

Under CSS, color values can be defined using RGB values. Colors are defined by the letters rgb, followed by three numbers between 0 and 255 that are contained in parentheses, separated by commas, and with no spaces between them. This approach is supported by Internet Explorer 4 and higher and Netscape Navigator 4 and higher.

 p {color: rgb(204,0,51);} 

RGB Color Values Using Percentages

Under CSS, RGB color values can also be defined using percentages. The format is the same, except that the numbers are replaced by percentage values between 0% and 100%. This approach is supported by Internet Explorer 4 and higher and Netscape Navigator 4 and higher.

 p {color: rgb(75%,10%,50%);} 


 <  Day Day Up  >  


HTML & XHTML
HTML & XHTML: The Complete Reference (Osborne Complete Reference Series)
ISBN: 007222942X
EAN: 2147483647
Year: 2003
Pages: 252
Authors: Thomas Powell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net