Miscellaneous Lesson #4
"Moving On Up to XHTML 1.0"
There really isn't as much difference between HTML and XHTML as you would think. XHTML can be considered HTML 5.0 yet it hasn't completely replaced HTML as of yet.

XHTML Facts - Webpage Formatting
XHTML...

Elements Must Be Nested Correctly:
Incorrect
<u><b>this is bold and underlined.</u></b>
Correct
<b><u>this is bold and underlined.</u></b>

Elements Must Be Closed Correctly:
Incorrect
<p>This is a paragraph.
<p>This is another paragraph.
Correct
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

Tags without a closing tag must still be closed correctly.
<br> ----> <br />
<img src="star.gif"> ----> <img src="star.gif" />

Attributes Must Be Closed Correctly:
Incorrect
<input type="text" value="Please read this." readonly />
Correct
<input type="text" value="Please read this." readonly="readonly" />

Elements and Attributes Must Be Written in Lowercase:
Incorrect
This is some text.
<HR WIDTH="500" />
This is more text.
Correct
This is some text.
<hr width="500" />
This is more text.

Attributes Must Be Quoted:
Incorrect
<table width=100%>
Correct
<table width="100%">

The name Attribute Has Been Replaced By the id Attribute:
Incorrect
<a name="bookmark"></a>
Correct
<a id="bookmark"></a>

Elements Must Be Enclosed Within a Set of html Tags:
Incorrect
<body><p>This is the content of my webpage.</p></body>
<html>
<head><title>This is the title of my webpage!</title></head>
</html>
Correct
<html>
<head><title>This is the title of my webpage!</title></head>
<body><p>This is the content of my webpage.</p></body>
</html>


Webpage Formatting: This is the absolute minimum of an XHTML webpage.
<!DOCTYPE... the document type goes here>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta tag for character encoding goes here>
<title>...</title></head>
<body>...</body>
</html>
The document type I go into more detail here.

This page was last updated on: