"Should I learn HTML or XHTML?"


I've actually been asked this question several times lately, where someone wants to either brush up on their little used and mostly forgotten skills, or is looking to learn from scratch. The answer to the question is simple: XHTML all the way, and here are my reasons:

  • With XHTML you have to close every tag, rather than e.g. leaving paragraph tags hanging around on their own. This will lead to much more organized and clean code as all tags will be correctly nested.
  • Cleaner code will lead to fewer bugs as it will be easier to keep track of the code.
  • Having all attribute values in quotes means you longer have to wonder why your <img src=/images/oh so important.png> image doesn't work right.
  • The syntax rules force others providing content for the site also have to keep their work in check, which can avoid conflicts.
  • XHTML means no font tags, so you have to do your design in CSS. This starts pushing sites towards separating the content from the presentation, which is a very good thing.
  • XHTML doesn't allow the BLINK or MARQUEE tags, which should be the number one reason to use XHTML - they're evil and as developers it is our job, neigh our duty, to save managers from themselves.
Subscribe to XHTML