Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > What for does one need doctype?

Reply
Thread Tools

What for does one need doctype?

 
 
test@loctopus.com
Guest
Posts: n/a
 
      05-23-2006
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/

 
Reply With Quote
 
 
 
 
Chaddy2222
Guest
Posts: n/a
 
      05-23-2006

http://www.velocityreviews.com/forums/(E-Mail Removed) 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/

 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      05-23-2006
Chaddy2222 <(E-Mail Removed)> 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.

 
Reply With Quote
 
Chaddy2222
Guest
Posts: n/a
 
      05-23-2006

Jukka K. Korpela wrote:
> Chaddy2222 <(E-Mail Removed)> 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

 
Reply With Quote
 
Travis Newbury
Guest
Posts: n/a
 
      05-23-2006
(E-Mail Removed) 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

 
Reply With Quote
 
Steve Pugh
Guest
Posts: n/a
 
      05-23-2006
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

 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      05-23-2006

Jukka K. Korpela wrote:
> Chaddy2222 <(E-Mail Removed)> 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)

 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      05-23-2006
(E-Mail Removed) <(E-Mail Removed)> scripsit:

> Jukka K. Korpela wrote:
>> Chaddy2222 <(E-Mail Removed)> 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/

 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      05-23-2006
On 23 May 2006 06:28:06 -0700, "Travis Newbury"
<(E-Mail Removed)> 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...
 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      05-23-2006
On Tue, 23 May 2006 23:37:39 +0300, "Jukka K. Korpela"
<(E-Mail Removed)> wrote:

>(E-Mail Removed) <(E-Mail Removed)> scripsit:
>
>> Jukka K. Korpela wrote:
>>> Chaddy2222 <(E-Mail Removed)> 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?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can one declare more than one signal on one line? Merciadri Luca VHDL 4 11-01-2010 02:00 PM
Nike air force one, air force 1, air force one low cut, air force one abdul_razak@indiatimes.com Digital Photography 2 12-31-2008 04:29 PM
Samsung SCD6040 - Anyone have one, used one, or have reviews on one? g wills Digital Photography 0 09-08-2004 08:06 PM
CSS aligning two things on one line with one left and one right news.frontiernet.net HTML 6 04-16-2004 02:44 AM
Using One XSLT and multiple XML Problem (One is XML and another one is XBRL) loveNUNO XML 2 11-20-2003 06:47 AM



Advertisments