hueij — 2011-06-20T18:04:51-04:00 — #1
I noticed on these forums that whenever someone answered questions with included code the doctype in that code is always html4 strict or xhtml1.0 strict.
It is my understanding that doctypes are only needed for not letting browsers show your page in quirks mode.
When i'm using <!doctype html> pages are rendering just fine even if I use html4 or xhtml syntax.
Is it because using the longer (and impossible to remember) doctypes makes it easier to validate? Because that is the only reason I can think of. And it turns out that the simple syntax even worked in all browsers before we even heard of html5.
stevie_d — 2011-06-20T18:52:43-04:00 — #2
In previous versions of HTML, it wasn't guaranteed that future versions would be backwards compatible, so it was important to make sure that the doctype told the browser which version of the language you were using.
Because HTML5 uses the principle of "pave the cow-paths", that's no longer necessary. There's no need to tell the browser which version of the language you're using, because it will work out the same any way round (as long as you're using permitted elements). So yes, it's perfectly OK to use <!DOCTYPE html> (note the capitalisation).