home about us contact us

free scripts advanced scripts online tools great books web related tutorials contributed tutorials news archive geek toys!

help forum live chat help

XHTML vs HTML Tutorial

HTML is rapidly being replaced by XHTML. The differences are very minor, but the results of switching can be worth the effort. The primary benefit is that XHTML is more widely accepted in non "computer" devices like cell phone, palm devices and other scaled down browsers. This is commonly called portability between devices.
XHTML is also said to be extensible, which is the fancy way of saying the new tags can be added without a new document type declaration.

Firstly, what are the differences:

The first thing you will notice if you look at the source of an XHTML document is that the first line is a document type declaration (DTD also called the DOCTYPE). There are three that are used, strict (that will only validate if you have no deprecated tags), transitional (which will still validate with deprecated tags) and frameset (which is for a page that "sets" up "frames"). Oddly enough, even though all tags in XHTML are lower case, parts of the DTD must be in upper case. The three DTD's look like this:

So what's one to do?
Well for all new documents make them XHTML Compliant from the start. Transitional is fine, as it's tolerant if something depreciated slips in. You should also consider converting your existing files to XHTML. Notetab, for example will allow you to convert from HTML to XHTML with a few clicks (Modify/Change HTML Tags/Convert to XHTML).
Dreamweaver MX will also allow you to select XHTML when creating a new document. You will be glad you took the time later on down the track.

A couple of little suggestions:
1. Read up on the depreciated tags in XHTML (they are also depreciated in HTML 4), and at least be aware of the tags that are "depreciated", tags like: <center>, <u> and <font>. Also be aware that some tag attributes are depreciated, like 'align' for example.
These tags are depreciated because what they do (or did) can now be better or more easily done with CSS.
You should be aware of these depreciated tags and methods, and slowly train yourself not to use them. That way in time you should be able to validate to XHTML strict.

2. Get in the habit of using the tools available to help you write clean code, we have a couple of them you can use here. To clean up your code (it fixes many common errors) and tidy up your indenting (which makes your code much easier to read) you can try our online copy of "HTML Tidy" here.

Once your code is neat and hopefully error free, its time to run it through the W3C validator and see if its valid HTML/XHTML. We have a copy of the W3C validator which you can use anytime you need it, Totally Free. It can be found here.

The Difference between strict and transitional HTML / XHTML:
In short, transitional is a forgiving form of doctype as it allows depreciated tags and attributes to pass validation, and the browser will do its best to display the page as you wanted it. You must still have properly nested lowercase tags to get validation though.

The strict doctype is just that, all the depreciated tags and attributes will fail to validate under a strict doctype and may well display incorrectly as well.
See here for more information on the tags classed as depreciated in modern HTML / XHTML.

This site is totally free to use, you have absolutely no moral or legal obligations to help us continue.
There are however, some costs involved in running the site.

<random humor>
Plus Don's kid is a good runner and she goes through sneakers fast.
</random humor>

So if this site helped you find your way, perhaps you could consider contributing to our costs. Whatever amount you feel this site was worth to you would be just wonderful.
Use PayPal if you do decide to share and help us with the costs and in appreciation for our time and attention, or alternatively buy a book from our Bookstore..

  Time  in  Don's  part  of the world is:     Tue, April 23, 2024 at 06:58 AM
  Time in Franki's part of the world is:     Tuesday, April 23, 2024 at 7:58 PM
 Don't worry neither one sleeps very long!

privacy policy :: support us :: home :: live chat help
contact us :: forum ::tutorials :: bookstore :: Site Map

      Valid XHTML 1.0!             powered by Apache Server
Pic 3 Pic 3


CIGHTML Firefox Thunderbird ClamWin WordPress SpyBot S&D TheGIMP Apache for Windows Registry Cleaners More cool stuff: