Yes, that’s right, you can use the HTML5 Doctype (<!DOCTYPE html>) now, if you want to. It’s certainly not necessary, but there’s several good arguments for implementing it sooner rather than later, and not many arguments against it. First things first, check out the incredibly insightful Misunderstanding Markup comic written by Jeremy Keith. Jeremy explains the differences between XHTML 1 and 2, and HTML, and boils down the “which doctype to use” argument to personal preference. So what are the reasons, if any, not to use HTML5?

There’s a good summary in a Stack Overflow question about using the HTML5 doctype:

Well consider this:

When serving as text/html, all you need a doctype for is to trigger standards mode. Beyond that, the doctype does nothing as far as browsers are concerned.

When serving as text/html, whether you use XHTML markup or HTML markup, it’s treated by browsers as HTML.

So, really it comes down to using the shortest doctype that triggers standards mode (<!DOCTYPE html>) and using HTML markup that produces the correct result in browsers.

The rest is about conforming, validation and markup prerference.

With that said, using <!DOCTYPE html> now and trying to make your markup conform to HTML5 is not a bad idea as long as you stick to stable features that work in browsers now. You wouldn’t use anything in HTML4 or XHTML 1.x that doesn’t work in browsers, would you?

In other words, you use <!DOCTYPE html> with HTML4-like markup while honoring things that have been clarified in HTML5. HTML5 is about browser compatibility after all.

The downside to using HTML5 now is that the spec can change quite often. This makes it important for you to keep up with the spec as it actively changes. Also http://validator.nu/ might not always be up-to-date, but http://validator.w3.org/ isn’t always up-to-date either, so don’t let that stop you.

Of course, if you want to use XHTML 1.0 markup and conform to XHTML 1.0, then you shouldn’t use <!DOCTYPE html>.

Personally, I always use <!DOCTYPE html> for HTML.

So there’s a slight chance you could have a problem validating your markup. And there’s a very slight chance that a change to the HTML5 standard will result in a different doctype. But mainly it comes down to personal preference. If you want to write XHTML syntax and have it validate against an XHTML DTD, then you would have to use an XHTML doctype.

Personally, I like XHTML syntax. I use self-closing tags, always write in lowercase, and use quoted attributes. But when I validate my markup, I’m mainly looking to correct issues that would break the document display. I dislike some of the more unnecessarily strict validation rules, like including a “type” attribute on script tags, and putting inputs inside block level elements. HTML5 offers the best of both worlds, allowing you to write XHTML syntax (which mainly means self-closing tags), while not requiring as many crazy rules. So why not have the option?

The other big advantage of using the HTML5 doctype now, is that it allows you to implement some of the HTML5 components that are currently supported cross-browser. You can use native drag and drop, “block-level” links, and the new, more semantic elements with an HTML5 doctype now, but not with the XHTML doctype.

So I guess if you really want your markup to validate as XHTML, you can use the XHTML doctype. But otherwise, use the HTML5 doctype, and look forward to browser adoption of some of the cooler HTML features!

About

Not Just a Hat Rack (NJHR) focuses on best practice solutions for problems you’ll encounter during a typical site build. There’s an emphasis on new technology when possible (HTML5, CSS3, etc.), but all suggested solutions will work cross-browser, quickly and efficiently. more »

I'm Andrew Church, an aspiring web developer currently living and working in Washington, DC. I’ve been employed as a professional developer since 2004, when I graduated with a degree in Information Sciences & Technology from Penn State University. I'm particularly interested in front-end web development technologies (HTML, CSS, JavaScript), but I do have experience with the entire site build process. « less

Tweets

Delicious