homepage Welcome to WebmasterWorld Guest from 54.211.201.65
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Doc Type Declaration
Does it have to be included
Michaeldd




msg:574024
 12:22 am on Jun 15, 2003 (gmt 0)

I have pages that were written without a beginning doc type declaration. Most validators proceed without producing an error, but some highlight an error stating that the doc type declaration is a must.
What up with this?

 

victor




msg:574025
 8:16 am on Jun 15, 2003 (gmt 0)

A!DOCTYPE tells a browser unambiguously what variant of HTML or XHTML you are using.

Without it, each browser may interpret some tags differently, leading to a rendering that is more varied between browsers than you'd want.

Without it, many browsers will drop into "quirks" mode -- meaning they'll assume you've coded to match their bugs. If you've actually written clean, validated code chances are this means they've mis-interpreted some of your code.

With it, you aren't guaranteed that browsers won't exhibit bugs -- after all, they all have them, but you are better assured that the page will render correctly across a wide range of browsers.

Some more information at:

[oreillynet.com...]

tedster




msg:574026
 8:47 am on Jun 15, 2003 (gmt 0)

Welcome to WebmasterWorld, Michaeldd.

You certainly CAN have pages with no DTD, the web is full of them. But for a validator to do anything more than a surface check for unclosed tags and bad nesting, it is going to need the DTD.

Speaking personally, validating to a full DTD has taught me a lot - in areas where I thought I already had it nailed.

I also thought this might be a good place to give the link to the W3C's list of valid DTDs [w3.org]. Finally all gathered together in one place. And that place is the source of the HTML standards, so it's the right place to check.

Michaeldd




msg:574027
 1:28 pm on Jun 15, 2003 (gmt 0)

Thanks for the replys...I'm adding DTD to my pages now.

Mike

g1smd




msg:574028
 1:52 am on Jun 18, 2003 (gmt 0)

If you want to check your pages without DTDs then try [validator.w3.org...] as that has selector boxes that allow you to set the !DOCTYPE and the Character Encoding for the page without needing it actually on the page.

However, long term, you should aim to add these elements to your code on every page.

You might also want to consider what else you put in the header. For most people, code on each page begins something like:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> Your Title Here </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="EN-GB">
<meta name="Keywords" content=" your, keyword, list, here ">
<meta name="Description" content=" Your Description Here. ">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
</head>


Code within the page:

I use: <a href="somepage.html" title="some text here"></a> for links.

I use <img src="somefile.png" alt="some text"> for images.

Headings are done with <hx></hx> tags, properly used from <h1></h1> downwards.

[edited by: g1smd at 2:11 am (utc) on June 18, 2003]

visibot




msg:574029
 1:57 am on Jun 18, 2003 (gmt 0)

> Without it, many browsers will drop into "quirks" mode...

Never heard it put that way before - I like it. ;-)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved