Lesson 2: Validating Your CSS
In this lesson, you will have an opportunity to use the
W3C CSS Validator, and to correct invalid style definitions based on
tool feedback. Just like with HTML, a web page that has invalid CSS might look
fine in your browser, but someone accessing the page in another browser might
have an entirely different experience with the same content. Since CSS is newer
than HTML, browsers are even pickier about requiring that developers get it
At the completion of this exercise:
- you will be able to test a web page using the W3C CSS Validator.
- you will have gained practice interpreting the Validator results and applying them toward correcting invalid CSS code.
Validate a Sample Page
- Open the sample page with invalid CSS .
Does this page display ok in your browser?
- View the web page's source code. Can
you find the CSS errors?
- Now try testing this using the W3C CSS Validator. What CSS
the validator find? Did it find any errors that you overlooked? Use the second option to "Validate by File Upload" and browse to locate the sample invalid web page on your local drive.
any problems found by the Validator, then save the web page, and retest until
the document passes the validity test.
Validate Your Own Pages
- Validate all web pages you have created in this course using the W3C CSS
- Correct any problems found by the Validator, then retest until the document
passes the validity test.
- After the page passes the validity test, the W3C Validator will
you with some source code for adding a W3C CSS icon at the bottom of
Paste this into the body of the document wherever you think it looks
- This is your trophey for creating a valid web page!
Turn your web page into your instructor, so they can confirm that it has valid
Copyright © 2005-2008 by University of Washington.
Permission is granted to use these materials in whole or in part for
educational, noncommercial purposes provided the source is acknowledged.
This product was created with support from the National
Institute on Disability and
Rehabilitation Research of the U.S. Department of Education (grant
#H133D010306), and is maintained with support from
the National Science Foundation (grant #CNS-0540615). The contents do not
necessarily represent the policies of the U.S. federal government, and you
should not assume their endorsement.