Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
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 October 12th, 2005, 09:56 AM
Registered User
 
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default Why to use <!Doctype...?

Hi,
Why we need to use
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

What r the couses if we don't include this line?

Pls guide.

Rupen Anjaria.:)
------------------
We CAN'T avoid problems, but can solve it.
 
Old October 12th, 2005, 10:14 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Without a doctype you can't validate the document. Even if you don't care about standards, validation is a quick way to find mistakes that may (or may not) lead to problems.

Since some years now browsers have two rendering modes, Standards Mode (AKA Strict Mode) and Quirks Mode. What mode they'll use is triggered by the doctype. No doctype at all will guarantee you Quirks Mode. In that mode browsers emulate older versions of themselves and in same cases older versions of IE (Opera does this). Standards Mode will iron out many (but far from all!) inconsistences between browsers. Either way you go, it's better to choose your rendering mode yourself.

Note that a Strict doctype doesn't necessarily give you Standards Mode and a Transitional Doctype doesn't necessarily give you Quirks Mode. It just so happened that the first browser that did this (IE5 Mac) used the doctype as a trigger and the rest of them of course followed suite.
http://www.hut.fi/u/hsivonen/doctype.html

--
http://yupapa.com
 
Old October 25th, 2005, 04:55 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

also take a look at http://www.htmlhelp.com/tools/validator/doctype.html

www.crmpicco.co.uk





Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS scroll bar code hijacked by <!DOCTYPE tag mat41 CSS Cascading Style Sheets 5 January 17th, 2008 06:06 PM
Include DOCTYPE declaration Pankaj C XSLT 6 October 18th, 2007 08:46 AM
Copying DOCTYPE madanshah16 XSLT 1 August 18th, 2007 12:23 PM
<!DOCTYPE> Tags? kennethjaysone HTML Code Clinic 0 May 18th, 2007 01:39 AM
doctype 4.01 anshul HTML Code Clinic 3 December 28th, 2004 06:24 AM





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