Overview

XHTML stands for eXtensible HyperText Markup Language. It is a family of markup languages that recast HTML in the syntax and rules of XML. The goal was to bring the stricter, well-formed requirements of XML to traditional web markup so that websites and web pages would be easier to parse, transform and exchange between tools and engines. XHTML aims to reduce ambiguous or permissive authoring practices that once made rendering behavior vary across different user agents.

Key characteristics

Compared with more permissive versions of HTML, XHTML enforces a small set of important rules derived from XML. These include:

  • Well-formedness: every start tag must have a matching end tag (except for empty elements which must self-close).
  • Lowercase element and attribute names to ensure consistent tokenization.
  • All attribute values must be quoted and attribute minimization (omitting values) is not allowed.
  • Proper nesting: elements must not overlap; they must close in the reverse order they were opened.
  • Use of a suitable XML namespace and a DOCTYPE appropriate to the chosen XHTML profile (for example, XHTML 1.0 Strict or Transitional).

History and development

XHTML was developed in the late 1990s and early 2000s as part of an effort to modernize HTML and bring benefits of XML such as reliable parsing and compatibility with XML tools. The W3C published XHTML 1.0 as a reformulation of HTML 4.01 and later XHTML 1.1 introduced modularization. Over time the web moved toward HTML5, which relaxed some XML-only constraints but also defined an XML serialization commonly called XHTML5. During its heyday, XHTML encouraged authors to write cleaner, more predictable markup.

Practical use, examples and trade-offs

Authors who write XHTML must be attentive to syntax. For example, an empty line-break in permissive HTML might appear as <br> while in XHTML it should be written as <br />. Similarly, a horizontal rule is <hr /> rather than <hr>. These small changes matter because an XML parser will reject documents that are not well-formed.

Advantages of XHTML include easier machine processing, better interoperability with XML tools (XSLT, XML serializers) and a discipline that can reduce layout bugs. Disadvantages historically included stricter content-type handling: delivering documents with the XML MIME type could expose parsing differences in older web browsers, and some legacy user agents handled XHTML incorrectly when served as application/xhtml+xml.

Notable distinctions and current context

XHTML is distinct from traditional HTML by its XML constraints, but it has influenced modern HTML development. HTML5's permissive syntax made authoring simpler for many developers, while XHTML ideas live on in XML serialization and in projects that require strict, machine-parseable markup. Authors today choose between HTML syntax for broad compatibility and an XML serialization (XHTML5) when tools or workflows benefit from strictness.

Further reading

For more about syntax rules, DOCTYPE choices and migration considerations, consult resources on both HTML and XML standards; for general browser behavior and compatibility discussions see material about rendering engines and browser support. Other introductory resources cover the original XHTML specifications and later developments in HTML5 serialization.

Example comparisons: <br> (permissive HTML) versus <br /> (XHTML), and <img src="image.png" alt="desc" /> rather than an unclosed <img> tag. These conventions help ensure predictable parsing and are the essence of XHTML's stricter approach.