Tuesday, March 24, 2009

DIVs vs TABLES

Lots of WEB-UI developers are thinking of replacing all the tables with DIVs which in my opinion is not right, they are using DIVs even if they want to render a table saying that it is better in performance.

But the right thing is: use div when you need it and use tables when you need it.
Using DIVs with CSS can make a lot of things that can’t be done by TABLEs, for example it you want to display data in rows and each row or some rows will not be aligned with the others and using TABLEs will make complicated TDs with a lot of COLSPANs, but displaying a form data can be done with TABLEs perfectly.

But it is preferred to use DIVs if you want to work with the page layouts, as you will be able to change the layout just by using the CSS.

1 comment:

ahussam said...

You are 100% correct Osama, the problem is people do not understand correctly that DIVs are intended for page layouts and tables should still be used for tabular data, that is content that needs to be displayed in a table format...

the problem with tables is that is was sometimes complicated when it comes to complex design layouts...and it needed lots of calcualtions from the browser side to display... check my blog at http://ahussam.wordpress.com/2009/01/15/crash-guide-in-tableless-development-basics/ for further details

How to Install and Use RTSP Simple Server

  How to Install and Use RTSP Simple Server   1.   Create a folder to store the app mkdir /etc/rtsp-server cd /etc/rtsp-server   2.  Downloa...