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

HTML Forum

    
Doctype statement in todays websites ?
Digmen1

5+ Year Member



 
Msg#: 4538253 posted 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

WebmasterWorld Senior Member swa66 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4538253 posted 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

WebmasterWorld Administrator incredibill us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4538253 posted 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

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4538253 posted 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

WebmasterWorld Senior Member fotiman us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4538253 posted 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

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4538253 posted 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

5+ Year Member



 
Msg#: 4538253 posted 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

WebmasterWorld Senior Member fotiman us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4538253 posted 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

5+ Year Member



 
Msg#: 4538253 posted 8:26 am on Jan 23, 2013 (gmt 0)

I see, thanks

pshea

10+ Year Member



 
Msg#: 4538253 posted 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

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4538253 posted 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

WebmasterWorld Senior Member fotiman us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4538253 posted 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

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4538253 posted 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

WebmasterWorld Senior Member fotiman us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4538253 posted 11:50 pm on May 23, 2013 (gmt 0)

Nope. But I wouldn't recommend omitting it.

drhowarddrfine

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4538253 posted 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