XHTML
  1. XHTML intro
  2. XHTML purpose
  3. XHTML/HTML diff
  4. XHTML syntax
  5. XHTML DTD
  6. HTML to XHTML
  7. XHTML validation
  8. XHTML modules
  9. HTML 5
  10. XHTML history
  11. XHTML summary

The purpose of XHTML

Why was XHTML implemented? Was HTML not enough to generate content on webpages? XHTML serves an important purpose on the web.

This tutorial focuses on:

Improvement/Next phase of HTML

Many pages on the web contain what is deemed as bad HTML. It is said to be as such because of certain errors within the code such as missing closing tags.

Example:
<html> <head> <title>Page with an error</title> </head> <body> <b>This text is bold </body> </html>

Do you notice the error in the above code? It is found in the line of code <b>This text is bold.

The error is that there is no closing </b> tag. Even though there is an error, the code will still work in browsers, though some of the content may not be displayed as you intend it to.

This is where XHTML comes into the picture. XHTML was proposed as a solution to this bad HTML.

By setting rules that should be followed in HTML such as all tags must be closed and all tags must be properly nested, XHTML set forth an improvement in HTML. An improvement that would result in cleaner, more efficient code as well as better usability for webpage visitors.

This 'cleaner and more efficient code' concept is the next phase in the evolution of HTML. By introducing such rules into HTML, XHTML is making HTML grow up into a stricter, more practical, more efficient language.

To learn about the various rules XHTML sets for HTML, read our differences between HTML and XHTML tutorial, and also our XHTML syntax tutorial.

HTML and XML

Though it is a language almost identical to HTML 4.01, XHTML is in fact a hybrid language - it is a combination of HTML and XML.

XML is a markup language where everything must be marked up correctly with tags resulting in what are called "well-formed" documents, it is a language used to describe data. HTML is a markup language used to display content on webpages, it is a language used to display data. XHTML is therefore a combination of XML and HTML - it is used to display content on webpages, and it must be marked up correctly with tags resulting in "well-formed" documents.

There are many different browsers in use today. Some which run on PC's and Mac's, and others that run on mobile phones and other hand held devices. The latter do not have the power to interpret bad HTML, therefore a language like XHTML which can display content in "well-formed" documents is useful for creating web pages and will continue to be now and in the future, since it is used to display content on webpages, as well as avoids the problem of bad HTML.

The combination of the purpose of HTML (displaying content on webpages) and XML (marking up everything correctly with tags to create "well-formed" documents) has resulted in XHTML - a markup language that is very practical for building web pages and will continue to be for a while.

© Copyright 2013-2014 Landofcode.com
Terms of use | Privacy policy | Copyright information