Jump to content

[SOLVED] General page layout, tables vs divs


markjoe

Recommended Posts

I have seen randomly on the web people saying "never use tables for layout!".

Trouble is they never seem to go into any reasoning. I have pages with a table-like layout with tables and some with divs. Either seem to work fine.

(actually I find that sometimes using tables is quicker and easier, mostly report-type pages)

Question is, does anybody know any actual reason(s) to not use tables for basic layout?

Keep in mind that when I use tables, it is plain table, tr, td elements with CSS (not using the deprecated attributes).

Link to comment
Share on other sites

Heres a short read from the w3c (the group that sets the web standards) http://www.w3.org/2002/03/csslayout-howto

 

If you look at the definition of what a table is from the w3c, it is to layout tabular data.  A website layout is not tabular data.  A chart showing a list of peoples name, age, phone, etc. IS tabular data.  If you layout a website using a table, you are not following web standards and many companies want (obviously) to follow standards because it is a reflection of the company.

Link to comment
Share on other sites

The real problem with a table based layout is that the order in which your content is provided to a screen reader, search crawler, etc. is different than with a pure CSS layout using divs. You know that you can float, and use absolute positioning with CSS and divs, and this is a good thing because you can put your real content at the top of your document (even if it appears lower on screen).

 

Take a look at my website with all style turned off, or with images turned off, or both. The content that exists behind the style and images is what makes the page what it is.

Link to comment
Share on other sites

Thanks for the info. I guess in most cases I am using tables and divs correctly then, other than that one index page I don't want to re-do.

I do sometimes have a tendancy to fall back on tables rather quickly when I have I don't get the results I want in CSS right away (hangs head in shame).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.