Does validating HTML documents matter
The big question is does validation really matter. Web pages can be built and can run without documents completely validating. A document will still render and function normally even if you have a lot of syntax violations. The answer is yes, because standards matter in many things in life. Websites are made up of many different things which can be done quickly or they can be done right. The W3C standard is the agreed specification of how documents should be built. Generally errors occur as a result of poor and lazy coding practices or a poor understanding how to build specific document syntaxes. If you adhere to a standard set out before you, you will improve how you structure your documents. It’s always worth throughout development to test your documents using the W3C document validator.
There are differences between the different HTML languages like HTML 4, XHTML, and HTML5. XHTML is a bit of a stricter language than HTML 5. HTML 5 allows you to nest certain elements that XHTML does not and if you nested them within an HTML 5 document you mass pass validation but with an XHMLT document you may not. Small errors like this can cause you to fail W3C validation. If you include anything like a custom Meta tag which isn’t in the W3C specification your document can also fail validation. There may be times when you can’t get a document to completely validate but you should always try to get a document to validate as much as actually possible. If you have things like nesting errors you should try to correct them or if you have document encoding errors you should try to fix them also.
Why you should validate HTML
If you don’t validate your document you can cause issues for yourself with other parts of your page. If you have nested schema within your web page you could break it if you have syntax errors. If you validate your documents as you go you can stop these sorts of thing from happening. A lot of the time if we have nesting errors we rely no our eyes too show us. A nesting error usually means a div out of place or the page design may completely break. But there can be times when a nesting error is not completely apparent. If you have a very detailed and complex page or a very long page the issue may not be completely apparent and may go unnoticed. Syntax errors can quickly build up on large pages. You can end up with so many errors that may not pick up on critical errors within your document. If you have a web page that has a large number of URL’s with un-escaped ampersands (&), you can easily have dozens or hundreds of syntax errors on one page. If you don’t get into the habit of validating documents when they change, errors can build up and you may introduce a serious syntax error and not realise it. If you have a large website and you have one file generating thousands of template pages, a syntax error within this page will probably carry along to all the generated pages giving you thousands of syntax errors. If proper document validation is a factor in search engine algorithms this many errors could have an impact of your page performance.
Validating HTML 5
Validating CSS can be much harder than HTML for the fact there can be a lot more times you may use rules which are not supported within the official specification. The CSS specification could be considered fragmented in nature as different browser like IE, Firefox, and chrome have their own unique rules. If you’re in the position where you can’t get CSS to validate generally its not the result of poor coding but the fact that you are using rules which don’t completely validate but are required to work for a specific vendor. You can use the W3C CSS validator to check your CSS.