XHTML Deprecated Elements and Attributes

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 (making a come back in HTML5)
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:
MIME type, ex. type=”text/javascript”

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. (making a comeback in HTML5)
target a Anyone know? Please tell me.
See http://krijnhoetmer.nl/stuff/html/strict-doctype-target/ (making a comeback in HTML5)
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:
This entry was posted in Web Development. Bookmark the permalink.

9 Responses to XHTML Deprecated Elements and Attributes

  1. Dan says:

    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).

  2. Guillermina says:

    I was surprise by many of the deprecated elements and attributes, mainly the attributes.

  3. Patrick says:

    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

  4. cid says:

    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/

  5. Jan Eyking says:

    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.

  6. Eoin says:

    Strike through text might be better displayed in a tag, as this might give more semantic meaning than purely using CSS.

  7. Eoin says:

    Sorry, the post above should read as follows:

    Strike through text might be better displayed in a [del] html tag, as this might give more semantic meaning than purely using CSS.

  8. Sebounet says:

    You ve forget many deprecated attribute, there’s a list there http://www.w3.org/TR/html4/index/attributes.html

    interresting stuff

  9. Estelle Weyl says:

    @sebounet – Thanks for the link. I checked it out. I got all of them here, just in a summarized format.

Leave a Reply

Your email address will not be published. Required fields are marked *