In future time, through all coming coding standards, let the developer, who may write code in any development environment, observe the XHTML rules which W3C has written in their white papers. Let the developer not alter the rules which W3C has given, the standards which W3C has enacted, the wording, let him not change. If such a developer has logic and is able to keep his code error free, he shall observe the XHTML rules, which W3C has decided upon. Let him write his applications, utilize correct syntax, debug his code, and comment his lines accordingly; and by so doing, grant order to all his projects. –a warning in the absolute style of Hammurabi for developers tempted to violate XHTML rules.
From the Ten Commandments to the Prime Directive, men are forever binding themselves with rules in order to attain higher standard of life. Some sets of laws are complex, some simple. Some onerous, some easy to follow. Around 1760 BC a Babylonian king named Hammurabi instituted one of the earliest and most famous attempts at standardization: Hammurabi’s Code. A few straightforward themes jump out of the chiseling of this early Mesopotamian standard for justice:
1. It is strict. Punishment was severe, often meted out in the form of death by drowning or burning. Subjects might be considered fortunate to lose an eye for an eye—even if you’re driver’s license doesn’t specifically state that you’re an organ donor. Needless to say, legal loopholes were few. Having a good lawyer didn’t count nearly as much as having as having a good doctor.
2. It was designed for the good of the community. Despite the personally destructive effects on recipients of this barbaric punishment, Hammurabi’s Code was intended to produce a more orderly and safe society. Babylonian society prospered during the period of Hammurabi and for some time afterwards.
XHTML is the Hammurabi’s code of Internet programming languages, but you still get to keep your fingers if you mistype code. Developers may get away with as little punishment as an error message. But like Hammurabi’s code, XHTML rules formulated by the W3C can “bring low those who were high, humble the proud, and expel insolence.” Developers can be a proud folk and quickly humbled by a user who discovers that their code doesn’t validate.
Markup languages have evolved over the years. You might be surprised to know that XHTML (extensible hypertext markup language) is not as austere as its patriarchal father, SGML. XHTML is simply HTML reformulated to conform to XML standards. This extreme HTML requires that your documents (web pages that you create) must follow the core rules below in order to be considered well-formed. As with HTML, always use a DTD (document type declaration) at the beginning of a document to declare to browsers the type of markup you are using. An XHTML 1.0 Transitional DTD may look like this:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
XHTML Tags are case sensitive. Write XHTML tags in lower case
<TABLE> </TABLE> becomes <table></table>
All XHTML open tags must be closed
With HTML, web browsers sometimes let you get away with leaving off a closing tag. With XHTML, container tags like <p> </p> must be closed.
Empty XHTML tags must end with a trailing slash
Tags (not attributes) such as <br> should be written as <br />
XHTML attributes must be quoted as in this example for the image border:
<img border=”2″ …
XHTML tags must be properly nested
Incorrect XHTML nesting example: <p><b>blah…</p></b>
Correct XHTML nesting example: <p><b>blah…</b></p>
You can check your own XHTML coded pages to see if they are valid using the W3C’s HTML validator. If it’s valid, you can put a cute little button on your page to certifying to your visitors that you have written valid XHTML code. Of course, it’s an ego booster for you as well. To get the full details of XHTML markup rules, check out the W3C web site markup page here:
Source: CIW Site Designer Certification Bible