Formating Text

The following tags are used to format the text styles in the body of the document.

<font ...>

This tag changes the font of the text. The next three attributes are used to modify the <font> tag.

face="Arial"

This will make the text appear in the Arial font.

You can also specify alternative fonts (in case the viewers PC does not have your fonts installed) by typing the font names separated by commas. See the page on fonts.

size="4"

This will make the text appear in font size 4, the default size is 3, you can omit this attribute if you want the default size to be used. The larger the number the bigger the font size. You cannot change the size of text in <h1> to <h6> tags unless you use Cascading Style Sheets.

This text is size 4.

color="#..."

This will change the colour, The colour is specified in hexadecimal code, see the page on colour for an explanation. You can omit this attribute and the text will be in the default colour, usually black.

<b> </b>

Place around text to make it bold.

Text inside <h1> to <h6> tags is already formatted as bold, so adding <b> and </b> tags will not alter its appearance, you would need to use Cascading Style Sheets.

<i> </i>

Place around text to make it italic.

<u> </u>

Place around text to underline it.

<p align="center"><font size="4" face="Arial", "Helvetica" color="#009900">This sentence is a <i>typical example</i> of some of these tags in use, the code looks <b>like this</b>:</font></p>

This sentence is a typical example of some of these tags in use, the code looks like this:

Commands can be nested to combine their effect, for example:

<u><b>bold and underlined</b></u>

bold and underlined

Notice that the underline command is applied first, but the stop tag for underline is applied last. Some browsers will not interpret tags properly unless they are nested so that they are stopped in the reverse order that they were applied - and it's mandatory to do it this way to comply with the xHTML standard for authoring web pages.

There is another way to format the text and other elements of an HTML page, you can use Cascading Style Sheets, but it is useful to understand the inline method of formatting before trying CSS.