|
XHTML Basics
By Stephen Bucaro
Most webpage coders are familiar with HTML (HyperText Markup Language), but when they
see the term XHTML many of them say "what the heck is XHTML". Well, you may have noticed
that HTML and XHTML (Extensible HyperText Markup Language) look very similar. They
both use tags that are delimited with < and > characters.
But HTML was designed long before XHTML and therefore is less rigorous. In other
words, HTML does not require the coder to follow strict rules, while if you don't
strictly follow the rules while coding XHTML, it just plain won't work. XHTML
is an attempt to make HTML as rigorous as XML. In fact an XHTML webpage
IS an XML document.
Here are the rules your code must follow to become XHTML:
- Tag names must be in lower case
- Attribute names must be in lower case
- Attribute values must be in quotes
- Attribute shorthand is not allowed
- Use the id attribute instead of the name attribute
- Tags must be properly nested
- All tags must be closed
- The Web page must have proper structure
- The Web page must have a DOCTYPE declaration
- Validate Your XHTML
Tag Names Must be in Lower Case
Okay, first grade is over for the Internet. Stop using capital letters in your code. With
XHTML (or should I say xhtml) all tag names need to be in lower case. This is wrong:
<UL>
<LI>Use lower case
<LI>Use the id attribute
<LI>Properly nest tags
<LI>Close all tags
</UL>
Instead do it this way:
<ul>
<li>Use lower case</li>
<li>Use the id attribute</li>
<li>Properly nest tags</li>
<li>Close all tags</li>
</ul>
|