The below is taken from the book, HTML 4 in 24 Hours, fourth edition, by Dick Oliver. The excerpt is from pages 369-370.
XHTML, The New HTML
XML does pose a few problems, not the least of which is that the HTML and XML standards are almost ---but not quite -- compatible with one another. To smooth out these technical bumps, the W3C created a 100 percent XML-complaint version of HTML 4, called (you guessed didn't you?) XHTML 1.
(does this mean there will never be an HTML 5 standard? Sort of. There will undoubtedly be more tags and attributes added to HTML in the future, but the result will be probably called XHTML 2 instead of HTML 5.)
The most important thing for you to know about XHTML? How to write your Web pages for compatibility with it, while still remaining compatible with HTML-based Web browsers. If you learned HTML from this book, you have nothing to worry because every example in the book and on the accompanying Web site, http://24hourHTMLcafe.com, is fully compatible with both HTML 4 and HTML 1. If you have some older HTML pages that you need to convert for XHTML and XML compatibility, the following check llst will get you there:
1. In HTML it doesn't matter whether the tags are uppercase, lowercase or a mixture of both. In XHTML all tags must be lowercase. For example, use <body> instead of <BODY>.
2. Closing tags are often optional in HTML, but are always required in XHTML for any tag that encloses (refers to) some content. For example every paragraph must be begin with a <p> tag and end with a </p> tag. Likewise every <li>
list item must have a closing </li>, every <td> table data cell must have a closing </td> and so forth.
3. HTML tags that don't enclose any content such as
<br>, <hr> and <img> must now contain a slash. Examples: <br />, <hr />, <img src="pic.gif">. This tells the XHTML interpreters not to expect a closing tag.
4. In XHTML all attributes values must be enclosed in quotation marks. For example, <img src=pic.gif border=1> was valid HTML, but it must be written as
<img src="pic.gif" border="1" /> or <img border="1" src="pic.gif" /> to be valid XHTML. The use of the width and height attributes is also highly recommended to enhance loading time and the alt attribute as well. Such as:
<img width="?" height="?" border="0" src="......." alt="describe image" />
5 All attributes must have values in XHTML. For example, <input type="check-box" checked> should technically now be written as <input type="checkbox" checked="checked">.
6. For technical reasons (read: bizarre and confusing reasons we don't need to get into) uses <a id="AnchorName"></a> instead of <a name="AnchorName"></a> to create a named anchor. (see hour 7.) "Email Links and Links Within a page," if you don't remember what an anchor is.) This is the only contradiction between HTML 4 and XHTML 1, but it's easy enough to be compatible with both. Simply use <a id="AnchorName" name=AnchorName"></a>. (This redundancy is a bit of a hassle to type, and to be honest I haven't strictly followed the rule on this one in some of the example in this book or on my own Web sites, since I doubt anyone will ever actually write software that fails to recognize name as meaning the same thing as id in this context.)
7. Certain special characters are not allowed in HTML because in context it might be hard to tell if they were meant as part of a mark-up tag. XHTML forbids the same characters, but is much more strict about not allowing them to appear in embedded style sheets and scripts.
|" [quotation/inch mark]
|< [open angle-bracket]
|| < or <|
| > [close angle-bracket]
|| > or >|
|[ [open square bracket]
|| [||] [close square bracket]
The below tags should be used like this to tell the XHTML interpreters not to expect a closing tag:
<basefont />soon to be deprecated along with <center>
A deprecated element or attribute is one that has been outdated.
Deprecated elements may become obsolete in the future, but browsers should continue to support deprecated elements for backward compatibility.
For Computer Users
If you have a number of HTML pages that you'd like to convert to XHTML-compatible format, I highly (the author) recommend that you down load the free HTML-Kit software from http://www.chami.com/html-kit/. This free program includes a module called HTML-Tidy, which automatically changes HTML to conform to the rules mentioned here and also reports any other problems or incompatibilities it finds.
HTML-Kit is also a friendly and well-designed text editor with many handy features for writing new HTML and XHTML pages. I (again the author) used HTML-Kit 1 to convert and edit every example file in this book and didn't encounter any bugs or errors; you shouldn't hestitate to trust your precious pages to it. One caveat: HTML-Tidy changes the line breaks and spacing of your code, so you may have to some reformatting by hand if you like to neatly indent your code.
The HTML Writers Guild has many
HTML and XHTML Syntax & Programming Tips. This site has more HTML tips & information than a dog has fleas. LOL
The World Wide Web Consortium (W3C) develops interoperable technologies (specifications, guidelines, software, and tools) to lead the Web to its full potential as a forum for information, commerce, communication and collective understanding. Find out more about W3C click here.