Historical Context
The World Wide Web(www) and the first version of HTML were invented by Tim Bernes Lee. Since the web became popular a committee called the W3C(World Wide Web Consortium) was founded to maintain and provide new HTML standards. Until 1999 W3C provided new standards regularly. Then the W3C began working on a new language XHTML(Extensible HTML). XHTML was supposed to be a more well-formed and stricter version of HTML. If the web page written in XHTML was not well-formed then the browser will not display the entire document. Well-formed documents will have more predictable behavior in different browsers. This will ensure that the web pages will work correctly in all browsers that supported XHTML.
Some developers jumped onboard and started making web pages made out of XHTML. Since only well-formed pages should be displayed any older HTML web page with errors will not be displayed. Browsers were reluctant to enforce this restriction because it will break thousands of websites that were still written in legacy HTML that had errors. These were mostly minor errors but even a single error could make a page not load. Another group called the WHATWG(Web Hypertext Application Technology Working Group) was formed to revive the abandoned HTML standards. This group wanted to make a new HTML standard that would add new features but also support old features of HTML. This group had members like major browser vendors.
The principle of the web was to provide people with an easy way to make information available anywhere in the world. XHTML by not conforming to this principle began to be forgotten. W3C was left without a choice. It officially supported the WHATWG standards. In 2008 the first draft version of HTML5 was released. It is now supported extensively by modern browsers. In the end, the XHTML standard was replaced with the more lenient HTML5 standard.
Making XHTML compliant web pages
Even though XHTML did not catch on, it had many good practices. These practices are made optional in HTML5. Even if the browser finds that the page is not well-formed, it will try its best to correctly display the content. We as developers can make XHTML compliant pages to reap the benefits of XHTML.
- DOCTYPE should be provided for all pages.
- The html, head, title and body elements should be provided.
- Elements must be nested properly.
- All elements must be closed. Empty elements should be closed within starting tags.
- Elements and attributes should be in lower case.
- Attribute values should always be quoted.
- Attribute values for empty attributes should be specified.
Even if we follow all these rules we cannot make web pages that will validate in a XHTML validator. These rules are meant be used as a guideline for making well formed web pages. HTML5 is a easier language that is well supported by most browsers. A developer should always make web pages that conforms to a current standard not an abandoned standard.