HTML 5 versus XHTML 1.0 Transitional?

HTML5 is so much easier to write than XHTML 1.0.

  1. You don’t have to manually declare the “http://www.w3.org/1999/xhtml” namespace.

  2. You don’t have to add type attributes to script and style elements (they default to text/javascript and text/css).

  3. You don’t have to use a long doctype where the browser just ignores most of it. You must use <!DOCTYPE html>, which is easy to remember.

  4. You don’t have a choice to include or not include a dtd uri in the doctype and you don’t have a choice between transitional and strict. You just have a strict doctype that invokes full standards mode. That way, you don’t have to worry about accidentally being in Almost standards mode or Quirks mode.

  5. The charset declaration is much simpler. It’s just <meta charset=”utf-8″>.

  6. If you find it confusing to write void elements as <name>, you can use <name/>, if you want.

  7. HTML5 has a really good validator at http://validator.nu/. The validator isn’t bound by a crappy DTD that can’t express all the rules.

  8. You don’t have to add //<![CDATA etc. in inline scripts or stylesheets (in certain situations) to validate.

  9. You can use embed if needed.

Just syntax-wise, when you use HTML5, you end up with cleaner, easier to read markup that always invokes standards mode. When you use XHTML 1.0 (served as text/html), you’re specifying a bunch of crud (in order to validate against a crappy dtd) that the browser will do automatically.

Leave a Comment