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: • Set the Text Case • Set an Element's Margin • Set Text Justification • Set an Element's Float • Set the Border Style • Use an External Style Sheet • Indent the First Line of Text • Set the border-collapse • Set an Element's Overlap (z-index) • Style the First Line
|