The FONT tag is another text formatting feature. It allows you to adjust the size and color of your text.
The properties of a FONT tag are :
See the example in action.
Normal text size is 3. The text color usually defaults to black unless there is a different color specified in the BODY tag.
Instead of having two separate FONT tags affecting the same text, they can be combined into one.
From this :
To this :
Both will work correctly, but the latter example is considered better coding.
The BASEFONT tag can be used after the BODY tag to establish a BASE or general FONT size. Any individual FONT tags will over-ride the BASEFONT.
See the example in action.
Points about BASEFONT :
The properties of a FONT tag are :
| SIZE | A number 1 to 7 for height and thickness. Using a + or a - before the number will adjust the size against the default. |
| COLOR | A hex number set for color. |
|
<html> <head> <title> Welcome to David's web page. </title> </head> <body> <P> <font color="#ff0000"> Hi there! Thanks for visiting my web page. There isn't much here right now, but come back soon and see the changes! The text in this section is red. </font> </p> <hr size="10" width="50%" noshade align="right"> <b>This text is bold</b> <br> <font size="+3"> <i>This text is italisized and 3 font sizes larger than the normal sized font.</i> </font> <br> <u>This text is underlined. This text is black and is a normal size.</u> <br> This text is back to normal. <hr> <p> <b><i>This text is bold and italisized.</i></b> <br> <u><b>This text is underlined and bold.</b></u> </p> <p> <font color="#FF0000"> <font size="5"> This text is red and size 5. </font> </font> </p> <p> <font color="#ff0000" size="5"> This text is red and size 5. </font> </p> </body> </html> |
Normal text size is 3. The text color usually defaults to black unless there is a different color specified in the BODY tag.
Instead of having two separate FONT tags affecting the same text, they can be combined into one.
From this :
|
<font color="#ff0000"> <font size="5"> This text is red and size 5. </font> </font> |
To this :
|
<font color="#ff0000" size="5"> This text is red and size 5. </font> |
Both will work correctly, but the latter example is considered better coding.
The BASEFONT tag can be used after the BODY tag to establish a BASE or general FONT size. Any individual FONT tags will over-ride the BASEFONT.
|
<html> <head> <title> Welcome to David's web page. </title> </head> <body> <basefont size="3"> This text is size 3. <font size="5"> This text is size 5. </font> This text is size 3 again. </body> </html> |
Points about BASEFONT :
- It is a single tag. It does not have an ending tag.
- Only one BASEFONT tag should be used in any given HTML document.
- Only affects text in a normal area. Not in a Header or TABLE tag area.
- To establish a BASE text color, the TEXT property should be used in the BODY tag.

