untitled

(John Hannent) #1

Trying Out the W3C Validator ...................................................................


W3C — the World Wide Web Consortium (Wtimes 3, get it?) — offers a way
to test your Web pages’ HTML and CSS code. However, the W3C offers debug-
ging utilities (they call them validators) that are so strict and exacting that
you might want to consider alternative utilities.

Before you even resort to a professional utility, I suggest you first try to locate
errors in your code by yourself. Not only do you find the problem fairly often,
but this approach helps your to remember what to watch out for (what your
personal boo-boos often are). Also, a validator tends to give you more infor-
mation than you want. It might tell you not just what doesn’t work, but also
what doesn’t work in some obscure browser, or what might not work in the
future. It also makes quite a few “recommendations,” like telling you that you
should provide a generic font family just in case somebody doesn’t have the
one you’re expecting.

To look at the validator, go to the main W3C page:

http://www.w3.org/

and click the Validatorshyperlink. Alternatively, go directly here (this address
was correct at the time of this writing, but may change):

http://jigsaw.w3.org/css-validator/

You can test your page three ways:

Provide the validator with the URI (address) of the Web page or pure
CSS external style file.

Upload the code file (this is only for CSS files).
Copy and paste the CSS code directly into the W3C Web page.

You’re probably familiar with the term URL (Uniform Resource Locator), but
the good folks at W3C call it instead a URI (Uniform Resource Identifier).
They have their technical reasons for doing this.

Try the second validation approach (specifying a .css file on your hard drive
to be uploaded for validation) by following these steps:


  1. From this book’s Web site, copy this code:
    p
    {
    color: green;
    text-align: center;
    font-family: arial!Important;


304 Part IV: Advanced CSS Techniques

Free download pdf