Things You'll Need:
- Text or HTML editor
-
Step 1
Click the mouse in front of the content that you want to apply color to.
-
Step 2
Type in the following opening HTML tag:
"Colorname" is the name of the color that you want to use. Here is a quick list of common color names their hexadecimal equivalents to choose from:
aqua #00FFFF
black #000000
blue #0000FF
fuchsia #FF00FF
gray #808080
green #008000
lime #00FF00
maroon #800000
navy #000080
olive #808000
purple #800080
red #FF0000
silver #C0C0C0
teal #008080
white #FFFFFF
yellow #FFFF00
. Example:I am red. -
Step 3
Click the mouse behind the content that you're editing. When you see an I-beam, you're ready to insert the ending HTML tag of colored text.
-
Step 4
Type in the following closing HTML tag:
-
Step 1
Add the following attribute to the element, such as
or, containing the text whose font you want to change.style="color: red;"Step 2Replace "red" with the number or name of the color you want.
Step 3Give the containing element a
classattribute, and define CSS properties for that class in thesection of the web page, or in a CSS file it includes. This is an alternative to using thestyleattribute. The format of such a declaration is:
.class-name {color: red; }Save and Check the Changes
Step 1Save your file.
Step 2Load up the web page in Internet Explorer or Firefox to see the fruits of your labor. If something doesn't seem quite right, the code may have been entered incorrectly, return to your editor and re-enter the code properly.
Tips & Warnings- Text color is sometimes also referred to as "foreground color".
- Not all browsers support the same number or type of color names and the rendition of colors is browser specific. So a particular shade of blue text in Internet Explorer may not be the same shade of blue text in Netscape Navigator.
- Take care to test your HTML pages in different browsers. Not all browsers interpret HTML the same way.
- Use CSS in preference to the older
FONTtag. CSS is more maintainable and extensible.
eHow Article: How to Set Text Color in HTML







