
| 
| 
|
Even in HTML 4.01 it is good to follow XHTML standards for two big reasons:
Clean, well-formed mark-up is easier to read. Always close non-empty tags and insert a Doctype. |
|
If you decide to make the switch in the future, most of the work would already be done. |
|
Expect problems when you first start out with XHTML
In HTML <img> tags must have an "alt" attribute. When validating your pages for the first time, most likely, the most common error would be missing "alt" attributes.
Invalid | Valid | <img src="foo.png" /> | <img src="foo.png" alt="foo" /> |
The "alt" attribute was not meant for use for displaying tool-tips, but Microsoft Internet Explorer does anyway. The correct way to display tool-tips is with the "title" attribute. Thus, a good tip on getting rid of the tool-tip that is generated from the "alt" tag is to use the "title" attribute like so:
<img src="foo.png" alt="text seen while loading" title="text seen in tool-tip" /> |
|
Remember that anything that is invalid in HTML 4.01, will also be invalid in XHTML as XHTML builds on HTML.
Good luck in your future XHTML coding!
A note for PHP users
The <?xml ... ?> tag will cause problems for users of PHP with short_open_tags enabled as the PHP engine will pick up the <? and ?> and misinterpret them as the beginning and end of a PHP script. To fix this problem, disable short_open_tags and use <?php and ?> for scripts instead, or use this quick fix:
<?php print "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"; ?> |
|
Tell me more!
Further information covering (X)HTML is available from: http://www.w3.org/MarkUp/
Official documentation on XHTML 1.0 is available from: http://www.w3.org/TR/xhtml1/
Official documentation on XHTML 1.1 is available from: http://www.w3.org/TR/xhtml11/
Official documentation on XHTML 2.0 is available from: http://www.w3.org/TR/xhtml2/
This article was authored by Damien Bezborodow
of Palomino Web Design and LearnWebPages.Com.
Thanks for invaluable input and proofreading from J. King.
- Discuss topics covered in this article here!
- See how the article was created here!
|
|
|
|

|

|