treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Using HTML5 tags with the wrong DOCTYPE....

  • I'm currently working with an outdated CMS that contains the following DOCTYPE,

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    

    Is it okay to use HTML5 tags anyway?

  • Is there some reason why you can't change the doctype?

    Obviously to support older IE you will have to use the shim/shiv if you do.

  • Sadly, there's no way for me to change it, I would if I could.

  • I THINK all the HTML5 tags need is for an HTML doctype to be declared.... I don't think it matters what it is.

    As I said though, IE8/(9?) will need the shim/shiv.

  • Yes of course, I will include the shim/shiv. Thanks for the info!

  • I think Paulie_D is right, having any doctype is afaik enough for rendering consistently across browsers (no quirks modes). When validating you can override the doctype.

    I would however do a search in your CMS files for the doctype string and change it hardcode style :P If it's in the generated output, it must be somewhere.

  • Correct - the only purpose a doctype serves is to trigger "standards mode" (i.e., "not quirks mode"). Any doctype that starts with <!doctype html... will do that in all major browsers. Browsers don't even care what comes after.

    (In fact, that's how the html5 doctype was decided upon - it's the minimum markup required to trigger standards mode.)