(919) 404-9327 sales@lizardwebs.net
HTML Code Layout - Indent it!

HTML Code Layout - Indent it! AND close your tags!

Regardless of what speed optimization experts tell you!

Speed optimization is a great thing, but by leaving out closing tags on the TABLE elements and NOT indenting, you are making the readability of the code diminish. Most of us realistically are NOT getting thousands of hits per day where speed optimization like this is really needed. You will also lose a lot of troubleshooting cues. “Where IS that new table starting and why isn’t it rendering properly?” I personally prefer to keep my elements indented properly, use the closing tags in line, and do everything I possibly can to keep my code highly readable and followable.

When you revisit your HTML code after a few months to update something, you will understand why. When you have to spend several minutes trying to find a particular insertion point in a table cell and you’re faced with hundreds of lines of non-indented code that have been all run together to “optimize” the code, you will ask yourself if this was such a wise decision.

I can look at my code in most circumstances and visually spot where I want to do my insertion or changes within a few seconds – certainly less than several minutes. Perhaps it is a trait carried over from general programming that got me in thsi habit, but this one thing, even though it may take a few extra seconds initially, saves me a LOT of time in the long run.

With almost 50% of users currently on some sort of broadband, the extra whitespace and closing tags that you use will not have much effect on download speed. If you’re reading this, then your site is probably not Amazon or something similar. If your site is feeding thousands of hits per day, then perhaps the bandwidth savings is worth the loss of readability. In normal circumstances, you’re better off leaving some whitespace and proper indentation where it will be most useful – to you the coder!