Wrox Programmer Forums
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 2nd, 2004, 12:37 AM
Authorized User
 
Join Date: Jan 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It sounds like I should include it on every page of our website, and not strictly HTML pages.

Thank you for your help.

 
Old March 2nd, 2004, 04:08 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, you should.

A doctype tells the browser what to expect. It tells the browser something like "Hey, I am an HTML document, and I haven't been authored very strict" (using <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> as the doctype)

or it says: "Hey, I am an XHTML document, and I follow every recommend ruled you can imagine (with <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> as the doctype)

Take a look at this article (http://www.alistapart.com/articles/doctype/) for some background and a list of doctypes.

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 3rd, 2004, 04:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I'm sorry but I'm afraid that isn't so. The only thing browsers use the doctype for today is as a trigger for their rendering modes. That has nothing to do with HTML or XHTML, Strict or Transitional.

Moz, Opera et al will refuse to render an XHTML document that isn't well-formed (which isn't the same as valid) if, and only if, it's served with an XML (application/xhtml+xml, whatever) content-type. Served as text/html the document will be treated as the same old HTML tagsoup.

No browser has a validating parser. Not one in common use anyway. I guess there could be an obscure one hiding in a lab somewhere. ;)

There are good reasons to use doctype anyway.

(o<
//\ =^..^=
 
Old March 3rd, 2004, 04:54 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I never said that the doctype will cause the browser to validate the document. All I said that an author of a document can indicate what the document contains; i.e. valid XHTML or not, for example, so the browser can switch to the correct rendering engine.

Of course it's perfectly possible to put an XHTML strict doctype on an invalid document. You'd get a bloody mess..... ;)

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 3rd, 2004, 05:17 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Just my .02...

If you're going to bother with a doctype -- work toward using a strict doctype. As others have already mentioned the loose (or transitional) doctype puts the browser in quicks mode which has adverse effects on things like how the browser interprets positioning and size... quicks mode uses the incorrect interpretation, strict, the correct one. IMHO using strict is the best practice, and until you can get a strictly formed doctype, go ahead and use transitional (that's what its there for). A strict doctype will not allow (er should not according to the w3c) the use of deprecated HTML, a quick rule of thumb for knowing whether an HTML element or attribute is deprecated is if it exists purely for aesthetics it probably is... that's because all the aesthetic-related stuff was moved to CSS. Things like <b>, <i>, , [u].. etc.. or attributes bgcolor= width=, height=.. etc.. all of these are purely aesthetics-related and change how stuff is displayed.

Here's an FAQ that I wrote on the topic (Just ignore the references to PHP)...
http://p2p.wrox.com/topic.asp?TOPIC_ID=4028
This includes links to where these standards are mentioned in that horribly unorganized w3c website.

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old March 3rd, 2004, 05:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

No, you didn't, but the browser would have to do that, or close to, to render the document depending on doctype the way you described. But maybe I misunderstood what you meant.


Fact remains, an invalid document with a XHTML Strict doctype will fare no worse than if it had an HTML 4.01 Transitional doctype with an URL . If it isn't served as XML. Hardly any documents are since IE Win chokes on it. Sorry, but that's the sad state of the Web. A few slashes can only do so much. :(

Don't misunderstand, I'm all for doctypes, me.

(o<
//\ =^..^=
 
Old March 3rd, 2004, 05:32 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
quote:Fact remains, an invalid document with a XHTML Strict doctype will fare no worse than if it had an HTML 4.01 Transitional doctype with an URL .
Yeah, true. And it's the responsibility of the author to make sure the document conforms to the strict rules before you put a strict doctype declaration in the document. Otherwise, it's pretty useless.

Now, with old browsers getting less and less market share, this should be the way to go. use transitional doctypes now, but start preparing for strict doctypes as well.

Nice FAQ, BTW, Rich

Imar

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 3rd, 2004, 05:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Rich, that still isn't so. Strict rendering mode is not equal with strict doctype. They chose that name poorly. That's why I prefer to call it Standards Mode. This "mode" thing was something IE Mac started in its day and they happened to use the way the doctype is written as a trigger. Other followed.

http://www.hut.fi/u/hsivonen/doctype.html

Safari seems to run its own race.

I'm all for a Strict DTD too. But for other reasons.:D

(o<
//\ =^..^=
 
Old March 3rd, 2004, 03:18 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Quote:
quote:Originally posted by meow

Rich, that still isn't so. Strict rendering mode is not equal with strict doctype. They chose that name poorly. That's why I prefer to call it Standards Mode. This "mode" thing was something IE Mac started in its day and they happened to use the way the doctype is written as a trigger. Other followed.
Well I know that they aren't the same thing. Perhaps I should have put it more clearly. The fact remains though that the DTD (or absense of) triggers the rendering mode in all major browsers. So if a strict DTD triggers standards mode then why can't it be called a strict mode? No, choosing the rendering mode isn't why the DTD exists or was created in the first place -- but choosing the rendering mode is one of the things it does (even if this isn't in the w3c recommendation).

: )
Rich


:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET and SSI kwilliams ASP.NET 1.x and 2.0 Application Design 1 March 21st, 2006 11:47 PM
XSL & SSI - Is it possible? kwilliams XSLT 1 August 9th, 2005 09:48 AM
SSI includes in XSLT nrane26 XSLT 1 January 7th, 2005 04:51 AM
Tomcat 5 with SSI ... HELP! HELP! HELP! soxar HTML Code Clinic 1 June 13th, 2004 12:52 AM
Response.Write an SSI hcweb Classic ASP Basics 2 November 2nd, 2003 05:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.