Does Valid Code Help Your Blog?

Valid CodeThe W3C is the internet’s daddy. They created HTML, CSS, and dozens of other specifications that govern the use of the technologies that makes the internet thrive today. Valid code is code which meets their guidelines, and can be tested in a validator, such as the HTML and CSS ones.

Does valid code actually help your blog though?

The Mythical Benefits of Valid Code

  • Valid code helps my search engine rankings. Good code helps your search engine rankings, i.e. code that the search engines can read. If you have used tables for presentation, causing your content to be split up in the coding, then Google will have trouble. However, if you just forget the trailing slash on your <img> tags, then they won’t be too harsh on you.
  • Valid code makes my site accessible to everyone. Valid code only makes it more likely that your site will be accessible. By sticking to web standards, there is a good chance that the browsers will be able to interpret your code as you’d like them to. However, each browser has quirks, and mobile devices are a whole new ball game. The only way to know that your site is accessible to everyone is to test it in as many different situations as possible.
  • Valid code buttons look good to my readers. For a technologically advanced audience of designers and bloggers, this may well be true. However, does it say anything about the quality of your actual content? And as for the rest of world, do they even know what valid is? In most cases, no, and nor do they care. Your site either works or it doesn’t. Try validating the Amazon homepage. Over 1000 errors, but the page works, and that is what matters.

The True Benefits of Valid Code

  • Fewer headaches. The most important benefit is that it simply makes sense. When you know how code is supposed to work, you can write it the way you want to, and then edit it later to account for the various browser quirks. There are few things more annoying than a bug you can’t even explain, and using valid code makes the chances of this happening much less likely.
  • Faster loading pages. Valid code is extremely efficient (That’s why they wrote it to be the way it is!). Through using standard coding practices, a certain effect can usually be achieved with the minimal amount of code necessary. This will improve further with the advanced selectors and media queries in the upcoming CSS3 specification.
  • Promotes web standards. Through validating your code, and displaying the vanity badges, you are promoting web standards. The continued promotion of these standards helps to encourage the major browser makers to work towards a goal where webpages can be compatible in all browsers. When this happens, who knows what information we could draw from well marked up sites. Jeffrey Zeldman explains it a lot better than I do, in his book Designing With Web Standards.

As a designer, I like valid code. I like the feeling that I have done something right, and in the best way possible. However, there comes a time when you have to accept that doing things in the best way possible isn’t as useful as simply getting things done.

As a blogger, having a well coded template, and using your text editor properly can only help your blog. If you just forget to close up the odd tag though, don’t worry about it. Your readers won’t.

Does your blog’s code validate? Do you even care?

