In my recent interaction with my project’s developer friends I felt many of us really don’t buy the idea why the heck the UI team is jumping up and down and so against table based layout !!!
Of course table based layout is:
- Easier to code
- Easier to understand
- User don’t really care it’s table or DIV… browsers anyway renders it
- What the big deal in accessibility thing … data grids will be table, how about that??? Why UI team don’t object that !!!
- UI team talks about grid … table is better grid option than DIV. Isn’t it logically ???
Ok the above quotation are not made up by me … I just overheard, heard, listened from the team.
I will try to explain our or the professional UI developers argument for using HTML+CSS than using table for lay-outing.
Not all are my words, I have picked quotes from different places around the web as well.
Argument 1:
Let’s look at the below code …
class car {
int wheels = 4;
string engine;
}
car mybike = new car();
mybike.wheels = 2;
mybike.engine = null;
I picked this example from an forum thread …
Is the code wrong ? Of course not … at least technically. But will you prefer this code … no because it is not meaningful.
It is not semantic.
HTML is all about semantics. Different HTML tags are there to define what kind of content it contains not how it should look.
e.g.:
- <P> for paragraph of text
- <table> should have meaningful data-grid type of content.
- <DIV> semantically acts as a container for different thing.
There is a long list but you get the point right!!!
Argument 2:
It is not very easy to linearize layout table.
Probably this w3c article will provide proper explanation to the curious.
Argument 3:
Table layout is more readable and easier to understand by most of the people – standard argument for table.
“Most people” don’t matter. Professionals matter. For professionals, table layouts create many more problems than HTML + CSS. This is like saying I shouldn’t use GVim or Emacs or Visual Studio because Notepad is simpler for most people. Or that I shouldn’t use LaTeX because MS Word is simpler for most people.
again I picked this answer from a forum thread and added my bit …
Argument 4:
Table rendering in browser is slow
This problem increase exponentially in case of nested table. Not because of more HTML tags but because:
- Table is rendered only when the full table is downloaded
- Rendering algorithm for table is much complex than DIV which increase the rendering time further.
Argument 5:
Separating content from layout and presentation.
Simply speaking when a developer develops page using table she must understand the layout of the whole page to make it render effectively.
Whereas when frontend engineer develops HTML page the focus is to put only the content in the HTML page and put all the layout and design login in CSS.
Result ….much cleaner HTML and lesser burden on developers to understand the structure.