| Q: Why should I validate my HTML or XHTML files? |
|
|
|
| Frequently Asked Questions (FAQ) - HTML and XHTML |
| Written by Ed Tittel and Rebekkah Hilgraves |
|
Ed's comment: The best reason for validation is to make sure you're not breaking or bending any rules of (X)HTML syntax. Browsers can be entirely too forgiving sometimes, so even the most thorough browser-based page and site testing won't always catch subtle or unexpected errors. After 11 previous editions of this book, in fact, your authors learned some interesting things about nested lists in (X)HTML that we'd never bothered to check before. Purely as an example of how common understanding can sometimes subvert proper (X)HTML syntax, we observe that to meet the criteria for which elements may be included inside which other elements, we learned that a nested list (the inside list, that is) must be enclosed within a pair of <li></li> tags (or inside a valid list element in the outside list) to validate properly. Though every browser we tried doesn't balk at this common violation of proper (X)HTML syntax, it is indeed an error to omit the enclosing list item element for the inside list. Only our decision to validate everything for this book showed this to us! Rebekkah's comment: An additional reason for validation is that if you do not have access to multiple browser types (not everyone tests on IE6, IE7, Netscape, Firefox, Flock, Safari, Opera, and Lynx after all!), this is a great way to make certain that your code will be rendered properly across those browser platforms -- how they actually appear on those other platforms is another topic altogether, and would probably provide enough good fodder for a separate book! |
| Last Updated on Monday, 30 June 2008 11:32 |