Why I don’t like tables for layout?

Jay Mistry
Developer’s Life
Published in
2 min readAug 31, 2014

--

First of all, you may find it funny, but I found tables pretty hard to manage. And I feel it limits me somehow. The most irritating part is when I want to modify my first row of <th> and second row gets affected automatically. And honestly, I can’t do much there.

So Here’s why I don’t like <table> :

Less maintainable

It’s obvious, tables are less maintainable. Using tables for layout means that changing the corporate layout will need to change on each and every page. No CSS magic for layout oriented changes. (Sometimes, depends on change. ☺). These each page changes can be very expensive.

Anti-pattern

Many developers think that alternative of the table is many nested DIVs. Many nested DIVs are an anti-pattern just like table layouts. In fact, I believe good developers don’t need many of them. On the opposite site, deeply nested DIVs don’t have many of the problems of table layout.

Not at all simple

Many think that table improves the readability of the code. Some think, Most people understand HTML and little understand CSS. So HTML tables are more simpler.

“Most People” less matters than Professionals. For professionals, table layout creates more problem than HTML + CSS. (Yes same with me. ☺). This is like saying I should not use GVim because notepad is damn easy for most people.

Tables are slower

The layout algorithm for table is much harder. The browser often has to wait to load a whole table before it starts to layout the content. In addition, caching of the layout won’t work. CSS can be cached easily.

Don’t print well

Depending on which browsers you’re using, web pages using tabular data might not look good when you print them out. The best way to control this is to specify a print stylesheet.

Instead of using tables for layout, CSS will give you tons of flexibility and control over the layout of your page. It will make your web page fast and easy to modify in the future.

Of course, HTML tables were invented for a reason. Which is to display tabular data. As long as you use tables to display tabular data and don’t nest it inside another table, you’re using it correctly and as intended.

--

--

Jay Mistry
Developer’s Life

Entrepreneur. Designer. Amateur photographer. Always curious to know more about space, psychology and green global.