It is important for web programmers to follow XHTML coding practices as much as possible when creating HTML documents today, in order to make our "legacy" content readable by future browsers. Restrictive XHTML syntax will be the rule of law for web pages within a very few years, so follow the strictest possible syntax when coding HTML.
Remember the following rules about XHTML when coding your HTML:
All tags MUST close. If a tag doesn't ordinarily close (like
AREA, etc), it must close within its opening tag using the space-close-slash shorthand closing syntax we've already learned.
NO text may sit, exposed, at the BODY level of the document. All text MUST be enclosed in some sort of tag, whether P, TH, ADDRESS, etc.
<html> <head> <title>Wrong</title> </head> <body> Here is some text.<br /> Here is some more text.<br /> </body> </html>
<html> <head> <title>Right</title> </head> <body> <p>Here is some text.</p> <p>Here is some more text.</p> </body> </html>
All attributes MUST follow the syntax outlined in an earlier module:
When an attribute does NOT have a value (such as the
NORESIZE attribute), the attribute value WILL be a restatement of the attribute name, i.e.
XHTML is case-sensitive, with an all-lower-case tag and attribute syntax. Therefore, we MUST use all-lower-case tag names when coding in HTML today.
<P>Here is a paragraph of text.</P> <img SRC="./graphics/capitalA.gif" WIDTH="54" height="54">
<p>Here is a paragraph of text.</p> <img src="./graphics/capitalA.gif" width="54" height="54" />
Well, those are the primary details concerning XHTML standards that I feel need to be stressed. I strongly recommend that you read up on XHTML at the World Wide Web Consortium website; I think you will find it a potentially tiresome but highly enlightening experience.
Copyright © 2001 Michael Masumoto. All Rights Reserved.