This month I will discuss the font tag and links.
The first thing I will discuss is the font tag. This tag as you may have guessed lets you change the font of the text on your page in a number of ways. You can change the typeface, the size and the colour.
As is necessary by the nature of the tag, it also requires and end tag so its prototype is:
<font ...>This is the affected text</font>
where “…” is the parameter list.
The parameters you can set are face, size and color (note “color” as opposed to the English “colour” – it’s the American spelling).
FACE sets the typeface (for example “times new roman” or “arial“).
SIZE sets the size of the text.
COLOR sets the colour of the text.
If the typeface name has only one word in it – for example “verdana” – there is no need to enclose it in quotation marks and the code will look like:
If the name however consists of two or more words – for example “brush script” – then the name must be enclosed in quotation marks and the code will look like:
<font face="brush script">
It is important to remember that people viewing your page over the Internet will not have all the same fonts as you installed on their computer. Therefore you can list a number of fonts that could be used. This is done as follows:
<font face="font 1, font 2, font 3">
If the viewer of your page has “font 1” on their computer then that is the font that will be used, if not then “font 2” will be used and so on until the end of the list is reached. If no fonts on the list match then the default font will be used.
The size of the text is set on a scale of 1 to 7 with 7 being the biggest. Size 3 is the default. You can also set the size of the font using proportional values. For example “+2” or “-1”. As an example:
is the same as writing:
Color can be set using either hexadecimal notation or one of the predefined colours as discussed in the previous article.
The next thing I will discuss is links. If you have ever surfed the Internet, you have encountered and are probably familiar with links. A link is a part of a page you click on to take you to another page. This page can be another page on the same site, a completely different page on a different site/server, another point on the same page. You can also link to an e-mail address.
The prototype for a link is:
where “..” is the list of parameters and “link” is the contents of the page which will act as the link, meaning you can click on them and be taken to the specified web page.
To specify the web page you use the “href” parameter.
<a href="http://web4that.com/">Online Web Programming Blog</a>
If you want to link to another page on your own site that is in the same directory as the page, you can do so as follows:
<a href="/lets-get-started-in-html">Get Started in HTML</a>
If you want to link to an email address do so as follows:
<a href="mailto:email@example.com">E-mail me</a>
I will cover linking to another part of the same page next month.
The link part of:
Can be text and/or image(s). The text will be underlined and the image will have a border around it. The colour of the text and the border is set in the body tag as described in the previous article.