
HTML>HTML Formatting>Font Colour
The Font Colour Attribute
Colours in HTML documents are specified using a numerical code. When defining your webpage colours you should always use browser-safe colours. These are colours that are supported by all the major browsers.
Check out the following colour chart it specifies all the browser safe colours and their associated numerical code. You should only use these colour codes in your webpages. Determining the colour may seem very difficult but it's really easy just use the chart codes in your webpages.
There are two ways to color text on a webpage.
One approach is to set the colors for the entire document. You do this by specifying the colours in the body tag. This sets the stage for your entire webpage, specifying the colors for regular text, links (normally blue), and followed links (usually red).
<body text=?> sets the font color for entire document<body link=?> sets the color of links for the entire document<body vlink=?> sets the color of followed links for the entire document<body alink=?> sets the color of links on click for the entire document
example: <body text=#9932cd link=#ff0000 vlink=#00ff00 alink=#000000The other is to set and change colors as you move through the document, using the font tag.
<font color=?> changes font color
</font>              returns font to default colorExample
Try it out for yourself!
Examine the HTML code below. Cut and paste the following HTML code into the form window below and press the check it out button to see the resulting webpage.
<html>
<head><title>Font Colours</title></head>
<!--Sets the colour for the whole page-->
<body text=#CC0000 link=#330099 vlink=#330099 alink=#330099 >
<h2>The Font Colour Attribute</h2>
<p>Notice the colour of the text and the colour of the link <a href="www.google.com">Google</a> are different<br><br>Lets change the text colour!<br></p>
<!--Sets the colour for the text up to the </font> closing font tag-->
<p><font color=#FF33FF>See ! The colour of the text has now changed</p>
</font>
</body>
</html>Creating your own webpage
Follow these simple steps to create your own webpage and to view your created webpage in your browser.