Home     SSI Lab     CSS Templates     CSS     Htaccess     Web Design     XHTML

XHTML Tutorials

graphic-img   

SSI-D HOME

SSI LAB

CSS Templates

CSS

.Htaccess

Web Design

(X)HTML

Introduction

HTML-Kit

Resources





What is XHTML?

Bookmark with StumbleUpon
del.icio.us
Digg it
reddit
Furl
Spurl
ma.gnolia
Yahoo MyWeb
Windows Live
Sponsors

HTML + XML = XHTML

XHTML is basically the marriage of HTML (designed to display data) and XML (designed to describe data).

XHTML is Extensible HTML, it is very similar to HTML4.01 and is supposed to replace HTML. XHTML is much "cleaner" than HTML and is also a stricter mark-up language. XHTML is an application of XML (Extensible Mark-up Language).

XHTML became a W3C recommendation in January 2000.



Why change to XHTML?

The main reason is bad HTML! HTML is very flexible, you can write incorrect code and it may still display ok, but not on ALL browsers! And we are in the unfortunate situation that a huge percentage of web sites contain bad code! We are also in an age when more and more people are using PDA´s and mobile phones to surf the world wide web, many of these types of browsers cannot understand bad code!

XHTML aims to solve many of these problems because it is strict and clean!



XHTML vs HTML

There's very little difference between HTML 4.01 and XHTML 1.0.

The following are just some of the main differences:

  1. All XHTML elements must be closed.
    In HTML for example starting a new paragraph would close the paragraph before it. In XHTML you need a start and end tag <p> and </p>. Also "empty" elements such as <br>, <hr>, <input type="text"> also must be closed like this <br />, <hr />, <input type="text" />

  2. Tag names MUST be lowercase.
    XHTML is an application of XML and XML is case-sensitive!! This means all tag names, you can no longer have <P>, <BODY>, <HR>, they all have to be lower case!

  3. XHTML elements must be properly nested
    You may get away with it in HTML but not in XHTML, example: <u><i>This italic text is underlined.</i></u>

  4. XHTML documents must be well formed.
    All XHTML elements must be within the <html> root element. Elements can have sub-elements but these must be in pairs and correctly nested within their parent elements!

You can learn more about the rules and syntax on my "XHTML Rules and Syntax" guide

NOTE:: This is a very simplistic introduction to XHTML. You really should consult the following web site for the most accurate information:

http://www.w3.org/TR/xhtml1/