Starting with XHTML
Highly important rules to remember when writing XHTML code.
An XHTML page must have a DTD
A DocType Definition must be placed on the page above the opening html element. The most common DTD "transitional".
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
All code must be inside a single root element.
The page must be properly structured inside a single <html> element;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
</head>
<body>
</body>
</html>
XHTML code must be written in lowercase.
No capital letters
<P>This is a Sentence</P> - Incorrect with the capital P elements
<p>This is a sentence</p> - Correct
lowercase p elements
All code must be inside a tag (element).
This is a Sentence - Incorrect no p elements
<p>This is a sentence</p> - Correct open and closing p elements
All tags(elements) must be closed.
This includes images, non-breaking spaces and horizontal rules.
<p>This is a Sentence - Incorrect no closing p element
<p>This is a sentence</p> - Correct open and closing p elements
All code must be properly nested.
Closed in the exact opposite of the opening.
<p><strong>This is a Sentence</p></strong> - Incorrect strong needs
to be closed before the paragraph is closed
<p><strong>This is a sentence</strong></p> - Correct