Webmaster Resources Center

Welcome to the Bravenet Resource Center. Use these resources to help make your web pages more advanced and fun to use.

Articles & Tutorials

Valid Code and Code Validation

by Steve Dougan


Summary : Creating your pages on the Net can be exiting and fun. Webmasters spend much of there time in the design aspects of the website and seem to ignore the most fundamental component of a good website; the code itself. It is widely estimated that 99% of web pages on the Net have some coding errors. This suggests that most webmasters really don't understand the importance of valid code.

So what is all the fuss, you say? You view your website in your browser and it looks fine therefore the code must be fine. In reality that is not always the case. There are a wide variety of versions and brands of web browsers accessing the Net. Some are more forgiving of errors than others.

What you see in your browser may look completely different in another browser. In some cases, entire tables and all its content can be missing over a simple error such as a HTML element that wasn't closed.

Creating your pages on the Net can be exiting and fun. Webmasters spend much of there time in the design aspects of the website and seem to ignore the most fundamental component of a good website; the code itself. It is widely estimated that 99% of web pages on the Net have some coding errors. This suggests that most webmasters really don't understand the importance of valid code.

Code that is used in the creating of a web page and then checked against accepted formal standards and passes is considered valid code. The most commonly accepted recommended standards are those suggested and provided by the W3C (World Wide Web consortium).

It is really not that difficult to write code that is valid to the recommended standards. Below are some of the key points to look out for:

  1. Start with the right doctype (http://www.w3.org/TR/REC-html40/struct/global.html)
  2. All HTML elements that you open, you must close
  3. Make full use of alt tags on images
  4. Make use of character sets (http://www.w3.org/MarkUp/html-spec/html-spec_13.html)
  5. Use HTML validators regularly
  6. If you find errors, fix them immediately

Here are validators that are free to use and provided by the W3C. It is always advisable to run your webpage through these validators to ensure your code will be compliant with the universally accepted recommended standards.

w3c code validator- http://validator.w3.org/

w3c css validator - http://jigsaw.w3.org/css-validator/

Problems that occur as a result of bad code include difficulty for assistive technologies. Browsers such as readers for the visually impaired, have considerable difficulty reading bad code. Search engines hate bad code. A great amount of your website's content can be hidden from the engines and therefore not spidered if you have bad or missing code attributes.

The human visitors of your website, bad code can result in very slow loading of your pages. Slow loading pages have been attributed as one of the main reasons people that arrive at a web site, but don't stay very long.

The bottom line is that the more time you spend designing your website and then testing it for valid code, the better your overall long term presentation will be. You will give yourself a better chance of being spidered properly by the search engines, and the more accessible your site for everyone that visits.