Wednesday, January 22, 2014

Background Properties_ CSS Text/Font Color

Property: Color

Usage:
 
color: red;
 
color: rgb(125,234,124); 
color: #343434; 

Definition:
Colors for html font/text can be set using the css tag "color". 
It accepts values in three formats
 

a) Color name
b) rgb(x,y,z) where x,y,z is red,green,blue
 
c) #xxyyz where xx,yy,zz points to hexadecimal(hex) values of red,green,blue

Examples

The following examples will show on how to set color for a font or text in html using css.
<div style="color: green;"> color name </div> <div style="color: rgb(125,125,125);"> color using rgb(x,y,z) </div> <div style="color: #343434;"> color using hex values</div>

Code:
 <div style="color: green;"> color name </div>
<div style="color: rgb(125,125,125);"> color using rgb(x,y,z) </div>
<div style="color: #343434;"> color using hex values</div>

Result:

color name

color using rgb(x,y,z)

color using hex values