Initially you may ask yourself, “What’s a validator?” A validator is a program, usually web based, that will check your web pages against the most current web standards. When you use a validator to check HTML, XHTML, CSS, or XML documents, the validator will return a list of errors and warnings found according to your chosen standard. Whether you created the website yourself or someone did it for you, it’s always the best practice to make sure your website validates.
But Why Validate Your Website?
Cross-Compatibility – While modern web browsers do a good job of catching incorrect or degregated code, some errors are not always caught. Oftentimes, different browsers across different operating systems handle errors unusually, making it difficult to display layouts or styles uniformly.
Future-Proof – Checking to make sure a page “Looks Okay” with a variety of browsers may be reasonable for today, but it doesn’t assure you that it will work tomorrow. Creating web pages with the globally agreed upon web standards makes them easier to maintain and is the most trusted way to guarantee that future browser versions will display them as they were designed.
Professionalism – You wouldn’t stay in a hotel that had holes in the walls, nails sticking out, or missing table legs. It’s the same idea with users visiting your website. You should take pride in having your website validate by using wellformed markup, and separating style and content. Validation can be a quick check if your code was done professionally and up to par with today’s web standards.
Ok, Now How Do I Validate My Site?
There are a number of validators out there but the one most commonly used is the Markup Validation Service built by the World Wide Web Consortium (W3C). With this service there are three ways you can validate your code.
1. Validate by URI – In this method you simply enter in the address of your website or a specific page and click the “Check” button.
2. Validate by File Upload – This approach allows you to upload a certain file to be checked. This is perfect for a site that may still be on your local host.
3. Validate by Direct Input – This input method is useful for troubleshooting. Just enter in a code segment to test whether your script will validate properly.
More Validation Options
This markup validation service also has some helpful customization if you click on “More Options”. Typically it will automatically detect what document type or character encoding is used, but you do have the ability to change it if you know what you’re doing. Another option that’s highly suggested is to tick the ‘Clean up Markup with HTML Tidy’ box. This will automatically recommend fixes to your code errors.
Valid vs. Invalid
After you have entered your website and clicked the “Check” button, you will see one of two messages. This is an example of a check that is VALID.
Below is an example of a website that checked as INVALID. You will get a summary of errors and warnings. Errors are given when the code does not respect the doctype recommendations. Warnings don’t state a problem, but they give you a heads up that it may lead to some strange behaviors by your site.
Checking & Fixing Validation Errors
The screenshots above were just the summaries of the validation check service. Below those summaries you will find a more detailed description for each of the warnings and errors.
The warning will give the exact line of your code where the problem is located, give a description of the warning, and highlight the code segment that is in question. For this example, we can see that the language attribute is no longer used in current practices and can be deleted.
There you have it! After you have addressed and corrected all of the errors it’s safe to say your website is valid and updated to the most modern web standards and practices. W3C also has validation tools for CSS, RSS feeds, XML documents, and mobile devices. You can find out more about them here.
HostDime.com is a global data center infrastructure provider offering an array of cloud products from managed hosting servers to colocation services that cater to a range of clients, from entry-level to enterprise-level operations. HostDime owns and operates infrastructure and networks in seven countries, with its flagship facility in Florida, USA. Currently with a client base of more than 50,000 clients globally across 6 globally dispersed networks, HostDime is one of the most reputable data center companies in the world.
Our contributing blogger Nate Hanson is a web designer and programmer residing in Orlando, Florida.