UNIT 5 >
MODULE 4
Lesson 2: Validating Your CSS
Overview
In this lesson, you will have an opportunity to use the
W3C CSS validator, and to correct invalid style definitions based on validation
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
right.
Learner Outcomes
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.
Activities
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 errors does
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.
- Correct
any problems found by the Validator, then save the web page, and retest until
the document passes the validity test.
- After the page passes the validity test, the W3C validator will provide
you with some source code for adding a W3C icon at the bottom of your page.
Paste this into the body of the document wherever you think it looks best
- This is your trophey for creating a valid web page!
Validate Your Own Pages
- Validate all web pages you have created in this course using the W3C CSS
Validator.
- Correct any problems found by the Validator, then retest until the document
passes the validity test.
- After the page passes the validity test, add a W3C logo to your page wherever
you think it looks best.
Resources/Online
Documents
All done?
Turn your web page into your instructor, so they can confirm that it has valid
CSS.
Copyright © 2006 by University of Washington. Permission is granted to copy these materials for educational, noncommercial purposes provided the source is acknowledged. This product was funded by the National Institute on Disability and Rehabilitation Research of the U.S. Department of Education (grant #H133D010306). However, the contents do not necessarily represent the policy of the Department of Education, and you should not assume their endorsement.