XHTML Deprecated Elements and Attributes July 24, 2007
If you’re coding with a strict doctype, you definitely don’t want to use any deprecated attributes or elements. So, what are those deprecated elements and attributes that you shouldn’t use? See below:
Deprecated Elements
| Name | Description | Alternative |
|---|---|---|
| applet | Java applet | |
| basefont | base font size | font-size: 100%; |
| center | shorthand for DIV align=center | text-align: center; |
| dir | directory list | |
| font | local change to font | font-family: arial; font-size: 0.8em; |
| isindex | single line prompt | |
| menu | menu list | |
| s | strike-through text style | text-decoration: line-through; |
| strike | strike-through text | text-decoration: line-through; |
| u | underlined text style | text-decoration: underline; |
Deprecated Attributes
| Attribute | Deprecated in these elements | CSS (or HTML) Alternative |
|---|---|---|
| align | caption, img, input, object, legend, table, hr, div, h1, h2, h3, h4, h5, h6, p | CSS attribute: text-align |
| alink, link, vlink | body | CSS selectors: a, a:link, a:visited, a:hover, a:active, a:visited:hover
CSS attribute: color: |
| background | body | CSS attribute: background-image: |
| bgcolor | table, tr, td, th, body | CSS attribute: background-color: or background: |
| border | img, object | CSS attribute: border: |
| clear | br | CSS attribute: clear: left | right | both | none |
| compact | dl, ol, ul | CSS attribute: line-height, min-height or height: with overflow: set. |
| height | td, th | CSS attribute: line-height for cell content; don’t use tables for layout |
| hspace | img, object | CSS attribute: padding |
| language | script | HTML attribute: type
HTML attribute value: |
| name | img, a, applet, form, frame, iframe, map | HTML attribute: id |
| noshade | hr | |
| nowrap | td, th | CSS attribute: white-space: |
| size | hr | CSS attribute: width: or margin: |
| start | ol | Anyone know? Please tell me. |
| target | a | Anyone know? Please tell me. See http://krijnhoetmer.nl/stuff/html/strict-doctype-target/ |
| text | body | CSS attribute: color |
| type | li, ol, ul | CSS attribute: list-style-type |
| value | li | Anyone know? Please tell me. |
| version | html | HTML Markup: use a DTD |
| vspace | img, object | CSS attribute: padding: or margin: |
| width | hr, td, th, pre | CSS attribute: width: |






I am on a panel at
Instead of target=”_blank” for links, the best way is to use JavaScript. This is one effective method:
<a href=”http://example.org/” onclick=”window.open(this.href);return false;”>example.org</a>
If by some chance the user has JavaScript disabled, the link will still work (though in the same window).
I was surprise by many of the deprecated elements and attributes, mainly the attributes.
Dan,
You should actually put the onClick in a JavaScript and not make it inline. This is most commonly used for external links.
Here is an article
http://perishablepress.com/press/2007/11/20/open-external-links-as-blank-targets-via-unobtrusive-javascript/
Patrick
Thanks, it’s useful.
Iframe and target are not deprecated in HTML 4.01/XHTML 1.0
but both are invalid in strict doctypes. Unlike every other invalid element/ attribute.
http://www.w3.org/TR/html401/index/elements.html
http://www.w3.org/TR/html401/index/attributes.html
Do you know why? I don’t see any logic in this.
Also, text/javascript is deprecated.
http://www.rfc-editor.org/rfc/rfc4329.txt
It’s just that IE is too idiotic to support application/ecmascript
or application/javascript. Which, again, doesn’t seem to make any sense.
As for a target alternative there is no HTML/CSS way to do it.
But this works
New-Window Links in a Standards-Compliant World
http://www.sitepoint.com/article/standards-compliant-world/
An image can be centered horizontally simply with a block. But how to do that just as easily with CSS? Of course I don’t want to use margins and absolute lengths. The same goes for a table, where also the align attribute is deprecated. Am I just that stupid?
Google Chrome already seems to ignore the center tags around an image and places the image left of the screen.