Thursday, March 16, 2006

Old School Table Bloat

I'm old school. I still use tables. I admit it, but every once in awhile, the bloat gets out of control. Take the navigation on a new site I'm designing. There is a navigation strip on the right side with links to all the sections of the site. Alltogether there are 120 of them. Each link used to be in a table. I replaced it with divs and some CSS.

This is what it looked like before:

<div class="tbgs" onclick='_g("http://www.lawyerseek.com/Practice/Pharmaceutical-Injury-C1/Vioxx-P57/");'><b class="tbgsb"> | </b><a href="http://www.lawyerseek.com/Practice/Pharmaceutical-Injury-C1/Vioxx-P57/" class="jbx" title="Information regarding Vioxx litigation"><b>Vioxx</b></a></div>


This is what it looked like afterwards:

<div class="tbgs" onclick='_g("/Practice/Pharmaceutical-Injury-C1/Vioxx-P57/");'><b class="tbgsb"> | </b><a href="/Practice/Pharmaceutical-Injury-C1/Vioxx-P57/" class="jbx" title="Information regarding Vioxx litigation"><b>Vioxx>/b></a></div>


That doesn't look like much until you iterate 130 times in a navigation bar. To remove the "http://www.lawyerseek.com" from every link also saved about 6k and reduced load time.

Interestingly enough, this is the same principle I use when programming. When programming, I always look at the loops. If your PHP is iterating 130 times, you may also want to remove tabs and spaces in the ?> Moral of the story: Tables are bloaty, but one can achieve most of the benefits by replacing tables where they're the most troublesome.

In terms of marketing, load times can actually have a real effect. People looking for a lawyer might just like the site better when it takes fewer seconds to load.

0 Comments:

Post a Comment

<< Home