View Full Version : Best option between div and table

05-18-2013, 04:44 PM
Which is the best option between div and table for a webpage layout? I am feeling confusion to use it. Please reply me.

05-18-2013, 04:58 PM
If you Google something like "table vs div layouts" you'll find many answers, but the basics are listed below;

CSS layouts use less markup: All styling and formatting can be removed from a web page and stored in an external CSS file, which leads to smaller page sizes. Additionally, eliminating tables also means eliminating those extra markup tags - table, tbody, th, tr and td are simply replaced with one div, thus reducing the page size yet again!

CSS layouts load faster: An external stylesheet can be cached by a web browser, meaning that it is downloaded once and then stored in reserve to use on the next page. Used in conjunction with divs, CSS leads to speedy and progressive page views. Tables, on the otherhand, need to download in full before a web browser can display the contents, so on slower internet connections, there is a significant delay before anything pops onto the screen.

CSS offers more design potential: CSS design isn't restricted in the same way that rigid, grid-based table layouts are. Why limit your design to something that looks at home in an Excel spreasheet? Open yourself to a world of creativity!

CSS layouts are easier to update: Changing the look of your website is easier and faster with CSS. Since CSS can be stored in one, site-wide file, it's easier to locate elements that need updating and that change instantly filters down to every page of your website. If you've used a table-based layout, you'll need to update every page of your website to deploy a global change.

CSS saves you money (and earns you money): Smaller page sizes means less bandwidth consumption (saves on web-hosting fees). It also means more page views; Visitors don't get impatient and leave they browse more they buy more!

CSS increases your search engine visibility: Smaller pages with simpler, less-bloated markup, are easier for web-spiders to index so they zip around your website and give good marks for clear content separation, etc. Consider all those extra visitor-clicks too and your page rank gets another well-deserved boost!

CSS can give you the edge in the job market: If you show a prospective employer that you can use CSS effectively, it proves that you can offer clients modern design solutions that will in turn give them the market edge. Employer looks good. Developer looks good. Client looks good. Everyone's happy!

So, keep tables for statistical data, and use CSS for your web design. And if your really must use tables somewhere in your web layout, try to keep them to an absolute minimum - no tables inside tables, inside tables, like a stack of Russian dolls - nested tables can get ugly and are horrible to troubleshoot if things go wrong.

05-18-2013, 05:35 PM
Thanks a lot but I have completed my html course now, I think with css tutorial I will be more clear about the topics. Am I right?

05-18-2013, 06:57 PM
Only if you learn the material. Then yes.

Since this has been answered, I'm closing this thread because this question is a bit too general in the first place. If you need help with your page, please open a new thread and provide us with the code or, better yet, a link to the problem page.