When I write HTML code I want to check if I made any mistakes. Same thing if I use an application or a CMS that outputs HTML code. So I use validation as a tool to check the HTML code for errors. If there are any I want to find them and fix them if I can.
Even though I think it is a very important part of developing websites, validation in itself is not the goal. Validation is a tool to help you produce well-formed markup that is universally parsable and hopefully understandable and maintainable by other developers.
When you strive to keep all validation errors out of your HTML, the validation tool becomes much quicker and easier to use – if it flags an error you immediately know that it is something you need to fix. You don’t have to manually check if it is on your own list of “allowed errors” or if it is a real error like a typo, a misnested tag, a forgotten end tag or a forgotten
Web browsers are forced by the zillions of web pages that are filled with junk HTML to be very forgiving when it comes to invalid HTML, so many kinds of validation errors do not affect the end result at all. But in almost all cases neither does correcting those errors, so there is no point in not doing so.
I can think of two valid (haha) use cases for invalid markup:
- Improving accessibility, for example by using WAI-ARIA attributes in HTML 4.01 or XHTML 1.0
- When you are right and the validator is wrong (i.e. has a bug)
Writing invalid HTML just because you can is not one.