![]() |
|
|
|||||||
![]() |
HTML - What for does one need doctype? |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Hi everybody,
What for does one need to use doctype? I did not put this tag into my HTML code and everything looks OK (besides that HTML-validator tells me that my document is not valid). Can the absence of the doctype lead to more significant problems? ----------------------- Easy and free advertisement of your web-site! http://www.loctopus.com/ test@loctopus.com |
|
|
|
|
#2 |
|
Posts: n/a
|
wrote: > Hi everybody, > > What for does one need to use doctype? I did not put this tag into my > HTML code and everything looks OK (besides that HTML-validator tells me > that my document is not valid). Can the absence of the doctype lead to > more significant problems? Well, in a lot of ways yes. The document type decleration (DTD) tells the web browser what type the document is and what set of rules to use when displaying the website. As an example, when a half doc type is used, that validates, it gives the browser some clue as to how to read or pass the source code of the page, if a half doc type is used, the browser will use quirks mode, even if the page validates, for a site to be in standards compliant mode, it needs the full W3C identifyer. While a page may look ok in your web browsers in full quirks mode, you need to make sure your pages validate so they work on other devices such as mobile phones. It should also be noted that my site does validate, however when I do a re-design soon I will be transfering the DTD to a strict DTD rather then transitional. -- Regards Chad. http://freewebdesign.cjb.cc/ |
|
|
|
#3 |
|
Posts: n/a
|
Chaddy2222 <> scripsit:
> The document type decleration (DTD) tells the web browser what type > the document is and what set of rules to use when displaying the > website. No it doesn't. The OP will find better answers by looking at the group archives at http://groups.google.com . The issue has been discussed so many times that people are tired of it, so you mostly get answers from people who didn't bother checking things out either. Formally, the DOCTYPE declaration refers to a DTD, but browsers don't really even read the DTD. The short answer is that by not using a DOCTYPE declaration exactly as specified in HTML specifications, you probably throw Internet Explorer and some other browsers into "quirks mode", which means intentionally broken (nonstandard) mode of operation. Google for "DOCTYPE sniffing" if you need the dirty details. |
|
|
|
#4 |
|
Posts: n/a
|
Jukka K. Korpela wrote: > Chaddy2222 <> scripsit: > > > The document type decleration (DTD) tells the web browser what type > > the document is and what set of rules to use when displaying the > > website. > > No it doesn't. <snip> Yeah well, strictly speeking it doesn't however it does tell a web browser how to render the page. The issue has been discussed so many > times that people are tired of it, so you mostly get answers from people who > didn't bother checking things out either. Formally, the DOCTYPE declaration > refers to a DTD, but browsers don't really even read the DTD. Yeah well, I believe I explained this in my previous post, however I will admit I am still learning about issues to do with the DTD myself. But most browsers will read the DTD, however some choose to ignore it, depending on the browser and DTD used. > > The short answer is that by not using a DOCTYPE declaration exactly as > specified in HTML specifications, you probably throw Internet Explorer and > some other browsers into "quirks mode", which means intentionally broken > (nonstandard) mode of operation. Google for "DOCTYPE sniffing" if you need > the dirty details. Yes, I believe I did write something to that effect also. -- Regards Chad. http://freewebdesign.cjb.cc |
|
|
|
#5 |
|
Posts: n/a
|
wrote:
> What for does one need to use doctype? I did not put this tag into my > HTML code and everything looks OK (besides that HTML-validator tells me > that my document is not valid). Can the absence of the doctype lead to > more significant problems? Depends if the page looks ok without it, and you don't care about validation then you don't "need" it |
|
|
|
#6 |
|
Posts: n/a
|
Chaddy2222 wrote:
> But most browsers will read the DTD, however some choose to ignore it, No. No browser reads the DTD for HTML. IE doesn't, Firefox doesn't, Opera doesn't, Safari doesn't, Lynx doesn't. > depending on the browser and DTD used. Not unless you're talking about XML documents served as XML in which case some browsers will fetch the DTD under some circumstances. But that's irrelevant for HTML and for XHTML served as HTML. Don't confuse the browsers' use of the doctype as a magic code to switch rendering modes with anything to do with actually fetching and reading the DTD referenced by the doctype. Steve |
|
|
|
#7 |
|
Posts: n/a
|
Jukka K. Korpela wrote: > Chaddy2222 <> scripsit: > > > The document type decleration (DTD) tells the web browser what type > > the document is and what set of rules to use when displaying the > > website. > > No it doesn't. While Chaddy's answer is certainly partial (I too am too bored to bother re-posting half of Google) in what way is it strictly "wrong" ? > > The document type decleration (DTD) tells the web browser what type the document is > > what set of rules to use when displaying the website. Now these, especially the second, are a condemnation of browsers as much as anything, but as empirical observations about how browsers actually function, then what's wrong with them? To the OP: Google search through c.i.w.a.h You'll learn more than you probably wanted to know. You might even learn how to expand your killfile as an idiot pruner (VK and the darling Andkon springs to mind) |
|
|
|
#8 |
|
Posts: n/a
|
<> scripsit:
> Jukka K. Korpela wrote: >> Chaddy2222 <> scripsit: >> >>> The document type decleration (DTD) tells the web browser what type >>> the document is and what set of rules to use when displaying the >>> website. >> >> No it doesn't. > > While Chaddy's answer is certainly partial (I too am too bored to > bother re-posting half of Google) in what way is it strictly "wrong" ? It is wrong*) because it is contrary to actual facts. That is, neither the document type declaration nor the DTD**) says such a thing, in principle or in practice. *) That is: incorrect, false. I don't know your definition for "strictly 'wrong'". **) DTD = document type definition. "Chaddy2222" apparently does not know the difference between this and the document type declaration. This is quite common, but it still makes her or him unqualified to give assistance on matters like this. -- Yucca, http://www.cs.tut.fi/~jkorpela/ |
|
|
|
#9 |
|
Posts: n/a
|
On 23 May 2006 06:28:06 -0700, "Travis Newbury"
<> wrote: >Depends if the page looks ok without it, and you don't care about >validation then you don't "need" it Totally the wrong attitude. Pages, even the worst, rarely "look wrong" for their original author, or else they'd fix them. The point about validation is that it's objective, so that those of us using vaguely standards-aware browsers can still read pages that were authored by IE-users. Of course pathological use of incredible <font> sizes and absolute positioning can still break anything that doesn't have the exact screen resolution of a WebTV, but that's trailer parks for you... |
|
|
|
#10 |
|
Posts: n/a
|
On Tue, 23 May 2006 23:37:39 +0300, "Jukka K. Korpela"
<> wrote: > <> scripsit: > >> Jukka K. Korpela wrote: >>> Chaddy2222 <> scripsit: >>> >>>> The document type decleration (DTD) tells the web browser what type >>>> the document is and what set of rules to use when displaying the >>>> website. >>> >>> No it doesn't. >> >> While Chaddy's answer is certainly partial (I too am too bored to >> bother re-posting half of Google) in what way is it strictly "wrong" ? > >It is wrong*) because it is contrary to actual facts. That is, neither the >document type declaration nor the DTD**) says such a thing, in principle or >in practice. OK, now I see your point (to some extent). The DTD clearly doesn't tell the browser anything because it doesn't even get loaded. So how would you feel about this: "The document type declaration (*) tells the web browser what type the document is and what set of rules to use when displaying the website." What's wrong with that? I'm pretty pedantic, but I can't pick a hole in that without stretching the meaning of "type" almost to breaking point. Commonplace browsers _do_ categorise the content offered, they do this according to rules that do involve the doctype, and they do vary their rendering behaviour on the basis of this. Secondly, what might you replace "*" with ? "Doctype" is the colloquial argot for it, but would you agree with that? |
|