<DOCTYPE> does not matter!

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Surprised? So was I. Blog author Justin James, who is involved in the W3C's HTML 5 Working Group, discusses this and four other oddities you may not know about HTML in his blog article Five HTML oddities that you may not know

    1. <DOCTYPE> does not matter
    2. Browsers are much more compliant than you think
    3. Compliance does less than you think
    4. Validators cannot cover all of the bases
    5. The <q> tag
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6251
  • Loc: Seattle, WA

Post 3+ Months Ago

Well that certainly was news to me. And I've never even knew <q> existed. But what benefit does the <q> tag impart that couldn't be accomplished with actual, well, quotes?
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

Here's a little bit more background about why Doctype is still a very good idea. At least until a theoretically future proofed browser like IE8 makes them obsolete.

http://www.alistapart.com/articles/beyonddoctype

I think the difference is between no doctype declaration and using the various different ones (strict, transitional, etc)
  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Posts: 5149
  • Loc: SC-USA

Post 3+ Months Ago

Oh great. More crap to remember so I can sound like I have a clue. :roll:



:P
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

I challenge anyone to look through the Firefox source code to see if there's anything that reacts to a DOCTYPE. :D

spork wrote:
Well that certainly was news to me. And I've never even knew <q> existed. But what benefit does the <q> tag impart that couldn't be accomplished with actual, well, quotes?


The browser can use a quotation style with consideration to the visitors language.

I'm not a language expert, but there's bound to be someone out there that scratches their head when they see "this" wondering what the hell those little marks are.
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6251
  • Loc: Seattle, WA

Post 3+ Months Ago

Doh, never even thought of that. French uses chevron-style quotes, for example.
  • Zwirko
  • Guru
  • Guru
  • User avatar
  • Posts: 1417
  • Loc: 55° N, 3° W

Post 3+ Months Ago

Don't know what that guy is on about regarding doctypes. It's presence or absence makes a huge difference in my experience.

I think he's mixing two or three separate issues there in that short section. He's partly right, but wrong overall. He's certainly giving the wrong impression.
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

Zwirko wrote:
Don't know what that guy is on about regarding doctypes. It's presence or absence makes a huge difference in my experience.


Right because the absence makes many browsers go into quirks mode. However, once a doctype is declared it makes little or no difference to the browser if you declare strict, transitional, etc.
  • StarBucks
  • Student
  • Student
  • StarBucks
  • Posts: 85

Post 3+ Months Ago

Great Info, i never noticed the <q> tag before, what's the use of it btw?
  • suzie
  • Guru
  • Guru
  • User avatar
  • Posts: 1134
  • Loc: England

Post 3+ Months Ago

Quote:
Surprised? So was I. Blog author Justin James, who is involved in the W3C's HTML 5


Ah! this came up on a list not too long ago.

It maybe it does'nt matter to Justin and co but it sure matters to the validator.

Validator will not validate a page with no doc type. Come to think of it validator is strict on transitioanal and strict. Both entirely different doc types of course.

Quote:
A DOCTYPE Declaration is mandatory for most current markup languages and without one it is impossible to reliably validate a document.
One should place a DOCTYPE declaration as the very first thing in an HTML document. For example, for a typical XHTML 1.0 document:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>

<title>Title</title>
</head>

<body>
<!-- ... body of document ... -->
</body>

</html>

:mrgreen: :mrgreen:
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

suzie wrote:
It maybe it does'nt matter to Justin and co but it sure matters to the validator.
Right but the point is that it will make no difference what so ever in your browser if you use strict or transitional since the browsers don't really have a switch for that. Its required for validation, but the articles point is that even a valid page won't specifically force a browser to render a page the way you intended it to because the spec is so open.
  • jezzbb
  • Born
  • Born
  • jezzbb
  • Posts: 4

Post 3+ Months Ago

anyways, it doesn't hurt to place the doctype declaration on web pages.
  • Truce
  • Guru
  • Guru
  • Truce
  • Posts: 1477
  • Loc: Washington DC

Post 3+ Months Ago

If you're such a terrible developer that you only care that your code works today and forget tomorrow, well, then you probably don't use DOCTYPES anyways so there's no news here.

What's different about XHTML from HTML? The fact that it's not as sloppy since that does nothing but contribute to the number of ambiguous rendering situations. If we start throwing away DOCTYPES because current browsers can't manage to utilize them properly we're throwing away hope for a more predictable development experience and letting the browsers lead the way (the same thing that got us into the position we are in now with IE).
  • Zwirko
  • Guru
  • Guru
  • User avatar
  • Posts: 1417
  • Loc: 55° N, 3° W

Post 3+ Months Ago

Transitional:
Image

Strict:
Image

The particular flavour of doctype used can indeed change the way a page is rendered - as the above images clearly demonstrate. Those images are of very simple unordered lists, with very little styling, appearing in a floated div. The differences in rendering are not subtle.
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

Zwirko wrote:
The particular flavour of doctype used can indeed change the way a page is rendered - as the above images clearly demonstrate. Those images are of very simple unordered lists, with very little styling, appearing in a floated div. The differences in rendering are not subtle.


are you using HTML (strict/transitional) or xHTML (strict/transitional) I think browsers do follow the xHTML one but not the other...
  • Zwirko
  • Guru
  • Guru
  • User avatar
  • Posts: 1417
  • Loc: 55° N, 3° W

Post 3+ Months Ago

It does that with either HTML 4.01 or XHTML DTD's; the strict/transitional difference is the same.

You are essentially correct though. I'm just splitting hairs by finding the exception to the rule. These sorts of differences were far more pronounced a few years ago than they are now.

Also, it seems as if I don't know my own work. Those images I posted are of text within <code> tags (not in <ul>'s as I'd previously stated).
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

This is more out of curiousity than a desire to stop using a doctype (at least until IE8 makes them obsolete and all the other browsers follow course) but which browsers did you test that with?
  • Zwirko
  • Guru
  • Guru
  • User avatar
  • Posts: 1417
  • Loc: 55° N, 3° W

Post 3+ Months Ago

The screengrabs were taken while viewing the page with Opera 9.62.

I done some testing later with other browsers too: Firefox 3 does the exact same thing as Opera. IE7 displays it like the transitional image regardless of what doctype is used.

The HTML 5 doctype looks interesting: <!DOCTYPE html>
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

Code: [ Select ]
<!DOCTYPE html>


I bet a DOCTYPE like that is going to go over like the <script type> from <script language> transition.

Post Information

  • Total Posts in this topic: 19 posts
  • Users browsing this forum: No registered users and 37 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.