As the World Wide Web Consortium (W3C) describes it, XHTML (Extensible Hypertext Markup Language) is "a reformulation of HTML 4.0 as an application of the Extensible Markup Language (XML)." For readers unacquainted with either term, HTML is the set of codes (that's the "markup language") that a writer puts into a document to make it displayable on the World Wide Web. HTML 4 is the current version of it. XML is a structured set of rules for how one might define any kind of data to be shared on the Web. It's called an "extensible" markup language because anyone can invent a particular set of markup for a particular purpose and as long as everyone uses it (the writer and an application program at the receiver's end), it can be adapted and used for many purposes - including, as it happens, describing the appearance of a Web page. That being the case, it seemed desirable to reframe HTML in terms of XML. The result is XHTML, a particular application of XML for "expressing" Web pages.
XHTML is, in fact, the follow-on version of HTML 4. You could think of it as HTML 5, except that it is called XHTML 1.0. In XHTML, all HTML 4 markup elements and attributes (the language of HTML) will continue to be supported. Unlike HTML, however, XHTML can be extended by anyone that uses it. New elements and attributes can be defined and added to those that already exist, making possible new ways to embed content and programming in a Web page. In appearance, an XHTML file looks like a somewhat more elaborate HTML file.
The W3C continues to develop a working draft for the XHTML 2.0 specification, releasing an eighth version in July of 2006
To quote the W3C again, the advantages are "extensibility and portability."
Extensibility means that as new ideas for Web communication and presentation emerge, they can be implemented without having to wait for the next major version of HTML and browser support. New tags or attributes can be defined to express the new possibilities and, assuming some program at the receiving end can understand and act on them, new things may happen on your Web page that never happened before. Specific sets of extensions for XHTML are planned for mathematical expressions, vector graphics, and multimedia applications.
If extensibility is likely to lead to more complicated pages and larger programs, the portability advantage means that Web pages can now be made simpler than they were before so that small devices can handle them. This is important for mobile devices and possibly household devices that contain microprocessors with embedded programming and smaller memories. XHTML defines several levels of possible markup complexity and each document states its level of complexity at the beginning. Programs in microdevices might expect XHTML-coded files that state the simplest level of complexity so that they could be handled by a small program and memory.
Differences and Distinctive Features
You can find out more by reading the specification and tutorials, but here are some distinctive features of XHTML and differences between HTML 4:
- XHTML requires strict adherence to coding rules. Notably, it requires closing as well as opening elements (this is known as well-formed syntax) and that all elements be in lower case. HTML was much less rigorous about notation and browsers tended to be even more forgiving.
- This means that XHTML files will tend to be "busier" than HTML. However, they won't necessarily be harder to read because rigor may force more order in coding. In addition, major editing and file creation tools can lay out pages for easier readability.
- XHTML encourages a more structured and conceptual way of thinking about content and, combined with the style sheet, a more creative way of displaying it.
- XHTML makes it easier for people to dream up and add new elements (and develop browsers or other applications that support them).