What's a deprecated tag / attribute?

Older HTML tags and attributes that have been superseded by other more functional or flexible alternatives (whether as HTML or as CSS ) are declared as deprecated in HTML4 by the W3C - the consortium that sets the HTML standards. Browsers should continue to support deprecated tags and attributes, but eventually these tags are likely to become obsolete and so future support cannot be guaranteed.

Deprecated HTML tags
DeprecatedDescriptionReplacement
<applet> Inserts applet <object>
<basefont> sets font styles font style sheets
<center> centers elements <div style="text-align:center"> (W3C help)
<dir> directory list <ul>
<font> applies font styles font style sheets
<isindex> adds search field <form>
<menu> menu list <ul>
<s> strike through text style sheets
<strike> strike through text style sheets
<u> underline text style sheets

n.b. The <center> tag has also been used to center tables and other structures within the page, not just text. This use of tables is also now deprecated. Tables are to be reserved for tabular data - for those situations where two or more columns and two or more rows of data need to be displayed in a grid. The days of using a single cell table with hidden borders to position text within the page have gone. Generally, as on this page, for a table to be required the content should demand to be divided into visible columns and visible rows.

It is particularly important for special use browsers like text-only and text-to-speech that each row is intact in the source code - don't use a series of <br> tags to get cell contents to line up. Use <td rowspan="2"> if necessary to allow broken lines. As an example, this is a section from the source of the deprecated attributes table on this page.

<table border="1">
<caption><b>Deprecated HTML attributes</b></caption>
<colgroup><col width="20%"><col width="40%"></colgroup>
<tr><th>Attribute</th><th>Deprecated if used in:</th></tr>
<tr><td rowspan="2">align</td><td>
&lt;caption&gt;,&nbsp;&lt;img&gt;,&nbsp;&lt;table&gt;,&nbsp;&lt;hr&gt;, </td></tr><tr>
<td>&lt;div&gt;,&nbsp;&lt;h1..6&gt;, &lt;p&gt;</td></tr>
<tr><td>alink</td> <td><body></td></tr>
<tr><td>background</td><td><body></td></tr>

If you would not use a table to present the same data in a word-processor, then the <table> tag should not be used. The CSS alternative is more precise and involves relative or absolute positioning or margin control. Both methods are used on this page - the navigation links are separated from the content using the CSS class "header".
.header {
position:absolute;
top:10px;
left:270px;
padding-right:10px;
}
This places the second column start at a fixed position from the left margin, similar to newspaper columns. Within the content column, two tables are used to display the deprecated tags and attributes.

There are also attributes which are deprecated. Only attributes for tags already listed as deprecated are excluded from this list.

Deprecated HTML attributes
AttributeDeprecated if used in:
align <caption>, <img>, <table>, <hr>,
<div>, <h1..6>, <p>
alink <body>
background<body>
bgcolor <body>, <table> <tr> <td> <th>
clear<br>
compact <ol>, <ul>
color<basefont>, <font>
border <img>, <object>
hspace <img>,<object>
link<body>
noshade <hr>
nowrap<td>, <th>
size<basefont>, <font>, <hr>
start <ol>
text<body>
type <li>
value<li>
vlink<body>
width<hr>, <pre>, <td>, <th>
vspace<img>,<object>

All these deprecated attributes can be replaced by style-sheet controls. The majority can be simply switched directly into the style sheet. e.g. The mailme GIF file added to each main page has certain attributes pre-defined in the common stylesheet used for all main pages.

#mailmegif {vertical-align:middle; padding:25px; width:29; height:31; border-style:none;}

Each time the image is used, only the src and the id need to be specified. (Older browsers still need the border=0 attribute but you will have to use HTML4 Transitional instead of Strict if you want to support such old browsers as this attribute will cause the page validation to fail.). If you use the same graphic more than once, use a class identifier.

Note also that <td width=> is also deprecated. To control the width of table columns, use the <colgroup> and <col> tags.

This page has attempted to eliminate all deprecated tags and attributes using style sheets. (So it can be done!)


Adapted from Web Design in a Nutshell by Niederst