Forum Moderators: open
I thought it would be useful to list the deprecated HTML tags and attributes, and deal with any related issues. CSS will take care of most.
If I'm missing anything, please help me fill out the list. At the very least, I can stop writing deprecated code. Patch-ups will come a bit later.
Deprecated Tags
<applet> - use <object>
<basefont>
<center>
<dir> - use <ul>
<font>
<isindex> - use <input>
<listing> - use <pre>
<menu> - use <ul>
<plaintext> - use <pre>
<s> - use <del>
<strike> - use <del>
<u>
<xmp> - use <pre>
Deprecated Attributes
align=
alink=
background=
bgcolor=
color=
hspace=
link=
size=
text=
type=
vlink=
vspace=
Also, width= and height= are deprecated attributes for <td> elements [w3.org]. The recommendation is to define width for <table>, and let the browser sort out the individual cells.
<edited to fix formatting>
[edited by: tedster at 4:35 am (utc) on Mar. 23, 2005]
There's another method that I use to keep heading text bumped up snug against the following text block - I like that look very much. I developed it for <H1> tags - nice when you've got keywords in the heading - but the idea also works fine for <p> tags.
H1 tags with NO margin-bottom, cross-browser [webmasterworld.com]
Maybe I'm missing something but I dont see the point in depreciating width, align and bgcolor.
EXAMPLE
Invlaid - <tr bgcolor="#CCCCCC"><td align="center">
Valid - <tr class="greyc"><td class="center">
In order to make it valid you have to ADD 2 EXTRA lines ...
.greyc { background-color: #CCCCCC}
.center { text-align: center}
The only plus is that if you wanted to change the colors of the cell.
I don't see how its a big leap forward,
Unless every single site on the Internet suddenly gets rid of all the deprecated tags then NO.
This is something for the future, but I don't think it will happen in the next release of the browser versions.
The Internet would be a right mess ;)
Dazz
Unless every single site on the Internet suddenly gets rid of all the deprecated tags then NO.This is something for the future, but I don't think it will happen in the next release of the browser versions.
The Internet would be a right mess
Yeah - but it might make people start writing compliant code...
:)
The "presentational" attributes for an entire site's complete set of elements can be written on a single style sheet. Core elements can be defined from the start and .class need only be applied to "style" variations.
The single most difficult concept to grasp when making the transition to CSS is that one is no longer required to add presentational mark-up at each and every occurance of a n element.
td {
font:11px verdana, arial, hevetica, san-serif;
text-align:center;
color:#000;
background:#ccc;
}
will set the above "presentational" styles as the default for an entire site's td elements if place in an external style sheet.
Variations can be written and applied as .class statements:
td.red {
color:#fff;
background:#006;
}
The font and the text alignment will be inherited from the initial td style declaration.
There are unlimited possibilities. Typically, you can expect a 15 to 25% reduction in code (file) size, perhaps even more.
As you begin to use CSS you will discover the combined "elegance" and "power."
Actually I have grapsed and been using cascading styles for at least a year now. I can't remember the last time I used a font tag.
There are 3 main areas - those within TD tags those within P tags and those that don't fall into the previous. Those areas account for about 95% of my sites style.
My point is that while CSS is great for sitewide stuff there are a lot of places where I use a dizzying combination of styles, background colors etc.
sometimes it is less hassle and space to just use convential means such as setting the background color, alignment, height or width manually rather then creating a number of alternate classes.
I do tons and tons of tables listing values sometimes they will be centerd, right aligned, V aligned to the top blah, blah, blah.
I could spend hours thinking up every concievanle color, alignment, font, style etc. or I could just use depreciated tags.
Can I create 2 classes to produce 3 styles? I have a HTML/CSS editor that suggests that I can but I remember reading somewhere in this forum that you can't. I have tried it and it works in IE 5-6.
Ex: I create .i and .b classes for italics and bold. This gives me two styles to work with. But I have used this format to generate a 3rd style <div class="i b">insert text</div> and it works to create text that is bold and italicized.
Now it does work, but is it legal? In my opinion it saves even more time and space by not having to create a 3rd class, say .ib
why do they use it? well it's not very convenient for developers, but, because internet explorer is the world's dominant broswer, it is very convenient for users.
that's because none of the 8 measuring units, or the percentage size or the larger, smaller etc ways of defining fonts work satisfactorily cross-browser and let users make the font sizes bigger and smaller from IE's view menu. <font size=""> works perfectly however.
i'm all in favour of css, but only as a tool for making web pages that people can use. where it still needs ironing out, i don't see any problem with continuing to use tags that the w3c say you shouldn't.
in precisely what way is a css specified font more of a problem than a font tag specified font? in the only cases I know of it only becomes a problem if you try to be over precise with the design...in which case using font tags is merely overriding one aspect of the problem in order to create adifferent problem elsewhere (maybe involving a set of work arounds that you are more familiar with than the css equivalents, but a kludge nonetheless)
i just decided quite a while ago, that while i like to have elegant and lean mark-up, it's much more important to me how a page renders in the browsers that people use than how the results turn up after a page has been crunched by a validator.
in trying to do that, i weigh up what stylesheets and html can each give me and what baggage they each bring.
% and ems generally work ok, but their specifc problem is that netscape 4 and early versions of ie don't render them properly. of course, the <font> tag also has its problems - much harder to change across a site and dropped by the w3c.
there are ways around the % and ems issue (a hack like stylesheet import to feed different css to netscape 4 is a good one). but in the weighing up exercise, i prefer the <font> tag solution.
that's speaking as someone who left <font> tag behind 18 months ago, for all the right reasons, but is making a pragmatic (and i hope informed) decision to return. it's just one of many workarounds that hopefully we'll all be free of in a few years.
miles