Doctype tags at the top of the page

T

The Keith

I've noticed that the latest version of dreamweaver (MX 2004) adds:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

to the top of every page. I noticed that this causes certain things to
behave differently. I know it has something to do with defining the
standards used on that page, but I was wondering why if this is so important
did they just decide to include the url in the latest version only (wasn't
in the older versions)? What exactly does that url do--does the page
everytime it loads, look something up on that site to decide how to
interpret certain html/css and if so, what if their server is down--can that
affect your site?

I'm a bit confused can someone please explain it to me -- thanks.
 
M

Matthias Gutfeldt

The said:
I've noticed that the latest version of dreamweaver (MX 2004) adds:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

to the top of every page. I noticed that this causes certain things to
behave differently.

Yep. You're a victim of the dreaded Doctype Switch. Check out
<http://gutfeldt.ch/matthias/articles/doctypeswitch.html>



I know it has something to do with defining the standards used on
that page, but I was wondering why if this is so important
did they just decide to include the url in the latest version only (wasn't
in the older versions)?

"7.2 HTML version information
<http://www.w3.org/TR/REC-html40/struct/global.html#h-7.2>:
A valid HTML document declares what version of HTML is used in the
document. The document type declaration names the document type
definition (DTD) in use for the document"

"List of valid DTDs you can use in your document."
<http://www.w3.org/QA/2002/04/valid-dtd-list.html>


Matthias
 
D

DU

The said:
I've noticed that the latest version of dreamweaver (MX 2004) adds:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

to the top of every page. I noticed that this causes certain things to
behave differently. I know it has something to do with defining the
standards used on that page, but I was wondering why if this is so important
did they just decide to include the url in the latest version only (wasn't
in the older versions)? What exactly does that url do--does the page
everytime it loads, look something up on that site to decide how to
interpret certain html/css and if so, what if their server is down--can that
affect your site?

I'm a bit confused can someone please explain it to me -- thanks.

There are 3 reasons why you would always want to include a doctype
declaration in all of your documents.

What really matters with this issue is that by choosing an appropriate
doctype declaration, you can make most browsers (namely MSIE 6 for
Windows which is the most popular browser in use on the web: over 50% of
all users on the web are using it) render the webpage in standards
compliant rendering mode. Now, this standards compliant rendering mode
is important to aim for, to seek because most browsers will tend to
render a page in a similar manner, in the same way. When you do that,
your code is also smaller in size and is rendered faster on all W3C web
standards compliant browsers, etc.. with many other positive gains from
such. You should always try to choose a strict DTD for your doctype
declaration.

The other aspect is that with a doctype declaration, your document can
be validated. And a document without a doctype declaration is not a
valid document.


Activating the Right Layout Mode Using the Doctype Declaration
http://www.hut.fi/u/hsivonen/doctype.html

http://www.upsdell.com/BrowserNews/res_doctype.htm (excellent resource)

http://gutfeldt.ch/matthias/articles/doctypeswitch.html

http://gutfeldt.ch/matthias/articles/doctypeswitch/table.html

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
 
K

Kris

DU said:
There are 3 reasons why you would always want to include a doctype
declaration in all of your documents.

What really matters with this issue is that by choosing an appropriate
doctype declaration, you can make most browsers (namely MSIE 6 for
Windows which is the most popular browser in use on the web: over 50% of
all users on the web are using it) render the webpage in standards
compliant rendering mode. Now, this standards compliant rendering mode
is important to aim for, to seek because most browsers will tend to
render a page in a similar manner, in the same way. When you do that,
your code is also smaller in size and is rendered faster on all W3C web
standards compliant browsers, etc.. with many other positive gains from
such. You should always try to choose a strict DTD for your doctype
declaration.

The other aspect is that with a doctype declaration, your document can
be validated. And a document without a doctype declaration is not a
valid document.

And the third reason?
 
T

TheKeith

thanks everyone--that explains a lot. I'm wondering now whether I should
update all my pages to be standards compliant? In this case though, wont
people with older browsers be seeing my site incorrectly, since older
browsers do not support doctype switching?
 
D

DU

TheKeith said:
thanks everyone--that explains a lot. I'm wondering now whether I should
update all my pages to be standards compliant?

Why wouldn't you want to have your page comply with widely recognized
and established W3C web standards? Your pages would render more
consistently across web standards compliant browsers, web-aware
applications, web-aware devices, different media, etc.. The benefits of
authoring compliant webpages are both short term and long term ones and
they largely outnumbers the inconvenients and drawbacks.
With a valid document, you increase your target audience: you do not
diminish your target audience. With a valid document, you increase its
scope, its accessibility, interoperability: you have a better chance of
being rendered accordingly on all kinds of devices, platforms,
softwares, machines, in different contexts, etc.

In this case though, wont
people with older browsers be seeing my site incorrectly, since older
browsers do not support doctype switching?

