Set the Text Color
By Stephen Bucaro
Use the color property to set the text color. You can define the color by using the
color name, hexadecimal notation, or an rgb tripplet method.
Set the text color using the color name:
<p style="color:green">Set the text color to green.</p>
Set the text color to green.
Set the text color using an rgb tripplet:
<p style="color:rgb(0,255,0)">0,255,0 is the rgb tripplet
for the color green.</p>
0,255,0 is the rgb tripplet for the color green.
With the rgb tripplet method, you pass three comma-separated decimal
numbers to the rgb method. Each number can range from 0 to 255 and represents
the amount of each color; red, green, and blue, in that order.
Set the text color using hexadecimal notation:
<p style="color:#00ff00;">#00ff00 is hexadecimal notation
for the color green</p>
#00ff00 is hexadecimal notation for the color green
With the hexadecimal notation method, you pass three two-digit hexidecimal
numbers, with no separating comma, prefix the six digits with the # sign. Each
number can range from 00 to ff and represents the amount of each color; red, green,
and blue, in that order.
More CSS Quick Reference: • Grouped Selectors • Set the Font Variant • position:fixed • Define CSS Rollover Effects • Set an Element's Visibility • Set an Element's Overlap (z-index) • Set the Text Color • Set the Font Size • CSS background-origin Positions Background • Highlight Text
|