What is Validation?
Validation is a process by which we verify we’ve made no syntax or rules violations on our web pages. There are many reasons to take this extra step on all our documents:
- Removing errors improves the consistency of how our pages look to a wide variety of browsers and devices.
- Ensuring that our pages adhere to web standards will maximize the chance that they will display properly in future browsers.
- Catching and correcting errors early helps new web designers learn and improve more quickly.
- Writing clean, error-free code is a sign of professionalism to employers and other web designers.
How Validation Works
The World Wide Web Consortium (W3C) is an organization that creates the rules and standards for web documents. Each HTML version has a different set of standards.All our web pages in this course use a DOCTYPE of XHTML 1.0 Transitional. When we submit a web page for validation, me must comply with this specific set of rules in order for our documents to pass with no errors.
Where to Validate a Web Page
To validate a web document, we use the W3C website’s validation tool at: http://validator.w3.org/If Our Page Passes Validation
If our page is error-free, we will see the following screen:It’s also possible that the document will pass validation but have some non-error warnings. Be sure to scroll down and view these warnings to see if there are ways to improve your page further.
Viewing the Errors
The errors will be listed in the order they were encountered:Sometimes the error description can be a little confusing, but by finding the line of code in our document and taking a closer look, we can usually discover our mistake and correct it.
Don’t panic when your web page contains errors and fails validation. It’s quite common, especially for novice web designers.
- Instead of trying to fix everything in one shot, make one or two corrections and then revalidate the document. Often, you’ll find that by making a single correction, the error count will drop dramatically.
- Continue this process of fixing an error or two and then revalidating until the document passes validation.
- It’s good practice to make sure all the pages of a site pass validation prior to making them live on the internet.
- Don’t forget to revalidate a page any time you make changes to it.
The markup validator we just used will examine only the XHTML code of our document, not the CSS. There is a separate validator for CSS, available at: http://jigsaw.w3.org/css-validator/