SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: On doctypes

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    Arnhem, The Netherlands
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question On doctypes

    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.

  2. #2
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,892
    Mentioned
    123 Post(s)
    Tagged
    1 Thread(s)
    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).


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •