Although most people speak of HTML code, the fact is that if you write good HTML code, you’re actually writing XHTML. XHTML is a set of rules that, if you follow them when you write HTML code, result in code that is more standards-compliant, and hence more likely to render as you want it to on a variety of different client browsers.
The core rules of XHTML are as follows:
❑ Always close your tags (so you always have both a <p> and a </p> for a paragraph) or use self-closing tags (such as <br /> instead of <br>).
❑ Tag and attribute names must be lowercase (so <div id=”myDiv”> is acceptable, but <Div
ID=”myDiv”> is not) because XHTML is case-sensitive (so <div>, <Div> and <DIV> are all dif-ferent entities to XHTML).
❑ Attribute values must be enclosed within double quotes.
This is only a brief summary of XHTML. If you want to know more about the rules, refer to the W3 site www.w3.org/TR/xhtml1/ where you can learn all about the XHTML standard. Section 4 of that page deals specifically with the way XHTML differs from standard HTML.
In essence, the aim of XHTML is to provide a common set of guidelines for web developers and browser developers to to follow. With newer web browsers such as Firefox starting to gain ground on the Microsoft Internet Explorer–dominated landscape, it’s important that all parties agree to support XHTML in all future iterations of their products to move away from the old problem of developing a site that worked just fine on Internet Explorer, but looked awful on Netscape.
The move toward XHTML as the standard language of the web is gradual, and will likely never happen fully (with browsers likely to support older tags and markup for many years yet for backward compatibility), but you’ll find that future maintenance of web sites that you write today will be much simpler if you follow the XHTML guidelines. You should be less likely to see your sites break when the next version of Internet Explorer or Firefox arrives.
By: Touraj Ebrahimi
[toraj_e] [at] [yahoo] [dot] [com]