Share

  1. I like to have valid code.

    I hadn’t checked since changing templates and it seems to be things that I can’t change that are the problem. It was the same with my old template, I cut down all the errors to find that standard things like referral links are not valid because they have ampersands in them! The WP links widget also doesn’t quite validate… oh well. My page works and that’s what matters ;)

    I wouldn’t mind a PHP validator to tell me what’s wrong with the plugin I’m trying to write. :P

  2. Same here Kristarella. I used to get furious at the little scripts I was using that just wouldn’t validate. Realising that it didn’t actually matter was a big boon for me. :)

    And your plugin looks good. I hope you can get it to work! I suppose your web browser is a validator itself. If it’s not valid, you get ugly messages saying “Error on line…” xD

  3. Slevi (73 comments)29 August 07

    Trying to validate my code down to 0 errors is something I mainly only do when designing the page, after that I let to tend it fate into the background since the errors which will pop up are probably minor anyways.

    Just gave it a test spin and on the index page a returning of 9 errors, 1 a duplicate usage of an id it seamed, my bad. Guess I quickly inserted something new there without thinking. The other 8 though are just the type of errors which come on jumping in by posting entries, blockquote and paragraph tags sometimes get switched around in the editor which is one of the things which causes errors and asides from that I also tend to forget filling in alt texts on images being another source for errors.

    The latter errors though is something which I just can’t be bothered with, it doesn’t affect anything for the user and the minor errors which pop in like this through editors shouldn’t truly affect search engines either.

  4. Great examples Slevi. It’s so easy to have little errors crop up that taking the time to fix them is most likely just wasting your time.

  5. It’s not that valid code will help your SEO efforts, but it means you are likely more competent to onsite SEO, including the proper structure of your site.

    I don’t believe in META tags btw ;)

  6. Excellent article. The use of valid code (XHTML and CSS) also makes your blog a little more accessible, or readable, to people who, for whatever reason, cannot use visual or desktop browsers, and use other other devices (such as text or braille browsers, and screen readers ie JAWS) to access the web.

  7. That’s true Connor. There is usually a correlation between standards-aware designers, and SEO-aware designers. The difference I meant was when web owners ask their designers for a standards compliant site, because they mistakenly believe it will boost their rankings. :(

    And lol – Why not? I know that the keywords tag is useless (I don’t have it either), and the description is little more than a description, but there are still some great uses of meta tags, e.g. The robots tag for search indexing, or the viewport tag for mobile devices. Meta has gotten a bad rep, but it can still be put to other good uses. :)

  8. John – Very true. Screen readers and the like can be very easily confused by poor coding. In cases like that, it’s not just about reaching more people, it’s simply the right thing to do.

    Great point. :)

  9. I don’t validate, and it doesn’t cause me any sleepless nights. The amount of third party code I use for content / plugins etc. it’s hard to monitor everything timewise.

    As long as my readers see what I want them to see, and the search engines are ranking for relevant keywords, that’s what I’m concerned about.

    Great read, Michael.

  10. Absolutely David. None of us are using only the core Wordpress (Or any other platform) package. We all install 3rd party plugins, and limiting ourselves to only the ones spitting out valid code would be pointless.

  11. Truden (22 comments)29 August 07

    I’m not that fussy about HTML valid code as long as it works in all browsers, but still, I have the FireFox plugin checking it whenever I visit my blogs.
    I found out that it is not that difficult to keep your code valid.
    That is probably valid statement for administrators that don’t use lots of plugins.
    BTHW, are you sure that you need that exact plugin which brakes your valid code?

    Any way, valid code is like beautiful wrapping paper.
    It is important what is inside :D

  12. That looks like a good plugin Truden, thanks for the link. I normally just use the validation options in the Web Developer toolbar (It’s useful because it can validate local HTML+CSS. I love that function).

  13. In my expirience good HTML does help in search engines rankings, it seems more so on Yahoo than on Google. As you say though, it is not a big issue. It is the kind of thing that might move you up a spot or two for a mild keyword.

    I have worked on one web site that was so bad that after a total re-build ranked 100s of places higer for a mild keyword. Althogh this could also have been attributed to other factors.

    Accesability has been important for me. A lot of people want a site built that is accessable, even though they have no idea what that is. If you can show them that tour site is accessable it is a big step to winning a contract. I recommend the Firefox validator to check you code.

  14. Hi David – As you say, it may well have been a factor. It is impossible to say whether or not a certain feature has an impact on the SEs, but something like code validation is one that I imagine has very little effect, if any. (Unless it was like you said, were the site was so badly coded, the content was inaccessible to the SEs).

    As an example, try validating a page at Google. Even the simple search page has dozens of errors (And simple errors at that, such as not having a doctype). If it was something they wanted to encourage, I think they’d put more work into their own site.

    On the other hand, Matt Cutts (Google spokesperson) recently held a poll asking which features people would like to see added to Google’s Webmaster Central, and one of the options is indeed a validation checker. I know quite a few SEOs whose interest was piqued at that! :)

  15. Michael, you stole the idea I had when I went to bed yesterday…I also planned to write such an article, just expanding it with the part about Accessibility which is discussed in the comments. I myself try to have my websites fully standards compliant and I also try to make the websites as accessible as possible.

    @3rd party plugins: As for Wordpress, you are able to “fix” the plugin so it does validate. Then again, sometimes it can be a pain to do so…

    well, and before I continue talking about accessibility, just read my article: “Web Standards and Accessibility Guidelines used in a Blog?:)

  16. Haven’t thought about checking this and you are all pretty over my head, but that’s good because that is how i learn. I have the web dev. tool bar so I’ll snoop around! Thanks!

  17. Marco – That’s one of the advantages of being able to read minds. ;)

    I’ll go read your article now. It would be nice to read a well developed view on the accessibility side of this.

  18. Mommy Zabs – Check out the “Tools” section of the toolbar and you’ll see what I mean. You might find it to be very useful in the end.

  19. Slevi (73 comments)29 August 07

    @John Lampard: Taking braille readers into account is nice, but if we take into mind that in a population of under the age of 65 just about 2 out of a 1000 people on average are blind in the western world, a number which goes even till about 10 times as low the more you reach towards the teenage/student audience; does it remain useful to still take braille readers in account?

    Personally I’d say no, unless you’d be creating a site which is dedicated especially towards the visually impaired or blind people of course but otherwise you’ll probably not even have more than a handful of blind people by accident come by your site.

  20. Michael – as long as you don’t try to use mind tricks on me… ;)

  21. Slevi – You make a good point, about certain sites (Like Amazon. If a blind person wants to order something, surely someone could do it for them?).

    But for pure content sites (like blogs), then it could well be a good thing to do. On a budget, I can understand it being hard to justify to senior management, but what about on personal sites? If you have the time, doing it is just the moral thing to do.

    Beethoven was a deaf composer, and one of the best ever. If he can pull that off, then surely programming blind is possible as well. :)

    Marco – I promise!

  22. When I cobble together a website from scratch I tend to concern myself with ensuring it validates strict, but with blogs because I use templates I never even bother to check it.

  23. Michael, I like your point about none of Google’s pages validating. I think the reason their pages are so horrible is that they want to keep running costs low. Just imageine how much money it saves Google not having a Doctype!

    I remember Matt Cutts saying that Google prefers the tag to the tag. I thought again this might be because it saves Google a little extra.

  24. OK, thats not come out right.

    Correction:

    I remember Matt Cutts saying that Google prefers x the I remember Matt Cutts saying that Google prefers the tag to the tag. I thought again this might be because it saves Google a little extra. tag to the <strong> tag. I thought again this might be because it saves Google a little extra.

    Also, another note to show that Google doesn’t care much for valid code is a friend’s site has absolutely awful HTML.Each page is bloated up to about 140kb of endless tabled shat, JavaScript and broken code and his site has been no. 1 for a competative keyword for years. He’s not even spent any money on SEO.

  25. A Blog About Nothing – There really are some poorly coded templates out there. I suppose it’s to be expected considering the number of them available. :(

    David – That’s a good point. I don’t think they’d have too much trouble with it though. Pumping out videos at Youtube and Google Video would go through countless terabytes of data. If a setup could run those 2 sites, it could probably run anything.

    With that said, no-one is going to deny the speed at which the Google search loads. :)

  26. David (The second comment :D ) – That’s a good example. There are a lot of sites like that in the index which just have to make you wonder how they got there…

    Ironically, SEOMOZ made a good post about that today.

  27. I got my css down from 22 to 5 :) I’m not sure about changing the last five though. But I love that tool! Very cool.

    On an unrelated not!! BIG CONGRATS on having a guest post on pro-blogger! WOOHOO! :)

  28. I knew you’d like it! It’s extremely handy when you’re designing a page, and trying to find bugs, or work out why something just isn’t working the way you expect it to. (Though I wouldn’t worry about those little errors either. They obviously aren’t causing any harm! :) )

    And thanks – It was dead good of Darren to let me! :D

  29. Jake (3 comments)30 August 07

    I like valid code but since I am not the best coder I often have mistakes. Your site does look fantastic.

    I would always put more time into content than code.

  30. Seems like Valid Code does affect a blog doesn’t it? I always thought of it as just a “cleaner” way for bots to surf around a site. Thanks for the tip.

  31. Dave S. (15 comments)30 August 07

    I see people commenting complaining that authors of plug-ins for content management systems don’t write valid markup and then saying, “it doesn’t matter”. It does matter if you want the highest probability that your website (or blog) will render the same in every browser. Web browsers try and add close tags where they are missing. They don’t always put them in the right place.

    Writing valid markup isn’t difficult either. The first step is to remove presentational tags. I still have some tags in my site’s template that I haven’t removed yet. The number of (x)html tags that haven’t been depreciated isn’t very high.

    If you markup doesn’t validate, don’t complain to browser vendors that sites don’t render properly in some, but do in others. Don’t write css hacks to try and fix browser bugs if you markup doesn’t validate. Why aren’t we demanding that plug-in authors at the very least write markup that will validate?

    In my opinion, it does matter if the markup validates so it’s compatible with future browsers that will have bug fixes in them. Does the word “maintenance” mean anything to you?

  32. Dave – I think the qualification on people saying it doesn’t matter (having already said validation is important) is if the page works. There are people who would say that it’s not important at all, but if something doesn’t work and you can’t see why I think the first port of call should be validation, rather than requesting help on forums etc. I would call your example of pages not rendering properly and browsers incorrectly closing tags an example of not working.

    I think that you’re right though, if people are releasing code to others who may not know how to write or fix code themselves (or even if they do) they should try to validate. Otherwise there can be unexplained page breakage (like I’ve had with the comments quicktags plugin).

  33. Dave – I agree with Kristarella’s response on why it doesn’t always matter.

    As for what you said about browsers: Valid code doesn’t display the same on all browsers anyway. This website is perfectly valid, but still has it’s fair share of IE hacks.

    And what guarantee do you have that future browsers will continue with web standards? The W3C are just one company. They’re well respected usually, but they aren’t without their failings.

    What’s to saw another group won’t publish a different standard, which browsers makers could follow?

    Jake & Sly – Thanks. :)

  34. Slevi (73 comments)30 August 07

    WCAG Samurai I wouldn’t really be placing any bets on, but WHATWG on the other hand which is founded by some people working at the Mozilla foundation, Apple and Opera because W3C would be moving forward to slow might be a better choice.

    Some things are actually already being implanted in in example Firefox 3.

    Asides from that they also have some nice form of humor going on there which somewhat indicates for us how it would be like if W3C remains to be followed, quoted from the whatwg faq:
    “It is estimated that HTML5 will reach a W3C recommendation in the year 2022 or later. This will be approximately 18-20 years of development, since beginning in mid-2004.”

  35. Slevi – Yep, WHATWG are another good example. They’re working on a different spec to the Samurai though, so they aren’t in competition with each other. :)

    And I suppose I could contradict my earlier self, with a point for the W3C, that there mightn’t be a crisis, and a slow speed isn’t all that bad.

    Personally, I’m not overly bothered by it all. The important thing for me is that all of the browsers follow the same standard, whichever that may be. Fragmenting the standards community into different communities would do more harm that good. :(

  36. Slevi (73 comments)30 August 07

    True on that, we’d end up writing more and more hacks all over the place. Although speeding up wouldn’t be too bad, especially on certain points of using in example templates which could output multiple data with lesser code and such, long lengthening tables could pretty much be reduced to nearly nothing.

    Being slow does have it’s benefits, but taking up the pace does so as well. Although I must say that W3C isn’t the only one which can be slow at points, browsers have quite their share of it as well. In example the longly awaited CSS3 border-image which would resolve a whole lot of workaround for many people is currently only supported by I believe Safari, nothing else. As for that matter seeing all of CSS3 being put through as a standard is probably going to take a long, long time as well if we take in mind that internet explorer has just been supporting CSS2 for not even a year.

    I completely understand that being too fast isn’t all that good since chances are high you bring forth some half shitty product in which half of it isn’t working the way it’s supposed to do, but being too slow isn’t the way to go either since definitely not everybody sticks to compliance for all browsers and the moment their browser picks up something new it’s a direct thing to start using for quite a lot of people, which would pretty much split up the internet yet again like we’ve seen in the past in mild forms already with IE6 and below barely displaying some pages or simply completely wrong and many webmaster’s only response being a download firefox or opera notice.

  37. You’re right that a slow speed isn’t much better than a fast one, but is there any other way to do it?

    The W3C are trying to perfect their spec, and taking their about it, as you said. But even then, people are complaining about the specs, and hence the other sites we mentioned earlier. This perfectionism slows things down even more.

    But then, isn’t that perfectionist touch needed, because once a browser implements something, that’s it. The W3C can’t just send out a patch a few months later. They need to get it right first time. :(

    And when they eventually do that, it’s the browser makers turn. The browser makers can hardly begin to implement a spec until it has been finished (Otherwise they’re wasting their time if it changes), and what’s more is that they will only implement it in their most recent versions. It takes a long, long time for the bulk of users to upgrade to recent browsers (IE6 being living proof. :( ), and the new techniques still don’t become widespread until they can be used by the majority.

    All in all, I think the widespread adoption of advanced CSS3 is still a good few years off. (With a bit of luck though, we might get some modules, like multiple boarders and images sooner!)

  38. Dave S. (15 comments)31 August 07

    Yes, there may be problems in the W3C. Here is another article by Molly Holzschlag giving her concerns about W3C and WaSP.

    And another one from Roger Johansson with his concerns about html5 and yet another one from him about why he left then came back to the W3C html5 working group.

    The point I’d like to make is, if enough influential people get p*ssed off and make some stink about it, maybe we will have some good standards to work with (some decade :) ). It’s some of these pioneers that brought us to the point where using CSS to separate presentation from content is feasible even with Internet Explorer. Even as recently as the late 90’s, I had to use table based design to build a website because CSS wasn’t supported properly by the browsers yet. Now it’s usable.

  39. That’s true, and if people do think that there is something wrong with the W3C, then they are completely right to voice their opinions.

    However, those same people can’t also complain about the W3C acting too slowly, when they are partly to blame.

    Personally, I’m happy to wait as long as it takes for a perfect specification to be produced. No rush for me. :)

  40. Ryan (7 comments)27 September 07

    This post crushed my dreams. haha. I really spent a lot of time making sure everything on my blogs validate. Ah well. I do see your point and I’ll probably keep doing it.

  41. lol Ryan. Standards based code and such are good things, but there does come a point when validating for the sake of validating is just wasting your own time. Knowing where to draw the line is the best skill to have. :)

  42. Jon (9 comments)4 November 07

    I found validating a real chore and time consuming when I first started doing it, but after a while it really helps you write valid code from the start. Of course I still get errors but not the 100’s a used to get on every page!

  43. Jon – Same here. It is a great aid in the long run, and particularly when you run into bugs on your page. :)

  44. Jon (9 comments)5 November 07

    True – forgetting to close that div can cause all types of nightmares!

  45. lol – Don’t remind me… xD

  46. Gavin (5 comments)10 April 08

    I like to validate my code. It might not be the best reason to validate, but i gives me a feeling of well being to see the ‘green’ validation confirmation, and to know i am doing things right. Just helps to get rid of those little silly errors and improves your markup skills

  47. Gavin,
    If you like doing it, and it makes you happier about the design, then it sounds like reason enough to me. :)

  48. Mikko (5 comments)21 April 08

    My blogs do have a valid code, and it feels great even though it’s just XHTML 1.0 Transitional. :D

  49. I always make sure that my code is valid and W3C Compliant, its annoying when you miss a div tag or you have an empty tag with something in it like flash and you don’t put anything in the tag and it gets rid of it when you clean up your site

  50. W3 Standards are the standards which should be followed. It is not as hard to follow these simple web standards it enhances the speed as well as the look of any web site.

    I generally make the sites and work to get the web standards.

  51. Just posted about this myself – reminding myself why standards are good – but it’s really annoying to find sites that flout all the rules, especially new ones that do well in the search engines – sometimes feel you’re wasting your time.

  52. Jutta (1 comments)22 May 09

    Sure that you write is not realy important.You got a lot misstakes in your css code.
    Time will show that valid Code sites/blogs get a better standing.

  53. Hi Sir Michael,

    I did this site http://www.ioacjci.org and it validates both xhtml and css, and also feeds. I agree when you said “i like the feeling that I have done something right”…Same as me, i love that feeling too, something that gives you a tap on the back and a little boost to yourself. Something that you should be proud of.

    Thanks for these insights.

Leave a Comment

Your reply will be added to the comment above (Below any other replies to this comment) -

(We DoFollow)

Not sure how to get an image with your comment?