WWW FAQs: What versions of HTML and XHTML exist, and when should I use them?


2005-07-20: In 2005 there are just a few really important versions of HTML and XHTML:
HTML 3.2
Standardized in January of 1997, HTML 3.2 was the last major version of HTML before style sheets entered the picture. Page layout could be done only using the <table> element, and fonts and text colors were controlled using the <font> element. Both techniques are discouraged today, but since 1% of users are still running browsers from the Netscape 4.x series, HTML 3.2 can be important when backwards compatibility is a requirement and telling the user to run a new browser is not an option. Also, since HTML 3.2 is easy to write by hand, various subsets of HTML 3.2 are still popular for use in writing LiveJournal entries, blog entries and so on.
HTML 4.0.1
Standardized in December 1999, HTML 4.0.1 is the first major HTML standard to incorporate style sheets, establishing the preference that page layout should be done with style sheets. HTML 4.0.1 is the last major version of HTML before HTML evolved into XHTML.
XHTML 1.0
Standardized in January 2000, XHTML 1.0 has essentially the same feature set as HTML 4.0.1, but makes HTML compliant with the XML general-purpose markup language. That means that any well-formatted XHTML document can be manipulated by any program that understands XML. This achievement requires a few changes to HTML syntax. Most noticeable is the need to close "empty" elements like the <img> element that have no closing </img> element, by adding a / before the > like this:

<img src="myimage.png"/>

XHTML 1.0 has "strict," "transitional" and "frameset" flavors. The first is used by sites that wish to forbid the use of obsolete techniques and move page layout responsibilities entirely to style sheets where they belong. The second is used by sites which need to permit some of the backwards-compatibility features that HTML 4.0.1 shares with HTML 3.2. The third is specifically for use when breaking the display into separately scrolling frames is desired. XHTML 1.0 Strict and XHTML 1.0 Transitional are commonly chosen standards for organizations publishing on the web today.

XHTML 1.1
Standardized in May 2001, XHTML 1.1 breaks the features of XHTML 1.0 down into separate modules which browsers may or may not choose to implement depending on their appropriateness for the web browser device. XHTML 1.1 also completely excludes the deprecated backwards-compatibility features of HTML 4.01 and XHTML 1.0.
For even more complete information, see the HyperText Markup Language (HTML) Home Page at the W3C.

Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.

Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!