WebDesign & XHTML

XHTML is quickly becoming the standard languages for web developers as it ensure compatibility with all devices capable of displaying web sites. This section gives a brief overview of XHTML as well as writing XHTML and what WebDesign can do to help work with XHTML documents.


What is XHTML & XHTML basics

HTML is the most common language used today to develop web sites. Although for the most part, it is sufficient enough for most web developers and will display correctly in the most popular browsers, HTML does have its share of drawbacks. XHTML (Extensible Hyper Text Markup Language) was developed to correct everything that is wrong with HTML. XHTML is set out to replace HTML and be used as the default language for developing web sites.

As the internet expands, people are able to access web sites from handheld devices such as PDA's and cell phones. These devices do not have the resources to render documents using bad HTML. Therefore XHTML is a stricter and cleaner version of HTML which allows web browsers to more easily render web pages since they must follow specific rules. XHTML is almost identical to HTML 4.01 as it uses the same tags and attributes but many syntax rules apply to XHTML documents which you do not have to worry about when writing HTML code.

XHTML was designed to be backwards compatible so that you can begin to write all your web sites in XHTML and have them work in both new devices as well as older web browsers.

[Top]


HTML vs XHTML

Although XHTML and HTML are very similar since they use the same tags and attributes, XHTML contains many rules that you must follow to ensure compatibility with all browsers and devices. The following explains how to write an XHTML web page so that it complies with the XHTML standards;

Tags must be written in lowercase

All tags in XHTML including tag name and attributes must be written in lowercase. So the following code is illegal in XHTML;

<B>...bold text...</B>

And must be replaced with;

<b>...bold text...</b>

All tags must be closed

XHTML requires that all tags use their appropriate ending tags. If a tag does not require an ending tag a '/' must be inserted before the closing >. So to insert an image into an XHTML document, the image tag must be written like so;

<img src="images/picture.jpg" />

It is recommend to insert a space before the '/>' to ensure compatibility with older browsers

All attributes require a value

All tags in XHTML require a value. The following code can not be used in XHTML;

<input checked>

It must be written as;

<input checked="checked" />

Attribute values must be quoted

XHTML requires that all attribute values be quoted. The following code;

<img width=100>

Must be replaced with;

<img width="100" />

Name attribute is replaced by ID

Some HTML tags that use the name attribute must be replaced with the ID attribute. To help ensure compatibility with older browsers you can use both the name attribute and the ID attribute in the same tag.

Documents must be properly nested

XHTML requires that your documents tags be properly nested. In HTML the following code is legal and will show up correctly in most web browsers;

<B><U>Bold and underlined text</B></U>

However, it is illegal in XHTML and must be written in this way;

<B><U>Bold and underlined text</U></B>

Proper DTD must be used

ALL XHTML documents require the proper DOCTYPE declaration. The html head and body tags must be used. The following is the most basic XHTML document;

	<!DOCTYPE appropriate doctype>
	<html>
	<head><title>Web Page Title</title>
	</head>
	<body>
	....xhtml content goes here....
	</body>
	</html>
[Top]


Working with XHTML

WebDesign provides many features to help make working with XHTML very productive. When working with XHTML documents it is important to set the document type to XHTML by going to the 'Document Settings' under the Edit menu. WebDesign will automatically set this document type when creating a new HTML file using an XHTML doctype or opening a document with an extension specified under the 'Documents' tab in the preferences dialog. WebDesign's HTML wizards will generate proper XHTML code by default when working in XHTML mode.

[Top]


Converting HTML->XHTML

WebDesign provides a convert from HTML code to XHTML code feature. This conversion feature will do its best to convert an HTML document into a proper XHTML document. There are, however, areas where this conversion feature can not meet the XHTML standards. This includes fixing badly formatted HTML or ensuring all attributed values are quoted. You will have to fix these things manually.

To convert your document from HTML to XHTML select this option from the HTML Tools menu. A new window will open allowing you to set the options that WebDesign should use when converting your document. Your document type will automatically be converted from HTML to XHTML mode.

[Top]


Copyright 1999-2004 Rage Software. All rights reserved world wide
Back to Index