
I have admitted to not being a "stickler" when it comes to validation and strict coding methods. And considering that CSS2 has been around since 2001 and I'm just getting around to writing an article about validating the code, speaks volumes on my past feelings on the topic. But things are changing on the internet and I believe now that validation is the only way to go. Why do I believe this? There are a number of reasons and I've put this feature article together to help you web builders out there make up your own minds on the subject.
Firstly, from my point of view, if your XHTML contains invalid code, or you have used syntax in your CSS which is not right, then you have a much greater chance that your style sheet based web pages won't work. What do I mean by that? The way you code your web pages affects the way they, your web pages, are perceived and displayed in web browsers. And, not everyone in the world uses Internet Explorer. There are people who visit your website who use stricter browsers and if your code is incorrect then your website could appear "broken" to those visitors. We, as web builders, should validate because it is the only way we can ensure the code won't fail as the syntax develops. We can't be sure that a Microsoft-unique expression in our code now won't jumble something down the road, because its not in a form recognized by the standard W3C code. Perhaps the only way to ensure your website doesn't appear broken in future browser versions is to make sure your code uses only the existing syntax and the existing rules. So thats reason number one.
To assist us in doing this the W3C (World Wide Web Consortium) propose that all websites be built using their standards for XHTML 1.0 and CSS. They offer a validation service on their website to assist web builders in gaining error free (validated) websites. Make no mistake, validation takes some getting used to, but stick with it and soon the process becomes second nature.
I can almost hear all you web builders out there groaning and saying "Why Bother?". There is a simple answer and I'll just rephrase reason number one again ... The W3C write the code we use, they are defining the standards code that browsers will use and eventually all browsers will be created to read code that is set to their standards. If you don't keep up to date your existing website may not work in new releases of your favourite browser. Those Microsoft-unique expressions aren't "standard" and will be deprecated as new versions of browsers are released.
The validation argument is rife in cyber space, there are very mixed opinions on the subject. I've expressed my opinion and in point form here are some other reasons to look at validation:
| • | Your code will work cross-browser, cross-platform and offer future-compatibility. |
| • | Your website will be more search engine friendly. Why? When a search engine encounters an error on a web page it deals with it in the same way a browser would. The search engine will make the decision on how to deal with the text and if that text contains your key words and it decides to just ignore the text then you risk the chance of not being indexed by the search engine. |
| • | Simply, errors on your website will reflect badly on your professionalism and your skills as a web builder. Not only that, valid pages load faster and are smaller in size. |
| • | By validating your code, you will have a flatter learning curve when enabling the new technologies such as XML, SMIL, and newer versions of XHTML. In other words less work, more control, faster sites. |
There are those who argue that the level of nit-picking needed to achieve validation is unnecessary and offer some logical reasons for this:
| • | Validation doesn't mean you don't have to test your website in multiple browsers. Just because the code is correct doesn't mean it will display the way you intend it to. This is a logical argument but I don't know one web builder who doesn't do cross-browser testing regardless of validation. It is second nature to cross-browser test, as writing code to lay out your content exactly right the first time is a hard task. |
| • | Some web builders have loads of websites and the thought of having to validate all those old sites is daunting to say the least. The argument appears to be that the time would be better spent building new websites. |
| • | Errors on the web page are only unprofessional if the user notices them. Most users won't check your source code to see if you have used correct CSS and XHTML 1.0 code, they are only concerned with how the page looks to them in their browser. Fair enough but there will be those who see a broken page. |
To validate your CSS code visit this URL at the W3C website and key in the address of the page you wish to validate. You can also validate pages that are located on the hard disk of your computer without having to upload them to the internet. When you hit the "check" button the validator will produce a page either containing errors found within the web page or will give you a "Success" message and present you with a little graphic to put on your web page. As I mentioned in last month's article about XHTML validation, this little graphic is like a Scout "merit badge", you feel left out if everyone has one but you.
To validate or not to validate that is indeed the question. I'll leave you to make up your own mind on the subject. But before you go click on my "merit badge" and see if this page validates for CSS with the W3C.
For people wishing to learn CSS visit the W3 Schools website and work your way through the free lessons there. It is a great resource and possibly the best "teach-yourself" website for CSS on the internet.