Next / Previous / Contents / TCC Help System / NM Tech homepage

4. Differences between XHTML and HTML

If you already know HTML, there are several important differences in XHTML. HTML is a document type constructed using an older, more general markup framework called SGML (Standard Generalized Markup language), and it allows for a lot of sloppiness in the construction of a Web page.

However, XHTML is an XML document type, and XML has stricter rules about constructing valid documents. This is a good thing, as it makes validation of your Web page easier. Many good tools exist that help you build valid documents in XML.

4.1. Paired tags

In XHTML, all elements must have one of two forms, either paired tags or an empty element (see Section 3, “Rules for the XML notation”).

By contrast, HTML allowed you to omit the closing tag. In the early days of the Web, the rule was “to start a new paragraph, use the start tag <p>.” But in XHTML, you must also supply the closing </p> end tag at the end of a paragraph.

<p>First paragraph.
<p>Second paragraph.
<p>First paragraph.</p>
<p>Second paragraph.</p>