Currently I have my website coded in XHTML strict. Can it be converted to HTML5 only by changing doctypes? Or are there other changes I need to make?
-
3If all you want to do is change the doctype, why would you want to go for HTML5? – i.am.michiel Feb 17 '12 at 13:23
-
1@Zenklys, there are many reasons, and like his reason is not only to change the doctype tag. One can be that he prefers the new tags overeverywhere, another might be that he added something and discovered it doesn't validate, a common example being the img onload event.– Henrik Erlandsson Apr 02 '12 at 12:16
3 Answers
A really useful tool for checking if your site is html5 compatible is the W3C Markup Validator. If you update the doctype to <!DOCTYPE html>
and then run the html through the validator, it will show you all instances of where your html is not currently compatible with html5.
This will most likely include changing some self closing tags, some properties may have changed and if you truly want to be html5 up to date (rather than just compatible) you should consider using the <header>, <nav>, <section>, <article>
tags, instead of just normal divs.
Updating may also make your page look different on non compatible browsers, in this case I recommend using html5shiv so that older versions of IE support the new tags that you're using.

- 237
- 4
- 12
You also have to change many tag elements if you want "true" HTML5 such as menu, section, footer... Also it may require some changes in CSS as in HTML5 all elements have div's properties. And you'll need to use some scripts to support HTML5 in old IEs.

- 1,297
- 11
- 29
-
I would advise against using the menu tag at the moment. Also not "all elements" in HTML5 have div's properties. – Ian Devlin Feb 17 '12 at 14:58
XHTML works fine in HTML5 and is nicknamed 'XHTML5' but, if you're not serving it as application/xhtml+xml, then you're not getting any of those advantages. You shouldn't be using XHTML if you're not serving as such anyway. You're also not gaining anything by just changing the doctype unless you're going to rewrite the current page and add some new elements, use APIs, and all that.
If you are only going to do a step-by-step conversion over time, you can swap doctypes and you probably won't notice any difference. Run it through the validator to check for errors. Fix your errors before moving on.

- 14,746
- 28
- 47
- 65
-
XHTML5 is the XHTML complement of HTML5. XHTML and XHTML5 should not be confused - they are less alike than HTML5/XHTML5 are. Put another way: HTML4.1 is to XHTML1.1 as HTML5 is to XHTML5. – Andrew Barber Feb 17 '12 at 22:26