Basic xhtml Rules
xhtml, Extensive Hypertext Markup Language is a subset of HTML
xhtml (Basic) is a sub-set of XML
and it is fast becoming the standard for cell phone web browsers
xhtml (Basic) rules
- Use lower case only for elements in source
- All elements must have a closing tag
- Some characters are "Reserved" and must be replaced with a "coded entity" name
- Nesting
Tags must be written in the proper "mirrored" order
Incorrect xhtml nesting example:
<p><strong>This is nested wrong</p></strong>
Correct xhtml nesting example:
<p><strong>This is nested correctly for xhtml </strong></p>
- Attributes must be written as name = "value"
With the quote marks!
- Use "id" Instead of "name" The <a>, <frame>, and <img> elements have an attribute called <name> that is used to specity a location within the HTML page. In XML and xhtml the <id> attribute is used instead.
| HTML |
xhtml |
| <BR> |
<br /> |
| <hr> |
<hr /> |
| <img> |
<img /> |
| <meta> |
<meta /> |
A full list of Reserved Characters and their (x)html replacement name is listed at Elizabeth Castro's Web Site
Table below lists common characters and their "name entities"...
| Character | Entity Number | Entity Name | Description |
|---|---|---|---|
| " | " | " | quotation mark |
| ' | ' | ' (does not work in IE) | apostrophe |
| & | & | & | ampersand |
| < | < | < | less-than |
| > | > | > | greater-than |
| (empty space) |   | | non-breaking space |