You are here: Re: doctype conditionals « HTML « IT news, forums, messages
Re: doctype conditionals

Posted by Jukka K. Korpela on 07/19/07 10:48

Scripsit osmanjaro:

> On a recent experiment with getting ie6 to work I did something that
> feels wrong, but works.

For some odd value of "works", I suppose.

> I know conditional comments work well for loading stylesheets and
> javascript.

Browser-specific tricks for IE "work" for some versions of IE.

> Why not doctypes?

Why would you play such a game? There's a lot you can lose, but is there
anything you could win?

> Its only ie6 that gets the transitional doctype,
> everyone else gets strict.

The point being? IE does not understand document type definitions any more
than pigs appreciate silver plates (excuses to our porcine friends for this
somewhat unfair metaphor). It only looks at the doctype string to make its
foolish choice between Quirks and "Standards" (i.e., less broken) rendering
mode. Here it does not matter whether it's Strict or Transitional, as long
as you use the exact string specified in HTML specifications.

> <!-- Quirk on -->
> <!--[if IE 6]>
> <!DOCTYPE html
> PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
> <html lang="en">
> <![endif]-->
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> ...
>
> I'm sure this is bad.

So why do you use it?

> IE6 made me do it.

Even the &Devil; should not be accused for something that he clearly did not
do.

Using HTML 4.01 and XHTML 1.0 as "conditional" alternatives is just madness.
Using XHTML 1.0 is pointless on the web, so you have really messed things
up.

If you just want IE 6 to go to Quirks mode and other doctype sniffers to go
to "Standards" mode, use just the following, followed by a doctype
declaration that corresponds to the actual markup you have used:

<!-- IE 6, Jukka K. Korpela commands you to go to Quirks mode. -->

Try it. It works. (Someone will probably soon send a spoiler that reveals
_why_ it works, so try it _now_.)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация