XHTML

Extensible HyperText Markup Language (XHTML) is a stricter version of HTML, in the sense that a document must be well-formed in the XML sense. Its development was motivated by interoperability with other formats, since an XHTML document can be processed by an XML processor. XML namespaces also let an XHTML document be extended by other XML-based languages, such as SVG and MathML.

Two stable versions of XHTML exist: 1.0 and 1.1. XHTML 1.1 adds modularization, along with ruby annotation elements (ruby, rbc, rtc, rb, rt, and rp). XHTML is supported by all major browsers.

Besides the requirement to be well-formed in the XML sense, an XHTML document differs from an HTML document in several other important respects:

The following is a strict XHTML 1.0 document. It declares its language with the xml:lang attribute and names an XHTML file with the .xhtml extension.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xml:lang="en">
  <head>
    <title>XHTML 1.0 Strict Example</title>
    <script type="application/javascript">
    <![CDATA[
    function start() {
       alert("Hello World");
    }
    ]]>
    </script>
  </head>
  <body onload="start()">
    <p>The name of an XHTML file ends with .xhtml.</p>
  </body>
</html>