CSS vs Tables

The other day, my husband and I had an argument over CSS and Table based layouts for web pages. His point was that tables are more easier to predict and give a structure to the website where as with CSS it is rather difficult to achieve this. I think it is true to some extent. I used to design websites with tables before I learnt CSS. Now, I don’t think I would ever go back to table layouts entirely.  Here are some reasons why CSS based layouts are better.

File Size:

The file size with CSS based layouts is smaller which helps in faster loading of the site. Table based layouts have a lot more tags that result in a larger file size.  It has been found that CSS based layouts usually load 2-4 times faster than table based layouts.  It also takes up less bandwidth. Some hosting providers charge based on the amount of bandwidth used. So, using CSS layouts helps lower those costs especially if it is a large site. Patrick Burt has some good suggestions to reduce file sizes with CSS.

Cheaper and faster redesign:

In CSS based design, the content of the website is separated from its visual appearance. External style sheets

contain all the styling information. Modifying the information here changes the properties across the entire website. So redesigns are faster and cheaper.

With table based design, the content and the visual appearances are mixed together. So, changing it takes a lot more effort and is error prone.

SEO:

CSS based designs help with Search Engine Optimization. Since the file size is smaller, it is easier for search engines to crawl through the site. In a CSS based layout, the information is organized better than a table layout which also makes the spiders find the important content. More information regarding CSS and SEO can be found here.

Room for more creativity:

CSS makes it easy to code very complex designs. Achieving the same level of complexity with the tables requires a lot of nested tables which increase the file size. It also  has less room for improvement or any changes in the future. CSS based designs are fluid and have more room for creativity.

More accessibility:

Since the flow of information is better in CSS based designs, it is easier to make the pages accessible for the disabled by using screen readers and other devices.

Skill in Demand:

The reason I pushed myself to learn CSS is because, everybody  wants to hire a designer who can create table less layouts. That is pretty much the norm now. So, if learning CSS was going to get me more projects and clients, I thought why not?

CSS does have some drawbacks too . It has browser compatibility issues. Some styling properties need to be modified for the specific browser. Adding simple hacks in the style sheet  makes the pages cross browser compatible. There are number of CSS hacks available on the internet. You can see some of the simple CSS hacks I have collected from many forums and websites.

Even though I love using CSS, I still use tables for any data that needs to be presented in a tabular form. That’s all I use them for. Before learning CSS, I thought tables were the best and I was reluctant to learn the CSS styling properties. It took me time and a lot of effort (since I was doing it on my own) to learn CSS but it was definitely worth it.

Some interesting and useful information about CSS layouts and techniques:

http://www.smashingmagazine.com/2009/04/08/from-table-hell-to-div-hell/

http://www.smashingmagazine.com/2010/02/18/50-css-and-javascript-techniques-for-layouts-forms-and-visual-effects/