XHTML is the latest World Wide Web Consortium standard as of this writing. It stands for XML Hypertext Markup Language (XHTML). It replaces HTML but is much like HTML with some additional rules to add better structure to the language. It, like HTML, has a strict, transitional, and frameset DTD.
- The XHTML document must be well formed. This means:
- There must be one and only one top level element.
- All elements must have a starting and an ending tag with matching starting and ending names. For instance documents that normally have no closing tag are normally written:
Now must be written:
- Element names are case sensitive.
- Elements must be nested properly.
- Tags must be in lower case letters.
- Values of attributes must be in quotes. Formally the following would be OK:
<A href=index.html target=_top>
Now use the following:
<a href="index.html" target="_top">
- Attributes may not be minimized.
<tr><td nowrap<find /var/spool -mtime +40</td></tr>
<tr><td nowrap="nowrap"<find /var/spool -mtime +40</td></tr>
- A DTD Declaration with head and body elements must be present in the document. The DTD can be Strict, Transitional, or Frameset (for Frames). An example DTD declaration is shown below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
Of course after the DTD declaration an <html> element should exist which includes both a <head> and <body> element as is contained in a normal HTML document.
- The name attribute is replaced by the id attribute.
<input type="text" name="firstname" />
<input type="text" id="firstname" />