Apr192007
The Tortoise & the Hare: Tables vs CSS for Layout
Goog Feed, CSS, General, Design
Comments (8)
First of all let me begin by saying, I am in love with CSS! For those of you who don't know, CSS is used to control the style and format of a web page. From one CSS file you can control the font attributes, layout attributes, table standards, etc... for an entire site, all in one spot! But I digress...
The reason for this post is to show the speed of CSS-based-layouts over table-based-layouts. Why should one go with CSS design when developing a website/web application? See below...
- Less Accessible
- Harder to maintain visual consistiency
- Increased file sizes which eats bandwidth
- Much slower than CSS
- Accessability
- Flexibility
- Functionality
- Lower Hosting Costs
- Efficient, Less Expensive Redesigns
- Better Search Engine Optimization (SEO) results
- Speed
Speed Test
But, for the moment let's focus on the overwhelming speed difference between the two. I created a sample web layout in Photoshop, and gave the file to a co-worker of mine (Doug Boude) who laid the design out with tables. I also took the file and laid it out with CSS, it took us both about 15-20 mins to lay it out in our given formats.
All of our images were the same size for this test and his HTML file was actually smaller than mine! I then uploaded the files to my server, which can be viewed here (CSS Layout and Table Layout) and ran them through a Web Page Analyzer at websiteoptimization.com, the results were amazing!
Results
The CSS-based layout was 33% FASTER than the table-based layout on a T1 connection, and 59% FASTER on a 56K connection.
The CSS-based layout had no "cautions" or "warnings". The table-based layout had a "Total Size Caution" and a "Image Size Warning" even though we used the same image sizes and same amount of images. The total size of the CSS-based page load was 14007 bytes while the table-based page load was 37593 bytes, a 62% DIFFERENCE!
Final Thoughts
Now, don't get me wrong, I like tables, I think they are very useful, but only in their proper place. They were designed for data display and I still use them for that myself if I have tabular data for instance that I need to display. But, for layout and design of a website / web application, there is no question that CSS is the way to go for many different reasons.
So, my final question to you is this... If someone came to you and said "I can make your website run 33% faster", what would you say???
*Speed results will vary depending on site content/layout. Not all results will be 33% faster, some will be less and some will be more.





