Any reason not to start using the HTML 5 doctype?
It is supposed to be backwards compatible with HTML4 and XHTML. John Resig posted about some of the benefits.
As long as we don't use any of the new and not supported yet features, would there be any downside to start building sites with this 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.
My question to you would be why use it if you don't use any of the new/unsupported features. I'm not saying you couldn't play around with it, but why start building sites with a doctype that offers no benefits and could be supplemented by XHTML5.
I'd say use it and test extensively. Then let us know if it blew your house up or something. :')
链接地址: http://www.djcxy.com/p/15700.html上一篇: 如何使用xsl:output获取带有网址的doctype标记
下一篇: 任何不开始使用HTML 5文档的理由?