Log in

View Full Version : Table or div?


pbishnu
Apr 21, 2008, 04:07 AM
Hi all,
I am always using tables to align text and images in web pages. I thing div can also be used for the same purpose. Which is a better options to use? Should I move to div from using table?
Thank you

Northwind_Dagas
Apr 21, 2008, 12:14 PM
Div, like span, is used to apply formatting to text between the tags. Unlike span, div has line breaks after each section. Also, you will not be able to accomplish the same structure with div that you can do with tables.

teddy0bear
Nov 9, 2008, 11:20 PM
Div tags! Or more importantly CSS. I've used tables a lot in the past but I am finding now that if you are serious about getting a job in the field they require that you know how to style a page with css and div tags. I used to only use css for text but now with div tags you can control everything. It is also great if you have to make a change to the web page. Instead of changing all 15 pages of your site when you have to make a change you just make a quick change to your master css page and your done!

And that extra line break with the div codes, combined with css you won't see it anymore.

crigby
Nov 23, 2008, 01:02 PM
Hi,
I agree with the second answer. Div's are more accessible and do a far better job of formatting. This is from one who was a dyed-in-the-wool user of embedded tables from the days of HTML 2.0. I could give one of my addresses to show before and after, but let me give you the site of the best example I have seen of Div's:
internet.com - the Internet and IT Network from Jupitermedia Corp. (http://internet.com)
Peace,
Clarke

Artem
Jan 14, 2009, 01:01 PM
Div, like span, is used to apply formatting to text between the tags. Unlike span, div has line breaks after each section. Also, you will not be able to accomplish the same structure with div that you can do with tables.


UUR.. Wrong. Div's can do the same as tables, even more.
But we can't say which is the better way, since even in Dreamweaver the Table button is also set under the 'Layout'-tab.

I see it like this: Div + Css = lay-out
Table: arranging inside div content

Zurvan
Jan 31, 2009, 08:33 AM
Tables are there to present tabular data, not to layout your screen. They were used that way because there was no alternative. Now that CSS is available - and pretty well standardized across browsers - there's no reason to use tables to layout your screen. Besides that, think of how difficult it is to add a piece of information to the middle of your screen with tables, compared to a CSS layout - a far more common operation than a complete redesign (which is also easier with CSS).

If you want to know why, go to a website laid out with tables and turn on your screen reader. Then do the same thing with a well-designed page of CSS. Besides the accessibility issues, tables use far more markup, which creates (much) larger files that need to be downloaded, costing you bandwidth and slower loading times.

To see some of the magic of CSS, check out css Zen Garden: The Beauty in CSS Design (http://www.csszengarden.com). It will blow you away.

WebsiteSolution
Feb 5, 2009, 05:40 AM
I don't think there is one definte answer. DIV is great, tables are great. I must admit that sometimes it is easier and faster to use a table than to get my DIV to work properly. Why not try using both and then you can make the decision as to which is easier and most comfortable for you.
CSS is wonderful!