Why There Are Different Versions of HTML

HTML 5 has become the accepted standard for web pages

Portrait, girl lighted with colorful code
Stanislaw Pytel / Getty Images

The versions of HTML represent standardized improvements to the foundational language for the World Wide Web. As new technologies are developed and more efficient methods to achieve desired web page results evolve, developers and administrators settle on accepted language standards, and then designate them using numbers to bring order and uniformity to the web.

Versions of HTML

The first version of HTML didn't have a number, but was just called "HTML." It was used to create simple web pages beginning in 1989 and served its purpose through 1995. In 1995, the Internet Engineering Task Force (IETF) standardized HTML and HTML 2.0 was born.

In 1997, the World Wide Web Consortium (W3C) presented the next version of HTML, HTML 3.2. It was followed by HTML 4.0 in 1998 and 4.01 in 1999.

Then, the W3C announced that it would no longer create new versions of HTML, and would instead begin to focus on extensible HTML, or XHTML. They recommended that web designers use HTML 4.01 for their HTML documents.

Around this point, development split off. The W3C focused on XHTML 1.0, and things like XHTML Basic became recommendations in 2000 and onwards. However, designers were resistant to moving to the rigid structure of XHTML, so in 2004, the Web Hypertext Application Technology Working Group (WHATWG) began working on a new version of HTML that is not as strict as XHTML. This was called HTML5.

Deciding on a version of HTML

Your first decision when creating a web page is whether to write in HTML or XHTML. If you're using an editor like Dreamweaver, this choice is declared in the DOCTYPE you choose.

There are a number of differences between XHTML and HTML. In general, XHTML is HTML 4.01 re-written as an XML application. If you write XHTML, it is more strict in its syntax, and all your attributes will be quoted, your tags closed. You will also be able to edit the document in an XML editor. HTML is much looser, allowing you to drop quotes off of attributes, leave tags unclosed, and so on.

Why should you choose to use HTML? These reasons may push you more toward it as a choice:

  • HTML can take up less space, and so be speedier to download.
  • HTML is more forgiving and easier to learn. For example, if you leave off tags in HTML, your code will still work reliably.
  • Some older browsers respond more effectively to HTML than to XHTML.

You may instead choose XHTML if your needs line up more with these points:

  • XHTML is stricter on beginnings and endings of tags, so styles and events can be hooked in more easily.
  • XHTML integrates well with other programming languages because XML is broadly usable.
  • Some browsers respond more reliably to XHTML and so display the pages consistently, even across platforms.

Some might argue that a fourth version is the "no-DOCTYPE" version. This is often called quirks mode and refers to HTML documents that don't have a DOCTYPE defined and so end up displaying quirkily in different browsers.

HTML 5 and XHTML

With the advent of HTML 5 (sometimes represented without the space as HTML5), the language subsumed XHTML as well as all previous versions of HTML. HTML 5 has become a standard language of the internet and is the most widely accepted by modern browsers. You should only be using older versions of HTML (e.g., 4.0, 3.2, etc.) if you have a specialized reason to do so. If you don't have a specific situation that calls for something else, then you should use HTML 5.

Declaring a DOCTYPE

Be sure to use a DOCTYPE in your HTML document. Using a DOCTYPE ensures that your pages are displayed the way they are intended to be displayed.

If you are working with HTML 5, your DOCTYPE declaration will simply be:

<!DOCTYPE html>

The other DOCTYPEs for the various versions are:

HTML

  • HTML 4.01 transitional
  • HTML 4.01 strict
  • HTML 4.01 frameset
  • HTML 3.2

XHTML

  • XHTML 1.0 transitional
  • XHTML 1.0 strict
  • XHTML 1.0 Frameset
  • XHTML 2.0