Top 5 Tips for Readable Code

As an expert in CSS and XHTML, I am sometimes irked by having to work with or modify sites that have been coded in years past by developers other than myself.  More often than not, they do not adhere to the acceptable web standards that make editing others code much easier.  There are a few simple things you can do to make your XHTML much more digestible, and even more search engine friendly!

5.) Avoid Unnecessary Whitespace

Your XHTML should not contain any blank lines.  They increase file size, create more junk  for spiders to sift through, and can cause serious headaches for developers.  Avoid spaces at the end of your lines as well.

4.) Use proper indentation (nesting)

Using proper nesting can make a huge difference in your code’s organization, and can even make the coding process easier.

3.) Comment your code

Commenting your code might seem unnecessary, as to you, it is most likely self-explanatory.  The aim of code readability, however, is for your code to be easy to navigate for other people.  Be sure to create short comments in your code that indicate function.  You may wish to leave these out in the production version of your code, as they do increase file size.

2.) Always use proper casing

In XHTML, all tags should be lowercase.  In CSS, there is no declared casing syntax, but a naming convention should be followed consistently.  I prefer to use camel case.  A class name, for example, might be .sampleClass.

1.) Separate presentation from content

Your XHTML documents should be very small!  If you can avoid using an extra tag in your XHTML document, please do.  Use CSS and Javascript to their full potentials, and always use external scripting and styles.  This is extremely important for search engine optimization.

Leave a Reply

Captcha * Time limit is exhausted. Please reload CAPTCHA.