22.04.2013 Views

HTML, XHTML & CSS

HTML, XHTML & CSS

HTML, XHTML & CSS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

48<br />

Part VI: The Part of Tens<br />

Although you’re building documents, it’s easy to forget to use closing tags,<br />

even when they’re required (for example, the that closes the opening<br />

anchor tag ). When you’re testing Web pages, some browsers can compensate<br />

for such errors, leaving you with a false sense of security.<br />

The Web is no place to depend on the kindness of strangers. Scrutinize your<br />

tags to head off possible problems from browsers that might not be quite<br />

so understanding (or lax, as the case may be). Validation (using http://<br />

validator.w3.org) is always a good idea, too!<br />

As for claims that some <strong>HTML</strong> authoring tool vendors make (“You don’t have<br />

to know any <strong>HTML</strong>!”), all we can say is, “Uh-huh, suuurre. . . .” <strong>HTML</strong> is a big<br />

part of what makes Web pages work; if you understand it, you can troubleshoot<br />

with minimal fuss. Also, only you can ensure that your pages’ inner<br />

workings are correct and complete, whether you build them yourself or a<br />

program builds them for you.<br />

We could go on and on about this, but we’ll exercise some mercy and confine<br />

our remarks to the most pertinent items:<br />

✓ Keep track of tags yourself while you write or edit <strong>HTML</strong> by hand. If<br />

you open a tag — be it an anchor, a text area, or whatever — create the<br />

closing tag for it right then and there, even if you have content to add.<br />

Most <strong>HTML</strong> editors do this for you.<br />

✓ Use a syntax checker to validate your work during the testing process.<br />

Syntax checkers are automatic tools that find missing tags or errors. Use<br />

these syntax checkers whether you build pages by hand or with software.<br />

The W3C’s (free) validator lives at http://validator.w3.org.<br />

✓ Test pages with as many browsers as you can. This not only alerts you<br />

to missing tags, but can also reveal potential design flaws or browser<br />

issues (covered in the later section, “Do Avoid Browser Dependencies”).<br />

This exercise also emphasizes the need for alternate text. That’s why we<br />

check our pages with Lynx (a character-only browser). Ask friends, colleagues,<br />

and co-workers to check out your work, and tell them to use as<br />

many browsers as they can, too. Please!<br />

✓ Always follow <strong>HTML</strong> document syntax and layout rules. Just because<br />

browsers don’t require elements such as , , and <br />

doesn’t mean you can omit them. It means browsers don’t care whether<br />

you use them or not. But browsers per se are not your audience. Your<br />

users (and future browsers) may indeed care.<br />

Although <strong>HTML</strong> isn’t exactly a programming language, it makes sense to treat<br />

it like one. Following formats and syntax helps you avoid trouble, and careful<br />

testing and rechecking of your work ensures a high degree of quality, compliance<br />

with standards, and a relatively trouble-free Web site.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!