Old browsers do not support doctype switching because they don't need to
since they only know of 1 rendering mode. Only browsers that offer 2
rendering modes will support doctype switching. But what is important to
know here is that a valid and validated HTML source code of a document
with a doctype declaration defining a DTD will work best in all
browsers, as best as such browser can render the document.

The number one problem on the web is not with validated documents but
rather with poorly coded pages (tag soup) to start with which are based on
- table designs, nested tables, (most of the time, they are
over-constrained too)
- deprecated elements: <font>, <center> are the most frequent ones
- inappropriate use of &nbsp; everywhere for padding, <img
src="spacer.gif"...>,
- document.write(), eval(), "javascript:" in href attributes,
setTimeout(),etc. used thoughtlessly,
- etc,etc.
making webpages which are a monstruous amount of complex code impossible
to update, impossible to understand. If you apply good and sane coding
practices when doing your pages, then your pages should never have
problems of accessibility to content and functionality with older
browser. I personally use different accessibility engines (WAVE 3,
HiSoftware Cynthia, colorblind viewer app., Lynx viewer, MSN-TV
viewer,etc..) to make sure my commercial pages will work in older browsers.

96% of all browsers in use out there have a good (didn't say excellent
nor perfect) support for HTML 4.01, CSS1 properties and DOM1 attributes
and methods. And the remaining 4% should be able to access your webpage
content without a problem if your page is well coded, that is coded in a
manner that it will degrade gracefully.

The very first steps in designing a page is to define, to create in this
order:

1-content, 2-structure, 3-HTML markup code, 4-style sheet/css, 5-script
functions, DHTML

so that if a particular browser (or web-aware application, device,
media, etc.) does not support a latter technology, then the page can and
will still be rendered on a former design level (references to such
unsupported technology are ignored).

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
 
D

David Higgins

The Keith said:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
What exactly does that url do--does the page
everytime it loads, look something up on that site to decide how to
interpret certain html/css and if so, what if their server is down--can that
affect your site?

I am also interested in this question. Although the posts so far seem
informative, none have addressed it. Does anyone have any info?

Thanks
Dave Higgins
 
M

Matthias Gutfeldt

David said:
I am also interested in this question. Although the posts so far seem
informative, none have addressed it. Does anyone have any info?

The URL points to where the DTD resides, simple as that. The page itself
does nothing with it - how could it? It's intended for the browser:

"The URI used as a system identifier with the public identifier allows
the user agent to download the DTD and entity sets as needed."
<http://www.w3.org/TR/html4/sgml/dtd.html>


But AFAIK no browser today 'needs' the DTD. They have their own idea of
what's HTML and what's not, and couldn't care less whether or not your
document follows the rules in the referenced DTD.


Matthias
 
S

Steve Pugh

TheKeith said:
then why does "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN">" affect your page differently than "<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">" if the only difference is that url?

In those browsers that perform doctype sniffing the version without
triggers quirks mode and the version with triggers standards mode.

Steve
 
D

DU

TheKeith said:
then why does "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN">" affect your page differently than "<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">" if the only difference is that url?

You've got a good question here, I would say.

First of all, the W3C specs only recognize these doctype decl.:

http://www.w3.org/QA/2002/04/valid-dtd-list.html

Second, how is standards compliant rendering mode triggered is entirely
dependent on browser manufacturers. Which doctype declarations trigger
which rendering mode is entirely browser dependent.

If I'm not wrong, Opera 6 used to have only 1 rendering mode: standards
compliant. In Opera 7, you now have 2 rendering modes possible. Opera
dev. software also introduced another feature: the user can customize
Opera 7 so that it will always render a page in either renderind mode,
regardless of doctype declaration used.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
 
E

Eric B. Bednarz

Clue challenged implementations.
You've got a good question here, I would say.

First of all, the W3C specs only recognize these doctype decl.:

http://www.w3.org/QA/2002/04/valid-dtd-list.html

For starters, the HTML 4.01 spec doesn't use any of those. Secondly,
ISO8879 doesn't allow for crippled syntax in the first place.

For details on the involved heuristics, see:

<http://catb.org/~esr/jargon/html/C/cargo-cult-programming.html>
<http://catb.org/~esr/jargon/html/V/voodoo-programming.html>

I note that the declaration subsets for HTML 4.0 are not 'valid' anymore
(so far for bugwards compliance), as is ISO HTML, apparantly.
Second, how is standards compliant rendering mode triggered is
entirely dependent on browser manufacturers. Which doctype
declarations trigger which rendering mode is entirely browser
dependent.

Good point; M$' authorative documentation of its homegrown misfeature
implies that you shouldn't use 'standard compliant' mode for mature
applications (for different reasons, I agree).
If I'm not wrong, Opera 6 used to have only 1 rendering mode:
standards compliant.

You are not wrong. There *was* a reason to purchase that browser, once
upon a time.
In Opera 7, you now have 2 rendering modes
possible.

