PDA

View Full Version : xhtml1-strict.dtd vs xhtml1-transitional.dtd



krycek
12-14-2002, 11:13 AM
OK just a quickie...

My site is valid XHTML and does everything (well almost everything) in CSS (which is also valid).

Is there any advantage in using a strict doctype as opposed to the standard transitional doctype? I changed it to strict just now, as it still displays exactly the same in both Mozilla and IE6.

Is there anything I should be aware of with using a strict doctype? And which is 'better' to use...

::] krycek [::

cg9com
12-15-2002, 05:21 AM
which is better?
i guess you couldnt really get an unbiased answer to that question.
my opinion is strict xhtml
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd

i havnt had any problems with it that i couldnt solve within an hour at the most.

brothercake
12-15-2002, 05:24 AM
A potential problem with strict xhtml is that IE6 renders it in quirks mode

jkd
12-15-2002, 05:38 AM
Originally posted by brothercake
A potential problem with strict xhtml is that IE6 renders it in quirks mode

It renders my XHTML 1.1 doctype in strict mode. It goes into quirks if it sees the <?xml?> processing instruction (which is utterly stupid of it).

krycek
12-15-2002, 05:48 PM
Originally posted by brothercake
A potential problem with strict xhtml is that IE6 renders it in quirks mode

I definitely agree with jkd on this one

::] krycek [::

brothercake
12-15-2002, 05:50 PM
Oh I see - so you're saying this with XHTML strict, the first thing on the page should be an <?xml tag, but if it is then IE6 goes into quirks mode?

krycek
12-15-2002, 06:00 PM
yes... sort of.

As far as I understand, the xml tag isn't even necessary. I am not sure why it should be there... my code is still valid XHTML without it, and IE mucks up with it. So, leave it out :)

::] krycek [::

brothercake
12-15-2002, 06:07 PM
XHTML is XML, so really it should start with an <?xml declaration, to be 100% valid. Not necessary in practise, but correct in theory.

There are big advantages though - in mozilla if you treat XHTML as XML - and configure your server to associate .xhtml with application/xml+xhtml you get a much better result - no pointless attempts to display erroneous coding - you get an XML parsing error if you make a mistake :)


But unfortunately ... IE doesn't understand this ... .xhtml as anything other than text/html makes it prompt for a download :(

jkd started a thread (http://www.codingforums.com/showthread.php?s=&threadid=10405) about this .... don't think a full solution was found for Apache, but a friend told me that IIS can use Response.Header to write browser-conditionalised mime types.

jkd
12-15-2002, 06:36 PM
Originally posted by brothercake
XHTML is XML, so really it should start with an <?xml declaration, to be 100% valid. Not necessary in practise, but correct in theory.

The <?xml?> processing instruction is actually optional. An XML viewer should be able to "guess" at the encoding by the first few characters and such.