Forum Moderators: open

Message Too Old, No Replies

Doctype; Transitional vs. Strict

         

TryAgain

12:09 am on Dec 1, 2003 (gmt 0)

10+ Year Member



From this page: [hut.fi...]
(Activating the Right Layout Mode Using the Doctype Declaration)

I gather that a transitional document type declaration puts most browsers in "Quirks" mode.
So you might as well not use a DTD at all. (Is this correct?)

What I don't get is this:

"HTML 4.01 Transitional document type declaration with the URL [w3.org...] ie. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">"

makes most browsers use "Standards" mode.
Heh? I thought the point of a transitional DTD was so that browsers would "gloss over" non-standard coding.

PS: The nick: was on the verge of trying "AllTheGoodNamesHaveBeenTaken" so don't laugh. ;)

troels nybo nielsen

12:25 am on Dec 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My personal impression is that a "transitional" document follows something like a compromise between two generations of HTML standards.

"Quirks" mode is used when the browser has not been told which standard to use.

Welcome to WebmasterWorld.

ricfink

12:54 am on Dec 1, 2003 (gmt 0)

10+ Year Member



Wrong, wrong, wrong, fellas.

And guessing about what doctypes do to the browser can lead to real trouble.

the straight scoop on doctypes in IE is located at:

[msdn.microsoft.com...]

Rincewind

12:57 am on Dec 1, 2003 (gmt 0)

10+ Year Member



I gather that a transitional document type declaration puts most browsers in "Quirks" mode. So you might as well not use a DTD at all. (Is this correct?)

If you look at the table on the page you refered to, and look for your doctype, you'll see that it works for the standard mode of almost all browsers. Some other forms of the 4.01 doctype may trigger quirks but not the one you quoted here.

Transitional is still a standard. It is intended as a half way house between an old standard and a newer one. So html 4.01 transitional will allow you to use all the advances added in 4.01 while at the same time not removing some of the older html 3.2 tags. The code must still be vallid.

pageoneresults

1:51 am on Dec 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hmmm, my understanding is that the only DOCTYPE that will trigger Quirks Mode is a shortened one...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Outside of that, the browser will render based on the referenced DTD...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Transitional is more of a compromise and allows you to use html elements that cannot be used in Strict. Elements such as target="".

pageoneresults

1:57 am on Dec 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



ricfink, I hate to say it, but the information at the MSN link you provided is incorrect. Well, I should say it is dated. Microsoft is referencing the HTML 4.0 label which is an older standard. The current is HTML 4.01.

Both of the declarations in the following example specify conformance to the Transitional HTML4.0 DTD. The second declaration specifies the URL of the DTD. The first declaration does not. The second declaration switches on standards-compliant mode with Internet Explorer 6 or later. The first declaration does not.

I wonder why they are declaring IE6 or later. Shouldn't that be IE3 or later?

Here is the standard as I understand it directly from the authoritative source, the W3C...

7.2 HTML version information [w3.org]

Farix

2:53 am on Dec 1, 2003 (gmt 0)

10+ Year Member



Because IE6 is the only one that flips into standards-mode[1] with the addition of the DTD. Previous versions of IE do not do this.

[1] Standards-mode as in standards compliant mode when rendering [some] CSS.

iamlost

3:04 am on Dec 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Referencing:
[msdn.microsoft.com ]

This element is available in HTML as of Internet Explorer 3.0.

You can use this declaration to switch Internet Explorer 6 and later into strict standards-compliant mode. You turn the switch on by including the!DOCTYPE declaration at the top of your document, specifying a valid Label in the declaration, and in some cases, specifying the Definition and/or URL.

I take this to mean that prior to ie6 Internet Explorer was deliberately unable to display to w3c standards and that it is only an "option" now.

Note In standards-compliant mode, compatibility with other versions of Internet Explorer is not guaranteed. When standards-compliant mode is switched on, the rendering behavior of documents may be different in future versions of Internet Explorer.

I do believe this says web sites optimised for older versions of IE are by nature not compliant with web standards because of IE proprietary "enhancements"!

Perhaps Microsoft is going to rejoin the world?
Perhaps I'm dreaming?!

TryAgain

5:04 am on Dec 2, 2003 (gmt 0)

10+ Year Member



I'm not saying straying from the published standard is a good thing, but Internet Explorer's interpretation was/is a lot more intuitive sometimes. (ie: seems to make more sense)

Thx for the replies btw, it's starting to make sense now. :)

ricfink

6:52 am on Dec 2, 2003 (gmt 0)

10+ Year Member



For IE, only IE 6 uses doctype switching. And the only thing it does is change the CSS rendering from IE's proprietary way of rendering (Quirks mode) which is the only option prior to IE 6, to a standards-based way of rendering.
That's it. Whether the doctype says strict or transitional makes no difference. Whether it says HTML 4 or 4.01 makes no difference. IE doesn't recognize these distinctions. It's either compliant mode on or compliant mode off.

Guess what -
MOZILLA and Opera also use doctype switching in a similar manner. Quirks mode vs compliant mode. In the case of Mozilla there's even a third level - an "almost standards" mode. I don't have the URL's handy but the documentation is easy to find.

All of this has to do with having a way to tip the browser off about how the page is to be rendered. It's a backward compatibility thing.