Home arrow HTML arrow Page 3 - XHTML Explained
HTML

XHTML Explained


I'm sure you've heard people mumbling about XHTML and how it combines HTML and XML to create the "next generation" of HTML. I too had heard the mumbling, but actually had no idea what XHTML was... up until about 2 months ago. In this article, Mitchell gives us a quick run down of what XHTML is, some of its benefits, how it can be used, and what it looks like. He wraps up the article with a couple of XHTML examples.

Author Info:
By: Mitchell Harper
Rating: 4 stars4 stars4 stars4 stars4 stars / 9
December 29, 2001
TABLE OF CONTENTS:
  1. · XHTML Explained
  2. · XHTML Defined
  3. · XHTML Benefits
  4. · DTD's
  5. · XHTML Examples
  6. · Conclusion

print this article
SEARCH DEVARTICLES

XHTML Explained - XHTML Benefits
(Page 3 of 6 )

XHTML documents are backward compatible with older, non-XHTML compliant web browsers. Instead of sloppy HTML tags, your pages will now contain XML tags that are always properly closed and nested correctly, such as:

<p><b><u>This is some text<br /><br /></u></b></p>

Instead of:

<p><b><u>This is some text<br><br></b></u>

You can see that the XHTML version of the code above has a <p>, <b>, and then a <u> tag. These tags are closed in the reverse order that they were created in: </u>, </b>, and lastly </p>. All tags must be closed in this way for the XHTML document to be considered valid.

Also, notice the <br /> tags? Because of the way non-XHTML browsers are designed, as long as you leave a space between the beginning of the tag and the “/>”, then they will just treat the tag normally, and ignore the forward-slash.

XHTML is a standard

XHTML is an accepted standard (see http://www.w3.org/TR/xhtml1/), meaning that all of the newer browsers due for release over the next couple of months (such as newer version of IE, Netscape and Opera) will most definitely contain built-in support for XHTML.

The first document type in the XHTML family is XHTML 1.0. The W3C standard for XHTML takes three of the previous document types from HTML 4.0 and converts them to fully utilize XML wherever possible. This promotes a consistent, logical layout, while still keeping the actual content easy to follow.

XHTML documents must incorporate one of three document type definitions (DTD’s). This makes sure that the XML data contained within an XHTML document is valid and conforms to a certain layout/logical style as defined in that DTD file (more on DTD’s below).

You might be wondering what the benefits of migrating your current HTML documents over to XHTML are; you may also be wondering why you should bother learning more about XHTML; well, let me point out some of the benefits of XHTML (as listed at http://www.w3.org/TR/xhtml1/):
  • XHTML documents are XML conforming. As such, they are readily reviewed, edited and validated with standard XML tools such as the MSXML parser.
  • XHTML documents can be written to operate as well or better that they did before in existing HTML 4-conforming user agents as well as in new, XHTML 1.0 conforming user agents.
  • XHTML documents can utilize applications (e.g. scripts and applets) that rely upon either the HTML Document Object Model or the XML Document Object Model (DOM).
Next: DTD's >>

blog comments powered by Disqus
HTML ARTICLES

- Does HTML5 Need a Main Element?
- Revisiting the HTML5 vs. Native Debate
- HTML5: Not for Phone Apps?
- HTML5 or Native?
- Job Hunting? Freelancer.com Lists This Quart...
- HTML5 in the News
- Report: HTML5 Mobile Performance Lags
- The Top HTML5 Audio Players
- Top HTML5 Video Tutorials
- HTML5: Reasons to Learn and Use It
- More of the Top Tutorials for HTML5 Forms
- MobileAppWizard Releases HTML5 App Builder
- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials