why w3c has the conventions of different Doc-types .. ? Instead they could have recommended only one Doc-type开发者_如何学Python (say loose type.. as it would prone to less number of SILLY errors) and would have standardized it to all browsers (including the ones in mob and PDAs) ..
I haven't got any satisfying answer in any tutorial yet .. I have been reading "how these different Doc-types differ in" but I want to know do we really need it ???That's what HTML5 is going to:
<!DOCTYPE html>
You should probably listen to the Hanselminutes with Molly Holzschlag. They discuss the question with Scott in detail.
Molly Holzschlag: So really, when we think about DOCTYPEs, we're thinking about something that was very passive and was never meant to be what it does now.
...
So we now have this DOCTYPE switching and this now puts a lot of pressure on the DOCTYPE to be something more than it ever was. It is essentially a hack, but it was one that was necessary to advance the web I think and that's why I wanted to call out some people there to let folks know that there's some good work that people have done. But it also added a layer of confusion for that reason. So it's interesting when we compare the DOCTYPEs now. We go over to HTML 5.0 and we look at the DOCTYPE and the DOCTYPE is simply angle bracket, exclamation point, DOCTYPE in lowercase HTML. That is the DOCTYPE. There's nothing else.
The old doctypes (pre-HTML 5) are standardized mechanisms in SGML to embed version and validation information. If you use a full-featured SGML workflow, they offer great possibilities to automatically process the file.
In this context the different DOCTYPES of HTML 4/XHTML 1 were then (10 years ago) quite a nice idea. They allowed the authors to say: "Oh, I've an old page, and I'm bound to use this and that tag." or "Yes, I use the newest and cleanest markup out there. I know what I'm doing."
Why this "public identifier" stuff and so? One example of the benefit: It allows to store locally (and re-assign later) the DTD of any HTML file and let's you validate it even without Internet access. (Remember: SGML was standardized in the 80's.)
The current standards have three Doctypes per language, each has their own place:
- Frameset — I'm using frames
- Transitional — This standard came out in the mid-90s and I'm not ready to use CSS yet
- Strict — CSS is ready
Well, the evolution of a standard such as doctypes is always a process of committees sitting together and working out a standard; the real word implementing the standard; errors and failures of the standard becoming visible; and the committee working out a new, improved standard, but not being able to start from scratch because backwards compatibility must be retained. So, fixes and workarounds are introduced so that the new standard can be used without breaking the old one.
A lot of silly things have developed that way.
As the other answers point out, HTML 5, though, promises some improvement on that front.
精彩评论