Doctypes

Hi, I was just curious, ran into a situation that involves them, but could anyone give me a better explanation of which ones to use any why.

The problem I’m having is a site that I’m working on, all tables but the site is html and not xhtml but there isn’t a doctype declared, so would I use a transitional since the site has been up since 94. But if I made it transitional would I have to covert it over to strict soon or later?

thanks for any help, most appreciated.

It only isn’t deprecated because it was never a part of the standards in the first place and so cannot be deprecated.

I was only pointing out that you need to use a transitional doctype if you are going to use iframe tags in your webpage as well as if your page still uses old deprecated tags since the proprietary iframe tag was added to the transitional doctype and that it isn’t only deprecated tags that need that doctype.

I’d start with a transitional doctype, preferably for html 4.01. That will at least put IE6 into standards mode.

Then work on clearing up the html syntax errors the validator tells you about.

Once you have valid code under transitional, and assuming the site still looks OK cross browser, then you might want to use the validator to test it against the strict document type, which you can do without actually changing the doctype. See how many errors you have then under strict, and decide if it’s worth the work of fixing them.

Since this is an old document you are trying to transition to a more modern state, transitional is appropriate.

However, it might be less work overall to start the page all over using modern coding methods and losing the tables for layout approach. In that case the replacement page should use strict. Just remove everything except the content, and mark it up with semantic html tags, then style it and do the layout with CSS.

There is no reason to go to xhtml in any event.

Can you please drop this one. We have already had long and protracted discussions where you have completely ignored the many reasons that I and other people have given you why <object> is not a replacement for <iframe>.

I repeat: <object> is NOT a replacement for <iframe>, and the two elements are NOT interchangeable. There is a small minority of cases when you can replace an <iframe> with an <object>, which are the times when you should never have used an <iframe> in the first place. There are, however, plenty of occasions when the features that <iframe> allows cannot in any sensible way be replicated in <object>.

According to the W3 themselves, <iframe> can’t be used with a Strict doctype, but it is not deprecated. Framing elements and attributes are the only ones that fall into this category.

Transitional doctypes also allow for the non-standard <iframe> element. To do it properly according to the standards you should really use <object> instead.

Every HTML and XHTML document must have a doctype. If you don’t, you’re likely to cause problems for your visitors, as some or all browsers may not render it as you intended.

As a general principle, you should always aim to have documents in HTML Strict where possible - the whole reason for Transitional was to allow deprecated elements to be used. But, by definition, you should avoid using them wherever possible. Obviously, there will be times when you pick up a website that was designed ages ago (or even last week) by someone who knew no better, and is full of legacy code. When that happens, updating it to Strict might not be your first priority, so it’s OK to keep it as Transitional until such time as you can get it right.

Deprecated elements are:
applet, basefont, center, dir, font, isindex, menu, s, strike, u

There are also several deprecated attributes, but in many cases, they are only deprecated when used with particular elements. eg <table width=“100%”> is fine, but <td width=“10%”> is frowned on.

The whole Strict vs Transitional argument doesn’t apply to questions of semantic appropriateness. As far as the Doctype goes, you can have as many nested layout tables as you want, you can style your headings with <span> and CSS, you can use <h1> for your footer text … although obviously all of those are really bad ideas. So you only need to use a Transitional doctype if your page uses deprecated elements or attributes - not if it uses legitimate elements badly!