XHTML page validation
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 tutorial focuses on:
- The page validation process
- Why validate? Is page validation really that important?
- Where can I validate my pages?
- Validation examples
The page validation process
Page validation checking the code of an XHTML document so that it conforms to certain standards and syntax rules such as having the <!DOCTYPE> declaration, that tags are closed in the proper order, that attributes are quoted, and more.
Why validate? Is page validation really that important?
Page validation is important because it 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 different web 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.
Where can I validate my pages?
The W3C provides an XHTML document validation service that you can use for free available at http://validator.w3.org. You can use it to validate an XHTML document that is already online, an XHTML document from your hard drive, or directly input XHTML code. If there are any errors, the validator will inform you of this and will also inform you where the errors are located so that you can fix them.
Specifically, the validation process involves checking an XHTML document against the document type definition that you classify it into. For example, if you claim an XHTML document as part of the strict document type definition, then the validator will check that you are following the rules for that document type definition such as not using any deprecated features, closing tags in the proper order, and so on.
For more information on XHTML document types read our XHTML document types tutorial.
Validate this page
Validate the XHTML of this page:
Were there any errors in the validation of this page?
We try our best to make all the pages on this website error free, but if the validator returned some error(s) please contact us about it. Thanks!
Validate some other page
Enter a URL into the below textbox to validate a page:
Were there any errors in the page you validated?
If it's your page, take a look around it to try and spot the errors and then re-validate. Re-validate as much as you need until you get a valid page. Make sure to keep in mind the differences between XHTML and HTML and proper XHTML syntax.
Check out the program HTML Tidy as a solution to fix errors in your HTML code.
NOTE: You can use the validator at w3.org to validate a file that is currently online, a local file on your hard drive, or code that you directly input into a textarea on the validation page.