XHTML
Adapted from Wikipedia · Discoverer experience
XHTML, short for Extensible HyperText Markup Language, is a type of computer language used to build web pages. It belongs to a group of languages called XML, which are designed to make information easy to share and understand. XHTML is closely related to HTML, the main language that creates websites. While HTML has some flexible rules, XHTML follows stricter rules, making it easier for computers to process.
Before HTML5 was created, HTML was based on a system called SGML. XHTML, however, is based on XML, a simpler and stricter version of SGML. This means XHTML pages are built carefully, so computers can read them without confusion.
XHTML became an official standard on January 26, 2000, with version 1.0, and later with version 1.1 on May 31, 2001. Today, XHTML is often called "the XML syntax for HTML" and continues to develop alongside the HTML standard.
Overview
XHTML 1.0 was a new way to create web pages using rules from a system called XML. The World Wide Web Consortium (W3C) said this was the next step for the internet, letting creators make pages that worked well now and in the future.
Later, a group called the Web Hypertext Application Technology Working Group started working on HTML5, which could work with or without XML. In 2018, the W3C stopped recommending XHTML 1.0 and focused only on HTML5.
Motivation
XHTML was made to make HTML easier to expand and work better with other data. It used stricter rules so pages would show correctly even if there were mistakes. XML, which XHTML used, was simpler than the system HTML used before. This change was hoped to help web pages work better on phones and other devices. XHTML could also mix in other types of data, like pictures and math formulas.
Relationship to HTML
XHTML and HTML have some differences. XHTML requires every part of a page to be properly closed, while HTML sometimes lets parts stay open. XHTML is careful about uppercase and lowercase letters, but HTML is not. Because of these differences, some things work differently between the two, like how pages are shown or how programs on the page run.
Adoption
Many websites started using XHTML 1.0 because it looked similar to HTML 4.01. The W3C gave advice on how to make XHTML work in older web browsers. However, not all browsers supported XHTML well, especially older versions of a popular browser. Because of this, many web creators chose to keep using HTML instead of XHTML.
Criticism
Some web creators wondered why they should use XHTML. Others said the problems came from mistakes in how XHTML was used or because some browsers didn’t support it well. They believed XHTML had benefits, like making pages easier to search and process. But as HTML5 developed, focus shifted away from XHTML. Research also showed that XHTML wasn’t needed for mobile devices as once thought.
Versions of XHTML
XHTML 1.0
In 1998, work began on a new way to write web pages using a stricter set of rules. By 1999, this work was called XHTML 1.0, and it became an official standard in 2000. XHTML 1.0 has three versions, each matching different ways of writing web pages from older standards.
- XHTML 1.0 Strict matches the strictest rules and does not include older, simpler features.
- XHTML 1.0 Transitional includes some simpler features for styling and layout.
- XHTML 1.0 Frameset supports a feature called frames, which let web pages be split into sections.
A newer version of XHTML 1.0 became standard in 2002.
Modularization of XHTML
The idea of modularization was to break XHTML into smaller parts so it could work better on different devices, like mobile phones or TVs. This idea became standard in 2001.
The first versions using this idea were XHTML 1.1 and XHTML Basic 1.0.
In 2008, the rules for modularization were updated, and again in 2010.
XHTML 1.1: Module-based XHTML
XHTML 1.1 built on the modularization work. It became standard in 2001. XHTML 1.1 adds features to support some Asian languages better. It also changed some rules about how links work.
Even though XHTML 1.1 was designed to work with older web rules, it did not become widely used because many web browsers did not support it well. In 2009, the rules were relaxed so it could work more easily with older web browsers.
A newer version of XHTML 1.1 became standard in 2010.
XHTML Basic
XHTML Basic was made for devices that cannot handle all the features of XHTML. It became standard in 2000.
XHTML Basic 1.0 has fewer features than other versions. With XHTML 1.1, it was one of the first to use the modular design. It includes basic features for structure, text, lists, and links.
XHTML Basic 1.1 added more features and became standard in 2008.
The current version, XHTML Basic 1.1 Second Edition, became standard in 2010.
XHTML-Print
XHTML-Print, which became standard in 2006, is a special version of XHTML Basic made for printing documents from devices to simple printers.
XHTML Mobile Profile
XHTML Mobile Profile is a version of XHTML Basic made for mobile devices with limited abilities.
In 2001, a group called the Wireless Application Protocol Forum began adapting XHTML Basic for mobile web use. In 2002, this group joined the Open Mobile Alliance, which continued to develop XHTML Mobile Profile.
XHTML Mobile Profile 1.1
In 2004, the Open Mobile Alliance added features for handling events and scripts.
XHTML Mobile Profile 1.2
In 2007, this version added better support for forms and text input.
XHTML Mobile Profile 1.3
In 2008, this version updated how events work to match modern web standards.
XHTML 1.2
The group working on XHTML 2.0 thought about making XHTML 1.2. This version would have added features to make web pages more accessible and better for organizing information. However, the group stopped working on XHTML 1.2 in 2010, so it was never made.
XHTML 2.0
Between 2002 and 2006, a new version called XHTML 2.0 was being developed. It would have broken away from older rules, which caused some debate. Some features were split into separate parts to make moving to XHTML 2.0 easier.
In 2009, the group stopped working on XHTML 2.0, and it was released as informational notes in 2010 instead of a standard.
New features planned for XHTML 2.0 included:
- Replacing old form designs with a new, flexible system.
- Replacing frames with a new system.
- Updating how events and actions work on web pages.
- Adding a new type of list for navigation.
- Letting any element act as a link.
- Letting images have descriptions directly in the content.
- Adding a single heading element that could have many levels.
- Removing some older styling elements and focusing on meaning instead.
XHTML5
HTML5 was developed outside the W3C by a group focused on making web applications. XHTML5 is the XML version of HTML5. It works more closely with older HTML and XHTML versions than XHTML 2.0 did, while adding many new elements like section and aside.
XHTML5, like HTML5, does not use the old document type rules. Instead, it asks browsers to use a simpler set of rules for understanding the content.
Semantic content in XHTML
XHTML+RDFa is a special version of XHTML that helps add extra meaning to web pages. It uses special tags and rules written in well-formed XML to support this. This is one way to create Semantic Web content, which means adding rich and useful information right into the web pages.
Valid XHTML documents
An XHTML document that follows the rules of an XHTML specification is called valid. This helps make sure the document’s code works well together, though it doesn’t always make the page look the same in every browser. You can check if a document is valid using the W3C Markup Validation Service.
The main part of an XHTML document must start with html, and it needs a special piece called an xmlns attribute to connect it to the XHTML namespace.
To check if an XHTML document is valid, you can use something called a Document Type Declaration, or DOCTYPE. This tells the browser which rules the document follows. The DOCTYPE should go before the main part of the document.
Sometimes, a document can tell the computer what language it uses right at the start. This is called an XML declaration. If the document uses a special way to show letters and symbols, it can say so here. If this piece is missing, the computer will usually guess it’s using a common way called UTF-8.
Backward compatibility
XHTML 1.x documents work well with older web browsers if you follow the right rules. XHTML 1.1 is mostly compatible too, but some special features might not show up correctly in older browsers.
XHTML 2.0 is much harder for older browsers to handle, but you can make it work better by using extra code or special tools.
| Media type | Example 1 | Example 2 |
|---|---|---|
| application/xhtml+xml | SHOULD | SHOULD |
| application/xml | MAY | MAY |
| text/xml | MAY | MAY |
| text/html | MAY | SHOULD NOT |
Cross-compatibility of XHTML and HTML
HTML5 and XHTML5 can often work together if you follow the stricter XHTML5 rules. However, there are some situations where XHTML will not work correctly as HTML5. For example, processing instructions do not exist in HTML. In HTML, they are treated like comments and end at the first >. But in XML, they are allowed as their own special type and end with ?>.
This article is a child-friendly adaptation of the Wikipedia article on XHTML, available under CC BY-SA 4.0.
Safekipedia