The purpose of XHTML
Why was XHTML implemented? Was HTML not enough to generate content on webpages? XHTML serves an important purpose on the world wide web.
This lesson focuses on:
- Improvement/Next phase of HTML
- HTML and XML
Improvement/Next phase of HTML
Many pages on the world wide 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:
Do you notice the error in the above HTML code? It is found in the line of code <b>This text is bold. 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.
Improvement of 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 code. An improvement that would result in cleaner, more efficient code as well as better usability for webpage visitors.
To learn about the various rules XHTML sets for HTML, read our Differences between HTML and XHTML page, and also our XHTML syntax page.
Next phase of HTML
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.
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. HTML is a markup language used to display content on webpages, it is designed to specify the logical organization of a webpage. 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 XHTML is useful for creating web pages 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.




