1. Computing

Discuss in my forum

Why are There Different Versions of HTML?

By

The History of HTML

The first version of HTML didn't have a version number, it was just called "HTML" and was used to put up simple Web pages back in 1989 - 1995. In 1995, the IETF (Internet Engineering Task Force) standardized HTML and numbered it "HTML 2.0".

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

Then the W3C announced that it would not be creating new versions of HTML, and would begin to focus on extensible HTML or XHTML. They recommend 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. But Web designers didn't want to move 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 called HTML5. They hope that this will eventually be accepted as a W3C recommendation.

Deciding on a Version of HTML

Your first decision when writing a Web page is whether to write in HTML or XHTML. If you're using an editor like Dreamweaver, this choice is determined by the DOCTYPE you choose. If you choose an XHTML DOCTYPE, your page will be written in XHTML and if you choose an HTML DOCTYPE, you'll write the page in HTML.

There are a number of differences between XHTML and HTML. But for now, all you need to know is that XHTML is HTML 4.01 re-written as an XML application. If you write XHTML, all your attributes will be quoted, your tags closed, and you could edit it in an XML editor. HTML is a lot looser than XHTML because you can leave quotes off attributes, leave tags like <p> without a closing tag </p> and so on.

Why to Use HTML

  • 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.

Why to Use XHTML

  • XHTML is clearer on beginnings and ends of tags - so styles and events can be hooked in more easily.
  • XHTML integrates well into other programming languages because it is XML.
  • Some browsers respond more reliably to XHTML and so display the pages consistently, even across platforms.

Once You've Decided On HTML or XHTML - What Version Should You Use?

HTML
There are three versions of HTML still in regular use around the Internet:

  • HTML 3.2
  • HTML 4.0
  • HTML 4.01

And 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.

I recommend HTML 4.01. This is the most recent version of the standard, and it is the most widely accepted by modern browsers. You should only be using HTML 4.0 or 3.2 if you have a specific reason to (such as if you're building an Intranet or kiosk where the browsers viewing it only support 3.2 or 4.0 tags and options). If you don't know for a fact that you're in that situation, then you aren't, and you should use HTML 4.01.

XHTML
There are currently two versions of XHTML: 1.0 and 2.0.

XHTML 2.0 is very new and still isn't really supported by Web browsers. So I recommend using XHTML 1.0 for now. It will be really nice when XHTML 2.0 is widely supported, but until then, we need to stick with versions that our readers can use.

Once You've Decided on a Version

Be sure to use a DOCTYPE. Using a DOCTYPE is just one more line in your HTML documents, and it insures that your pages are displayed the way they are intended to be displayed.

The DOCTYPEs for the various versions are:

    HTML

  • HTML 4.01 transitional:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  • HTML 4.01 strict:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  • HTML 4.01 frameset:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
  • HTML 3.2:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">

    XHTML

  • XHTML 1.0 transitional:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  • XHTML 1.0 strict:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  • XHTML 1.0 Frameset:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
  • XHTML 2.0:
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  1. About.com
  2. Computing
  3. Web Design / HTML
  4. HTML and XHTML
  5. XHTML
  6. HTML and DOCTYPE - HTML Versions - Why Different HTML Versions

©2014 About.com. All rights reserved.