Emulating M$IE's incorrect box model, for example[0]; without the
selector parsing bugs popular workarounds rely upon.
Opera dev. software also introduced another feature: the
user can customize Opera 7 so that it will always render a page in
either renderind mode, regardless of doctype declaration used.

That's a known concept to your inbox; it's called *Opt Out*.

[0] <http://groups.google.com/[email protected]>
| Opera does not employ these techniques, whatever name you give them.
| Opera renders pages the same (that is, as best as it can when the page
| uses reasonable markup) regardless of what DOCTYPE is in use. Opera
| never had a crippled CSS implementation to begin with, and it
| certainly will not add code to mimic for example IE's broken box
| model.
 
D

DU

Eric said:
Clue challenged implementations.




For starters, the HTML 4.01 spec doesn't use any of those.

I'm not sure I understand your reply here. You're replying to my post.
The DTDs listed at the given url are also listed in the
HTML 4[.01] specs:
http://www.w3.org/TR/html401/struct/global.html#h-7.2


Secondly,
ISO8879 doesn't allow for crippled syntax in the first place.

As far as I can see, iso-8879 is about character entities. I fail to see
its relevance here. In any case, it's really what browsers allow and
respond to that matters.
For details on the involved heuristics, see:

<http://catb.org/~esr/jargon/html/C/cargo-cult-programming.html>
<http://catb.org/~esr/jargon/html/V/voodoo-programming.html>

I note that the declaration subsets for HTML 4.0 are not 'valid' anymore
(so far for bugwards compliance), as is ISO HTML, apparantly.




Good point; M$' authorative documentation of its homegrown misfeature
implies that you shouldn't use 'standard compliant' mode for mature
applications (for different reasons, I agree).

I don't like the fact that MSDN and microsoft.com do not set the example
by maturing and upgrading its own website to comply with W3C web
standards. One on hand, it takes time to upgrade an entire website like
microsoft.com. On the other hand, by now, microsoft had all the time
(and resources) to do it (and to upgrade its Front Page software in
conformance to output valid markup). So, I certainly agree with you on this.
If I'm not wrong, Opera 6 used to have only 1 rendering mode:
standards compliant.


You are not wrong. There *was* a reason to purchase that browser, once
upon a time.

In Opera 7, you now have 2 rendering modes
possible.


Emulating M$IE's incorrect box model, for example[0]; without the
selector parsing bugs popular workarounds rely upon.

Opera dev. software also introduced another feature: the
user can customize Opera 7 so that it will always render a page in
either renderind mode, regardless of doctype declaration used.


That's a known concept to your inbox; it's called *Opt Out*.

[0] <http://groups.google.com/[email protected]>
| Opera does not employ these techniques, whatever name you give them.
| Opera renders pages the same (that is, as best as it can when the page
| uses reasonable markup) regardless of what DOCTYPE is in use. Opera
| never had a crippled CSS implementation to begin with, and it
| certainly will not add code to mimic for example IE's broken box
| model.

I don't like this change in markup rendering either; this is going
against what sound and wise website authoring should aim at.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
 
D

DU

Toby said:
DU wrote:




Are you implying that a DTD without a URL is invalid? Because it's not.

I go with what the W3C recommends. And here, what I'm mostly concerned
with and mostly interested in is
1- to have a fully compliant document and
2- a document which will be rendered in standards compliant rendering
mode in all browsers with 2 rendering modes.
Once these 2 goals are achieved, then I'm happy and I'm less concerned
by other issues.

If a DTD without a system ID was invalid, then I would expect the W3C
validator to indicate so. I know there are custom DTDs but then you
*have to* provide the url (system ID) where the formal rules of syntax,
element names, attributes names, etc. can be found and loaded in memory.
For any "PUBLIC" DTD (as against "SYSTEM" DTDs), no URL is needed.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
 
E

Eric B. Bednarz

DU said:
Eric B. Bednarz wrote:

Hint: view source
I'm not sure I understand your reply here.

Human communication usually fails, so there's nothing to worry about
(assuming you are human :).
You're replying to my post.

I'm 100% positive about that, though.
The DTDs listed at the given url are also listed in the
HTML 4[.01] specs:

Those are doctype *declarations*, */not/ _definitions_*.

Section 7.2 is utter complete nonsense, since it doesn't conform with
which


As far as I can see, iso-8879 is about character entities.

Pardon? As far as I can see SGML is about standard generalized markup
and supposed to be HTML's mothership.

A list of normative references is here:
<http://www.w3.org/TR/html401/references.html#h-1.1>
You SHOULD have stumbled upon it when you followed the hyperlink on top
of section 7.2 which indicates for no apparent where you SHALL NOT find
the creeping featurisms that follow (version information, my arse).
I fail to see its relevance here.

That's an established tradition ever since HTML was reverse-engineered
to SGML. You are excused.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top