XHTML validation guide
Writing code is one thing, making sure that code is proper is another thing. This process can be quick and easy, long and difficult, or anything in between.
This lesson focuses on:
- Why validate?
- Document types
- Where and how to validate
Why validate?
Validation shows that you have taken the time to write semantic code that follows proper XHTML standards.
XHTML has certain rules and conventions that should be followed if you want your pages to appear as you intend them to appear across browsers. Page validation is the process by which this is verified. Everyone makes mistakes, and it's ok to have a few errors here and there, but whenever this happens and your pages don't validate, you should take the time to fix them.
Document types
Remember to classify your pages into the right category that they belong to.
Transitional document type
If your page uses deprecated features, use the transitional document type.
Example:
Frameset document type
If your page is built in frames, use the frameset document type.
Example:
Strict document type
If your page contains no deprecated features and no frames, use the strict document type.
Example:
For more information on XHTML document types read our XHTML document type definition lesson.
Where and how to validate
You can validate your pages at the free validation service provided by the W3C available at validator.w3.org. This validation service will let you validate either a webpage that is currently online, a local file from your own computer, or by direct input.
Validating a webpage with validator.w3.org
The most common method of validation. You can validate a webpage by inputing the absolute url of the page. The validator will return the results which will included the number of errors and where they occur (if there are any errors). If there are no errors, the validator will tell you that the page was successfully checked and 'passed' the test.
Validating a local file with validator.w3.org
You can validate a local file by uploading that file. Once you upload the file, the validator will return the results which will include the number of errors and where they occur (if there are any errors). If there are no errors, the validator will tell you that the page was successfully checked and 'passed' the test.
Validating by direct input with validator.w3.org
You can validate code by direct input by entering the code in the textarea provided on the validation page. You can input as much or as little code as you need. The validator will return the results which will include the number of errors and where they occur (if there are any errors). If there are no errors, the validator will tell you that the code was successfully checked and 'passed' the test.




