The Relationship between HTML5 and XHTML - dummies

The Relationship between HTML5 and XHTML

By Andy Harris

HTML began as a very simple language for creating web pages. XHTML arose when web development expanded and professional programmers needed something beyond HTML 4. The strict version of XHTML (eXtensible HyperText Markup Language) was considered much more precise and predictable than HTML 4.

However, XHTML never really caught on. Professional developers (especially those who were integrating programming languages like JavaScript and PHP into their web projects) loved XHTML Strict but it was a little too unforgiving for most developers, and the vast majority of pages never bothered to validate to the new standards. When the time came to devise a new standard, the W3C (World Wide Web Consortium) decided to support HTML5 rather than XHTML 2.

HTML5 is not really a rejection of XHTML; it has some of the best features of both HTML 4 and XHTML:

  • Simple doctype: The doctype definition (the boilerplate code that begins every web page) for XHTML was really complicated. Even people who taught classes and wrote books about it never memorized the doctype, but had to copy and paste it every time. HTML5 has a very simple and clean document definition, and it’s once again possible to write a page from memory.

  • Separation of content and style: HTML5 does not include the style tags from HTML 4 (font, center, and so on), instead requiring developers to use CSS for all styling. Likewise, frames and table-based layout are discouraged in favor of CSS-style layout.

  • Validation support: Validation turned out to be a very useful tool, so HTML5 can be validated just like XHTML. The W3C validator currently supports HTML5, and other validation tools are coming online. Validation is an easy way to eliminate goofy coding mistakes and can greatly simplify your coding after you start adding programming support to your documents.

  • Strict tradition: The coding standards of HTML5 are more like XHTML than HTML 4. Although it’s still possible to use sloppy coding in HTML5, most developers use the XHTML strict standards to make the code easier to read and more predictable.

  • Tighter integration of CSS and programming languages: Perhaps the most important feature of HTML5 is its humility. While HTML is still the central language of the Internet, HTML5 is really about distributing control to other languages. HTML5 is designed as a central glue that ties together many other technologies: CSS for visual layout, JavaScript for client-side programming, server-side languages like PHP for server control, and databases.

  • New capabilities: Many of the new features of HTML5 are not technically HTML but advances in the various other related technologies (integrated databases, new JavaScript syntax, new CSS features, and so on).