[Skip to Contents]

Avoid the use of deprecated elements

In a previous (discouraged) example the font tag is used to increase the size of text to make it stand out as a header. Apart from the already mentioned reason, this is also discouraged because the font tag is deprecated, which means that its use is not recommended in standard compliant code.

Adding presentational styles to HTML documents directly, like font size and colour, makes it difficult for users to adjust the display of a page according to their requirements. A look at the HTML 4.01 Specifications [Open link in new browser window.] shows that most presentational elements and attributes are now deprecated. Styles are better specified in a separate document, the Cascading Style sheet (CSS) (discussed in more detail in a later chapter).

Discouraged:

<h1><font color="#0000FF">Header</font></h1>

Recommended (using CSS):

In the style sheet:
h1 {color : #0000FF;}

in the HTML document:
<h1>Header 1</h1>

The header will be displayed in blue, if the browser supports style sheets:

Header 1

Another example for deprecated tags is the <center> tag. In the latest version of HTML (4.01) even the ALIGN attribute has been deprecated:

Discouraged examples:

<center>some text</center> <p align="center">some text</p> <div align="center">
<p>text text text text</p>
<p>text text text text</p>
</div>

Recommended (using CSS):

In the style sheet:
.center {text-align : center;}

in the HTML document:
<p class="center">centered text</p>

Learn more about Style sheets.

Logical tags

| Access Guide Home | Table of Contents | Definitions | Glossary | Help |