CSS, JavaScript and XHTML Explained

Quirks, random thoughts and funky finds discovered in day-to-day coding.

 

XHTML Deprecated Elements and Attributes July 24, 2007

Filed under: Web Development — Estelle @ 10:31 am

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:
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.
target a Anyone know? Please tell me.
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:
 

1 Comment for this post

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

Leave a Reply

You must be logged in to post a comment.