Staying compliant with HTML standards will let you reach the broadest audience possible. Here we offer some tips and tools that will help you validate your HTML code.
There was a time when building Web
pages that were compliant with a dominant Web browser's engine—first Netscape
and later Internet Explorer—was good enough for most Web sites' needs. That time
is quickly passing, however, as compliance with established standards has become
an important issue for most Web developers. There are three good reasons for
that:
1. Internet Explorer is no longer the
only—or even primary—method by which everyone accesses the Web. IE is certainly
still huge among the options that many users have, but there are other browsers
that have gained an audience in recent months and users, largely due to the
prevalence of open source projects and proponents. Browsers that may be visiting
your sites include Mozilla (the open source version of the Netscape project),
Chimera, Opera, OmniWeb, Konquerer and Apple's Safari, among many others. In
order to render optimally in all those browsers, it's important to stick close
to the standards.
2. Web browsers running on desktop and
laptop computers aren't the only devices accessing the Internet anymore. These
days you've got tons of different devices and applications—from mobile phones to
PDAs to accessible browsers for the physically challenged—all with different
requirements and limits. The closer you are to HTML standards, the better off
users of those browsers will be.
3. HTML has become XHTML. XHTML is
essentially a recast of the HTML language in something that's XML-compliant,
making it a more universally understood and accepted markup language. But,
moving from HTML to XHTML has created its own issues, as XHTML is stricter about
certain constructs that HTML allows (for instance, XHTML doesn't allow "empty"
tags, so the horizontal rule <HR> tag in HTML should be <hr /> in
XHTML) and it's a bit less lax about the syntax.
Thanks to these three factors, a number
of things have happened to what's considered "standard" HTML. First,
browser-specific commands are strongly discouraged. While IE still has some,
they aren't as prevalent as they were during the browser wars between Netscape
and Microsoft. Still, they should be rooted out. Second, older HTML codes for
specific the look of the text as it's rendered—the FONT, FONT SIZE and CENTER
tags, to name a few—are discouraged. Instead, XHTML now requires that appearance
controls be left to CSS style sheets and the STYLE element. And, finally, XHTML
should always be "well-formed" code, complying with the syntax standards of
XML.
The easiest way to build compliant
pages is to check your graphical Web development tools for their compliance with
at least the XHTML 1.0 Transitional standard. If you code by hand, check out
http://www.w3.org/MarkUp/ to learn more about the exact standards from the World Wide Web
Consortium (W3C), the official standards body for the Web. Currently, XHTML
Transitional compliance is acceptable, although, ideally, new pages can be
designed as XHTML Strict, particularly if you don't have reason to believe that
older browsers will be accessing your pages frequently.
If you've got pages that you've already
created, you should check them for HTML/XHTML compliance. The W3C offers an
online validator at http://validator.w3.org/ that you can access to check to see if
individual pages are valid by plugging in their URLs and allowing them to be
loaded and checked. The W3C also offers http://jigsaw.w3.org/css-validator/ can validate your CSS style sheets.
The Web Design Group (WDG) offers a
validator at http://www.htmlhelp.com/tools/validator/ that also offers a batch mode for multiple pages. For a
third-party option (which claims improvements over the more "official" options)
try ARVal HTML Validator at http://www.dandylife.com/arval/docs/arval.shtml.