XHTML

Submitted by Alan on Sat, 04/25/2009 - 18:09

HTML was originally developed by Tim Berners-Lee while he was at CERN, the European Particle Physics Laboratory, as a way to make documents available to a wide variety of computers. To support this, he also created HTTP (HyperText Transfer Protocol), the underlying machinery of the WWW. You will come across HTTP again if you go on to write forms - interactive programs.

HTML was loosely designed as an SGML (Standard Generalized Markup Language) application. SGML is a large, complex system for creating 'markup languages'. However, HTML is extremely simple by comparison, but lacks the power and flexibility of other SGML-based languages such as XML. You will probably hear a lot about XML, since it's intended to be the ultimate successor to HTML.

XHTML 1.0 is the first step toward a modular and extensible web based on XML (Extensible Markup Language). It provides the bridge for web designers to enter the web of the future, while still being able to maintain compatibility with today's HTML 4 browsers. It is the reformulation of HTML 4 as an application of XML. It looks very much like HTML 4, with a few notable exceptions, so if you're familiar with HTML 4, XHTML will be easy to learn and use. XHTML 1.0 was released on January 26th 2000 as a Recommendation by the W3C.

How is XHTML better than HTML?

Extensibility: Under HTML, an SGML (Standard Generalized Markup Language) application, the addition of a new group of elements requires alteration of the entire DTD (language specification). XML is a simplified subset of SGML. This greatly eases the development and integration of new collections of elements.

Portability: By the year 2002 as much as 75% of Internet access could be carried out on non-PC platforms such as palm computers, televisions, fridges, automobiles, telephones, etc. In most cases these devices will not have the computing power of a desktop computer, and will not be designed to accommodate ill-formed HTML as do current browsers (bloated with code to handle sloppy or proprietary HTML).

Learn xHTML

Start with Simple HTML in a Nutshell, if you're completely new to HTML!

Why did they create XHTML, and why would you need it?

An overview of the background and limitations of HTML, and a preview of the advantages to XML.

Extensible Markup Language

An overview of the background and advantages to XML.

Document Type Definitions

An explanation of the rôle of DTDs, and three XML document types that correspond to the three HTML 4.0 DTDs: Strict, Transitional, and Frameset.

The main differences between XHTML and HTML 4

If you want to get into XHTML right away, start here. If you already know HTML 4, you're well on the way...

Examples to illustrate differences from common HTML practices

Just lots of examples!

Cascading Style Sheets

Early versions of HTML were poor in presentation features. There was a heavy demand for more 'desktop publishing' style of appearance, especially as the WWW became popular with commercial users (image is critical!). The browser manufacturers obliged by creating new tags, or 'proprietary extensions' to HTML, some of which found their way into 'standard' HTML, as defined by the W3C (World Wide Web Consortium, headed by Tim Berners-Lee). But there were clear advantages to the original 'structure-based' spirit of HTML, supplemented by a separate system for describing document presentation.

This newer system is called CSS (Cascading Style Sheets), and offers the benefits of simplifying HTML files, and making it easy to create unifying site-wide styles which can be updated and applied instantly, without touching the HTML files. Browsers have been slow to implement CSS fully or even correctly, but the latest browsers do a tolerable job (for me, at least). It's a good idea to learn CSS as soon as you've finished this tutorial, and see if it's for you. Older browsers may not render your pages exactly as you designed them; the damage can be minimised by keeping a small amount of presentation code in your HTML...