Validating Your Code

One good tool for finding errors on a page is to run it through a validator. An (X)HTML validator will look at the DOCTYPE to see which version of HTML or XHTML you say you’re using (see pages 40 and 56), compare your code against the actual specifications of that version, and then display any inconsistencies it finds. A CSS validator works similarly.

To validate your code:

1.
First check your (X)HTML with the W3C’s http://validator.w3.org/
2.
Once your (X)HTML validates, you can make sure your CSS is free of errors with http://jigsaw.w3.org/css-validator/
Figure 22.14. That text to the right of the image isn’t supposed to be so big. What’s the problem?

✓ Tips

  • Validators have a hard time getting ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.