homepage Welcome to WebmasterWorld Guest from 54.205.254.108
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Doctype statement in todays websites ?
Digmen1




msg:4538255
 7:51 am on Jan 22, 2013 (gmt 0)

Just wondering which is the best Doctype statement to use for the average website these days?

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

or

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

Thanks

 

swa66




msg:4538260
 8:20 am on Jan 22, 2013 (gmt 0)

I'd go for <!DOCTYPE html>
But new stuff I make is nowadays in polyglot (x)HTML5 anyway, never done HTML4.01 myself, always used xhtml during the era html4.01 was popular...

incrediBILL




msg:4538268
 9:13 am on Jan 22, 2013 (gmt 0)

I concur with <!DOCTYPE html> and HTML 5 as 4.01 is old school, no future in it unless you like building things that are obsolete before they're even finished.

lucy24




msg:4538291
 10:28 am on Jan 22, 2013 (gmt 0)

I think the question was about "transitional" vs. "strict". Personally I've never seen any reason for "strict". You can make a document that 100% follows the rules for Strict, and call it Transitional. But not the other way around.

Fotiman




msg:4538335
 1:58 pm on Jan 22, 2013 (gmt 0)

I agree, use the HTML5 DOCTYPE:
<!DOCTYPE html>
It's short, easy to remember, and backwards compatible with HTML 4.01.

If your question is strict vs. transitional HTML 4.01, I'd go with strict. Transitional allows you to use presentational elements/attributes that have been deprecated, which allows for sloppy coding habits that will ultimately only make your job harder. If you're writing strict documents, then use the strict doctype. It's really only used for validation purposes, so using a transitional doctype may give you a false sense that you've written only strict markup.

drhowarddrfine




msg:4538563
 5:05 am on Jan 23, 2013 (gmt 0)

No new web pages have a need for the transitional doctype. The sold purpose of transitional is for web pages being transitioned to strict but still containing old deprecated markup from before 1999! You shouldn't be using old deprecated markup!

The doctype <!DOCTYPE html> puts all browsers into strict standards mode including as far back as IE6. This is the only doctype anyone should use anymore for HTML.

Digmen1




msg:4538572
 5:21 am on Jan 23, 2013 (gmt 0)

Thanks
I think I understand what you are saying, you mean use the Strict one.

But they both start with <!DOCTYPE html>

Fotiman




msg:4538582
 5:59 am on Jan 23, 2013 (gmt 0)

No, I don't think you do understand. This, in it's entirety, is the HTML5 Doctype:


<!DOCTYPE html>

That's it. No less, no more. That's all you need and all you should be using.

Digmen1




msg:4538608
 8:26 am on Jan 23, 2013 (gmt 0)

I see, thanks

pshea




msg:4577160
 6:37 pm on May 23, 2013 (gmt 0)

So literally, this is the start of a new page?

<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My document</title>

lucy24




msg:4577186
 7:34 pm on May 23, 2013 (gmt 0)

Yes. There are a couple of threads elsewhere in the html subforum about the changing definition of "standards". In the past there was HTML2, HTML3, HTML4. In the future there will be HTML and-that's-all.

The dtd shouldn't have a huge effect on the browser's behavior in any case. All of mine are perfectly happy to handle <wbr> in documents marked HTML 4-- so long as I don't try to validate. (The validator doesn't know that you've used an html5 construct. It only knows that it isn't html4. You could have said <xyzzy> for all it cares.)

Fotiman




msg:4577191
 7:38 pm on May 23, 2013 (gmt 0)

That certainly is a valid HTML5 document, though personally I would still include the <html> tag. Note, the original question was regarding the DOCTYPE, and the <html> tag is not a part of the DOCTYPE. Also, the meta tag can be shortened in HTML5 as well.
Here's the ideal starting point, in my opinion.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>My document</title>
<!-- Put styles in the head, but make sure charset is 1st -->
</head>
<body>
<!-- Put scripts just before closing body tag -->
</body>
</html>

lucy24




msg:4577195
 7:48 pm on May 23, 2013 (gmt 0)

Oops, my bad, I overlooked the missing HTML. That absolutely has to be present, doesn't it?

Fotiman




msg:4577237
 11:50 pm on May 23, 2013 (gmt 0)

Nope. But I wouldn't recommend omitting it.

drhowarddrfine




msg:4577475
 4:29 pm on May 24, 2013 (gmt 0)

<meta charset="utf-8" />
Please note this: The closing slash on that meta tag is XML, superfluous, and ignored in HTML5. In HTML4, it's an error because it's a XML closing tag. It serves no purpose at all unless you are serving the page as application/xml+xhtml and I doubt anyone here is.

Some may find this article illuminating: [tiffanybbrown.com...]

Also this one about omitting tags: [w3.org...]

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