So you think you know HTML and CSS?

My general survey of the web is that most sites are a mishmash of HTML 3.2, 4, XHTML, CSS, and junk that could most be charitably called “text with angle brackets”. As the manager of the JavaScript team at a certain large internet retailer, I’ve found that poorly written HTML is the number one thing delaying the delivery of Web 2.0, AJAX, DHTML, or just plain better web experiences.

The reason is fairly simple. As soon as a browser encounters broken code it starts to make guesses about what you meant. Different browsers make different guesses. All the browsers are trying to turn your stream of text into a neat tree of elements with suitable decorations that represents the structures defined in the text stream. The JavaScript makes the page appear to be dynamic by manipulating the structure of these trees (called Document Object Model or DOM trees).

When the DOM is malformed, the JavaScript gets confused and the fancy AJAX features stop working. In extreme cases browsers have been known to crash when JavaScript has tried to manipulate a malformed DOM.

The answer is to make your HTML and CSS standards compliant and properly structured. Unfortunately, this is hard for a lot of reasons, not the least of which is that most of the web browsers don’t complain about bad HTML or offer any tools to help you find problems.

Which is why I wrote The Central Scrutinizer. This program will give you a summary of different kinds of errors on your web page from most severe to least. Clicking on an error group will take you to the errors and clicking on an error will show you where it is in your HTML or CSS.

If you find problems with the results, please use the comment form on the Scrutinizer or leave me a comment here. I hope you find it useful.

Leave a Reply

You must be logged in to post a comment.