ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
Last Update: 31 January 2000

2.5 What is XHTML?

The evolution of HTML has essentially stopped. Instead, HTML is being replaced by a new language, called XHTML. XHTML is in many ways similar to HTML, but is designed to work with the new eXtensible Markup Language, or XML, that will soon serve as the core language for designing all sorts of new Web applications, in which XHTML will be only one of many "languages." But, XHTML is designed to work with these other language, so that different documents, in different languages, can be easily mixed together.

For this to work, the rules for writing HTML documents had to change. These rules are simple, and are as follows:

  1. All tag and attribute names must be in lowercase. Thus, you can't write
    <A HREF="foo.html">...</A>
    but must instead write this in lowercase, as :
    <a href="foo.html">...</a>

  2. "Empty" tags must be written with an extra slash at the end. An empty tag is one like <br> or <img src="foo.html"> that doesn't have a </br> or <img> to end it. In XHTML, such tags must be written as: <br />, and <img src="foo.gif" />.

  3. You can never omit an end tag. With HTML, you could sometimes leave off an end tag, as in
    <p> ..... paragraph text
    <p> ..... more paragraph text
    With XHTML, you must always put in the end tag, so that the preceding must be written as:
    <p> ..... paragraph text </p>
    <p> ..... more paragraph text </p>


  4. Attributes must always have a value. In HTML you can sometimes omit atttibute values, as in
    <hr size="2" noshade>
    in XHTML, this would need to be written as:
    <hr size="2" noshade="noshade" />

  5. Attributes values must always be quoted.. In HTML you can sometimes omit the quotes,as in
    <hr size=2>
    in XHTML, this would need to be written as:
    <hr size="2" />

That's about it -- there are a few more subtle details, but essentially if you follow the above rules, then the documents you write are acceptable as XHTML. Thus it's easy to write up Web pages using the XHTML format -- they will work with today's HTML browsers, and are easily upward-compatible for the next-generation of Web browsers.


ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
© 1994-1998 by Ian Graham
Last Update: 31 January 2000