Validation alone is not enough

Some people call me a validation fanatic, and maybe they are right. I do want every HTML document I create and all the sites I build to be valid and remain valid. Validation is an integral part of quality assurance to me, but an HTML document’s validity does not tell the whole story about its quality (there are some examples in Worst code ever).

As Joe Dolson writes in Beyond Validation:

Validation, by itself, should never be considered as a primary signifier concerning the quality or accessibility of a website

For example, a CMS that is very popular in the Swedish public sector generates mostly valid markup. That may sound promising, but unfortunately the markup it produces is only valid HTML 4.01 Transitional, is absolutely jam-packed with inline CSS and JavaScript, and is severely lacking in semantics.

In comparison, a document that has a couple of minor errors when validated against a Strict doctype, but uses semantic markup and no inline CSS or JavaScript is much more in line with the true spirit of Web standards and accessibility.

Validation is very important. But validation alone is not enough.

Posted on February 16, 2007 in Quicklinks, Web Standards


  1. Exactly right. It’s better that you fail validation when you know there is a very good reason for that failure, rather than blindly believing that validation means you write good code.

  2. My favorite test is what I call “The Dad Test.” After I finish coding an HTML document, I print the code and hand it to my 62-year old father. If he can read the document and understand the content, I’m doing ok.

    Granted, there is nothing official or professional about this test. But it is grounding and keeps me thinking about semantics as I code.

  3. That’s why we always specify “valid and semantic” XHTML and CSS for products that we purchase. Can’t let the bastards get away with their crap.

    Of course, 99% of the time the code written by vendors and 3rd parties is neither valid nor semantic, and if you see less than 50 errors on any given page you’re having a good day. Sad, but true.

    We keep letting vendors get away with shockingly bad work, and nobody is willing to call them on their BS and demand that they fix their problems. I would, but I’m just a junior web dev who has no say, other than raising complaints and writing critiques and reports detailing, for the hundredth time, how this vendor product does not meet accessibility or usability or web standards as claimed.

    It wouldn’t be so bad if we could actually customise the code and integrate their products as promised, but often the code is so badly written that if you change any of their spaghetti markup, it breaks and no longer works. On the face of it, it sounds absurd, but that’s actually how it is.

    There are much worse stories to be told, but in the interests of professionalism I think I should stop there.

  4. February 16, 2007 by Anders Mogensen

    Peter: Or even worse: Blindly believing that validation means you write good WEB SITES :-)

  5. I’ve been wanting to write about this for a long time too. So many people just don’t “get” web standards so they latch on to one thing (like validation or table-less layouts) and think they’ve got it. There is so much more too it! So much education is still needed :)

    I totally agree with your point about proper structure being more important than validation. I’ve started debates about that in the past but haven’t yet been able to convince people :(

  6. Well, I’ll certainly say I was surprised to see that quote in my feed reader this morning!

    Thanks, Roger - I don’t think I need to say that I agree with your point…

  7. Validation + semantic code, that what I go for. Although there always seems to be one tiny thing that keeps me from truly clean code…why is that?

  8. February 16, 2007 by Andreas Rydberg

    Baby steps. Validating your code is very good start. Go from no doctype to transitional and then to strict, is another step. Learning one bit at the time.

  9. Too bad there isn’t a validator to validate whether code uses best practices or not. That could actually prove pretty useful. I hadn’t thought of that until reading your thoughts just now.

  10. I think it is important to look at standards as a measure (rather then ‘the’ measure) of production quality, as opposed to product quality, but also not to reduce standards too much when measuring quality. That a person uses standards, whether they 100% validate or not, is a sign that they are starting from the right place and that a quality result is possible.

  11. All good points plain and simple. You can’t just run the validator on any given page, and having the page pass think it represents good coding practices, far from it. Take a look at the attached (hopefully it’s attached) stylesheets. A super heavy stylesheet sometimes represents bloated code. No use of tables isn’t just the thing, in fact use tables where appropriate for data. On the topic of CMS’s I’ve run some pages that I am visiting and look spiffy, through the validator and had them come back with just less than errors into quadruple digits. Now that’s a P.O.S. CMS.

  12. I agree. Validation services and conformance checkers are only tools that can assist developers with their knowledge and understanding of web standards. However. It is easier to validate (X)HTML and CSS than it is to write semantic code. [Have you noticed the rise of Validistas?]

    Semantics - after several years of discussion - still remains interpretative. My recent favorite discussion regards proper use of <strong> versus <b>. How are developers adhering to web standards suppose to understand semantic code when no consensus exist. Content Managements Systens don’t help.

    Do you ever get the feeling that most commercial Content Management Systems are the new Front Page?

  13. February 17, 2007 by Thomas

    Jero. If you’re talking about semantics, why do you use the “h1”-element two times? That’s one serious failiure to semantics.

    The “h1” should be used as an description of your page or for the site’s title. Then use h2-h6 depending on how important the headings are.

    (sorry for my bad English)

  14. Well first of all, the H1-H6 elements aren’t made to be used for site names/titles, they’re made to “describes the topic of the section it introduces.” In other words: they serve the same purpose as they have in, for instance, magazine articles. Therefore, they shouldn’t be used outside the content of a web page.

    As you can see, Roger uses the H1-H6 elements only in his content section and side bar. In his header, with the 456 Berea Street logo, he uses only a DIV element that contains the logo of 456 Berea Street. There’s not even a H# element near it.

    So I use an H1 element for my site name, Roger uses a DIV. The difference is caused by the fact that there’s actually no “proper” element to use. Fortunately this issue has been addressed by both HTML5 and XHTML2.0 by adding respectively the HEADER element and the role attribute. So for now, I guess everyone has to be creative and use his/her own ideas to make up for this lack of semantics in HTML 4.01.

    BTW, “Some people consider skipping heading levels to be bad practice. They accept H1 H2 H1 while they do not accept H1 H3 H1 since the heading level H2 is skipped.”

  15. So for now, I guess everyone has to be creative and use his/her own ideas to make up for this lack of semantics in HTML 4.01.

    Jero, I agree. It is personal preference based on one’s understanding of what semantics means and following examples of those whose methods and opinions one respects.

    As Devon has noted above, a “Best Practices” conformance checker would help. But then you’d have to get consensus on the semantic definition of the word “content” (as it relates to web pages).

  16. I’m new to web standards, but have tried to adhere to best practices. As a professional writing and multimedia instructor, I advise students to only use one h1 per page—so while it might not be the document’s “title,” it does function as the page’s “topic sentence.” At least, that’s how I interpret the primary header.

  17. At the times I’ve been learning html I used to create valid html… Based on tables, inline styles and no clue about what semantics is about…

    I think this is a true example of it can be shown on the previous (and may be the last one also) home page of Microsoft’s website.

  18. I think the thing to remember is that validation alone is not enough, but if a site doesn’t come close to validating then it most certainly is not going to be semantic or built to best practice guidelines.

    Sometimes I come across CSS-based sites which only have 3 or 4 validation errors per page, and that’s usually because of some obscure tags or attributes inserted by the CMS. I think those kinds of errors are forgivable, as the web designer clearly went to a lot of trouble to make sure that the markup and CSS are standards compliant, even if it doesn’t actually validate 100%.

    What gets my ire is sites which claim W3C/508/WCAG standards compliance, but are riddled with dozens of basic errors, such as missing alt attributes, and the extensive use of tables for layout.

    The notion of “Standardistas” who supposedly go around terrorising web developers is a myth. The truth is that the vast majority of web sites built today are still far from standards compliant or accessible, and these shoddy web developers are desperately defending their unprofessional work, or even outright lying to their clients who don’t fully understand the importance of web best practices.

  19. I agree with the point about people and companies using Transitional doctypes and claiming the code is valid.

    A company coded the templates for our new government website using a transitional doctype and then labeled it valid (with errors) and level 3 accessible.

  20. What CMS is popular in Swedish public sector ?

  21. I’m wrapping up a redesign of a 60+ page mess - an academic site full of bad code, nested tables 5 deep in some places, running on a Mac-based database platform so obscure that they can only find one commercial hosting company that supports it well.

    I redesigned the site to XHTML 1.0 Strict and nearly every page validated (it’s important to me that the vast majority of what I do validates, but I’m not going to get hung up on a few little things when I’m working with strict).

    Then I was told a few weeks ago that I had to change it all back to HTML 4.01 Transitional because their database didn’t like Strict. That was disappointing - but not too surprising, since some of the editing they’re doing to their new site now involves dropping nested tables into my clean tableless markup.

Comments are disabled for this post (read why), but if you have spotted an error or have additional info that you think should be in this post, feel free to contact me.