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: • Use word-wrap Property to allow Line Breaks in the Middle of Words • Set the Word Spacing • position:relative • Define CSS Rollover Effects • position:absolute • Set the Background Properties • Use an Embedded Style Sheet • Set The Cursor Style • Set an Element's Clipping • Set the Font Style
|