XHTML Introduction and Resources

XHTML stands for eXtensible Hypertext Markup Language. It is basically XML application of HTML. When it was first developed, HTML (version 4) was loosely structured. XHTML made HTML highly structured. It was long seen as the future of markup for the web. But HTML5 has largely bypassed it. Still, it is widely used.

It developed as a means of combating bad code found on many web pages that used HTML such as missing closing tags, improper nesting of tags, and similar loose coding practices. XHTML combats these errors by setting rules such as all tags must be closed and must be in the right order.


In 1998, the W3C published a Working Draft entitled Reformulating HTML in XML. This new language was based on HTML 4, but adhered to the stricter syntax rules of XML. In February of 1999 the name of the specification changed to XHTML 1.0: The eXtensible HyperText Markup Language. Finally, in January 2000, XHTML became the official W3C recommendation.

The next version of XHTML, XHTML 1.1 was published in May 2001, which was still based on strict rules but allowed for customizations and minor changes. XHTML 2.0 started out as a working draft but was abandoned in 2009 in favor of HTML5 and XHTML5.

XHTML Basic Principles

While XHTML is almost identical to HTML, it introduced a new set of rules that were supposed to ensure all code is valid and correct. These rules were:

  • All elements and attribute names must be in lowercase.
  • All empty elements must be written using XML's special empty-element tag.
  • All end tags must be present and there are no optional end tags.
  • The HTML elements must contain a single head element, followed by a single body element or a single frameset element.
  • Every head must contain a single title.

Along with the rules mentioned above, XHTML initially introduced three formal Document Type Definitions (DTDs) which corresponded to the three different versions of HTML 4.01:

  • XHTML 1.0 Strict is the XML equivalent to strict HTML 4.01, and includes elements and attributes that have not been marked deprecated in the HTML 4.01 specification. As of November 2015, XHTML 1.0 Strict is the document type used for the homepage of the website of the World Wide Web Consortium.
  • XHTML 1.0 Transitional is the XML equivalent of HTML 4.01 Transitional, and includes the presentational elements (such as center, font, and strike) excluded from the strict version.
  • XHTML 1.0 Frameset is the XML equivalent of HTML 4.01 Frameset, and allows for the definition of frameset documents — a common web feature in the late 1990s.


The early versions of HTML were loosely structured and it was pretty common to find web pages with bad coding practices. The proper web page in XHTML looks like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<title>My First Webpage</title>
<h1>Hello World!</h1>
<p>I am a very simple but fully functional web page with valid XHTML code!</p>

Online Resources

Even though XHTML seems to be overtaken by HTML5, there are still plenty of resources online that can help you get a better grasp on XHTML. From basic specification to cheatsheets to validators to tutorials, the links listed below will help you with any questions regarding XHTML.


  • XHTML Official Specification: official website that explains the decision to develop XHTML and provides further resources on its development.
  • XHTML 1.0: the second revised edition of the working draft to reformulate HTML 4 in XML 1.0
  • XHTML Basic Specification: provides an XHTML document type that can be shared across devices such as desktop, TV, and mobile phones.
  • XHTML Tag Reference: provides a complete reference to all the tags to be used in XHTML as well as the official DTDs.
  • XHTML: The Clean Code Solution: provides a detailed XHTML overview focused on differences between HTML and new standards.
  • Why Switch to XHTML: provides a compelling argument to switch to XHTML in order to adjust the workflow and produce cleaner code.


These tools will help you check the validity of your code and make it look good.

  • HTML/XHTML Validator Service: the W3C's validator checks both HTML and XHTML documents for conformance to the official specifications.
  • HTML Tidy: helps you automatically clean up HTML files and conform them to standard specifications. It was originally developed by Dave Ragget of the W3C and now it's an open-source project at SourceForge.


If you want to really dive into XHTML development, these tutorials should get you going.

  • XHTML Explained: gives an overview of how XHTML came to be and explains all the changes that happened, followed by code examples, DTD overview, and best coding practices.
  • XHTML Web Design for Beginners : explores the advanced building blocks of XHTML, including comments, text, and more.
  • XHTML Tutorial: a very brief tutorial covering the basic concepts of XHTML in a concise manner.
  • Accessible HTML/XHTML Forms: a beginner-level tutorial that covers just what you need to know.
  • Beginning HTML (XHTML): a video tutorial suitable for beginners to learn the basics of XHTML.


Since XHTML is connected with HTML, many books discuss these two languages together. You'll find books aimed at complete beginners as well as books aimed at those who already have some coding experience and want to expand their knowledge.

  • HTML, XHTML, and CSS: Visual QuickStart Guide (2006) by Elizabeth Castro: explains all the HTML and XHTML essentials in a language suitable for beginners. The book has a lot of visual examples and includes a companion website with extra material, examples, updates, and more.
  • HTML, XHTML and CSS For Dummies (2011) by Tittel and Noble: an introductory reference to HTML, XHTML, and CSS that teaches you how to create XHTML documents, apply those principles to popular CMS such as WordPress and Drupal, and design for mobile devices.
  • Beginning Web Programming with HTML, XHTML, and CSS (2011) by Jon Duckett: teaches you how to write web pages using HTML, XHTML, and CSS. It follows standards-based principles, but also teaches readers ways around problems they are likely to face using (X)HTML.


XHTML as it was first created is no longer actively developed and maintained. The main reason for its fall from grace was the very strict error handling which caused web pages to stop rendering when an error was encountered. This led to the creation of the Web Hypertext Application Technology Group (WHATWG) which started working on HTML5. They contributed to the eventual disbanding of the XHTML 2.0 working group.

Today, all work by W3C is focused on HTML5 and an XHTML syntax, known as XHTML5.1, which is being defined alongside HTML5 in the HTML5 draft.

Even though XHTML has been bypassed by HTML5, knowing the history behind it as well as the relevant coding practices sets a strong foundation for the future. The resources above will set you on the right path to learning valid code.

Further Reading and Resources

We have more guides, tutorials, and infographics related to coding and website development:

HTML for Beginners — Ultimate Guide

If you really want to learn HTML, we've created a book-length article, HTML for Beginners — Ultimate Guide And it really is the ultimate guide; it will take you from the very beginning to mastery.