Top Five Sources of Errors in Code

valid XHTMLBad code within your site and stylesheet slows your page load time and hurts your search engine optimization.  Taking the time to make sure your site has valid CSS and XHTML is worthwhile.  Your stylesheet with its CSS defines placement of content.  The XHTML defines content.  While use of the older standard of HTML is still widespread, using the updated XHTML makes it easier to edit your site.  It is also search engine friendly, a goal for any webmaster.

Validator sites allow you to test your code.  Unfortunately, site error information can be vague and hard to decipher.  Here are some common sources of errors so you get back to the paint and brushes.

1.  Bad design


When searching for a theme for your blog or a template for your website, be sure and select packages with valid CSS and valid XHTML.  A search engine search will bring up plenty of sites, with both free and pay options available.  Having a good foundation will save you headaches down the road.

2.  Image height and width


Images make a blog or website. Images can also break a blog or website with bad code. To make pages load quicker, add height and weight attributes if the upload of the image didn't do that automatically.  Remember to check banner and ad code to see that these attributes are specified.  If you don't know the height and width, right click on an image and view its properties.

3.  Missing alt attributes on images


While not widely used before, alt attributes give a short description of the image to make your site accessible.  If for some reason your image didn't display, the alt text would be shown instead.  Valid XHTML requires its use.  Alt attributes are also an opportunity to use keywords.

4.  Paragraph styling


Familiarizing yourself with new conventions for paragraph styling like centering text will save you time in the end.  To add additional attributes to a paragraph, you can add the <style="[your attributes]">.  Older code may show a paragraph style in a format such as <p align="center">, triggering an error if you try to validate the code. Instead, substitute this code to center text:  <p style="text-align: center;">

5.  Improperly closed tags


New standards look for tags to be closed.  When you begin a new paragraph, your code will show <p> followed by your content.  When that paragraph ends, it must be closed with </p> which simply follows the end of your text.  Another new standard involves a hard return.  The HTML is <br>.  The new XHTML standard also looks for the closed tag, written as <br />.

Unfortunately, there are numerous additional sources of error.  To be sure, it's a learning experience.  I constantly strive to learn more.  XHTML code is succinct though.  Once you familiarize yourself with the most common conventions, you can create error-free code.  Photo by OmirOnia