Introduction to XHTML

Posted by on Monday 28 Apr 2003

XHTML, or eXtensible HTML is the new language of the web. HTML was designed years ago as the original markup language for the World Wide Web and the W3C group responsible for web standards approved XHTML as a new web standard in 2000. XHTML is designed to replace HTML and provides for much cleaner and stricter code.

All new browsers support both HTML and XHTML. XHTML is designed as a combination of XML (eXtensible Markup Language) and HTML.

Why start designing my web pages in XHTML?

XHTML is based on XML which must be marked up correctly, so the pages you designed are created more “cleanly”. In addition, XML designs the structure of a document, while HTML described the design, so as more XML devices (phones, handheld devices) come on the markup, you can more easily move your website towards supporting a broad range of devices. XHTML is also backwards compatible with older browsers, so your code will be well formed and still function correctly.

With HTML, most browsers will accept code even if it is buggy, improperly formed, improperly closed, and generally a mess. XHTML, however, requires you to close your HTML tags, use lowercase, nest your tags properly and use well formed code.

Major differences you must learn when writing XHTML:

  • XHTML tags must be closed
  • XHTML documents must be “well written”
  • XHTML tags must be in lowercase characters

In the first section of this tutorial, we learned a few differences you must learn when writing XHTML:

  • XHTML tags must be closed
  • XHTML documents must be “well written”
  • XHTML tags must be in lowercase characters

XHTML tags must be closed

The first major differences between XHTML and HTML is the fact tags must be closed. What do we mean?

In HTML, this could be a structure of your document:

Hey there. I am your instructor for this course.

This will be a great course!

This course will focus on XHTML.

Thanks for taking our course.

In XHTML, you must close each of your

tags and you must close the
tag. In normal HTML, you can close the

tag with

, however, since there is no “close” tag for
, you can close it in XHTML by using
. Older browsers will ignore everything after the space in

XHTML Documents must be well written

Currently, browsers forgive most of your mistakes in writing your code. In XHTML, however, you must keep your documents well formed and well written. When you are creating a web page, you need to keep elements within their proper structure. For example:

is the proper structure of webpage.

XHTML Tags must be written in lower case

XHTML is a form of XML. XML considers lower and upper case to be different characters and different tags. In XHTML documents, you must use lower case characters for all tags.

Hi there, this is a test.

is incorrect. The correct code would be written:

Hi there, this is a test.

XHTML is a new way to write your HTML and the preferred method for web development.

Category: Internet Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>