Beginning HTML

Colours

As well as accepting a face parameter, the font tag also accepts a color (remember that HTML uses American spellings) parameter. This is used in a similar fashion to the face parameter. The value that you pass the parameter can be one of two types, either a # followed by the colour's hex code or the HTML name of the colour. For a list of colours, their HTML names and hex codes, see the bottom of this page.

For now let's just try formatting some text red. We would have to use the following code:

This text is not red. <font color="red">This text is red</font>

Try pasting this into your index file, so that it reads:

<html>
<body>
This text is not red. <font color="red">This text is red</font>
</body>
</html>

Save and refresh. For an exact shade, always use a colour's hex code equivalent, but it's obviously easier to remember a colour's textual name. The body tag also accepts a parameter called bgcolor, this sets the background colour of the page and is used in an almost identical fashion as the font color parameter. Try experimenting with it. Here's some example code:

<html>
<body bgcolor="tan">
This text is not red. <font color="red">This text is red</font>
</body>
</html>

For a full list of colours, see this excellent resource from HTML Goodies: Colour List

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” - Martin Fowler