A lot of web developers are strongly opinionated that divs should be used for design and tables for tabular data, but I am still not entirely convinced that website designers should jump on it yet. I haved designed web sites using both, and in my experience I have found that carefully using tables produces more cross browser compatible designs than using divs carefully. Does anybody have any strong evidence or convictions on either side of the fence for this argument?

Dani AI

Generated

This thread captured the classic debate well — but for anyone reading years later the practical answer has evolved: keep HTML semantic and use CSS layout tools instead of table-based page framing. Doing so improves maintainability, accessibility, and separates content from presentation (so markup means what it says). (w3.org)

For modern layouts use the right tool: Flexbox for one-dimensional flows (rows or columns) and CSS Grid when you need two-dimensional control. Those modules are designed for responsive, maintainable layouts and dramatically reduce the need for deeply nested wrappers. (developer.mozilla.org)

Browser support for Grid and Flexbox is broad today, so they’re safe to adopt for most projects — but plan fallbacks if you must support old or niche browsers. Use feature queries, progressive enhancement, and test across browsers early rather than relying on table hacks as a compatibility shortcut. (joshwcomeau.com)

There are two important exceptions worth calling out: (1) HTML email still commonly uses tables because many mail clients have very limited CSS support, so pragmatic table use remains standard there; and (2) if legacy pages must remain unchanged, follow accessibility guidance (avoid headers/captions on layout tables and use presentation roles) so assistive technologies can linearize content correctly. (litmus.com)

Practical checklist for migrating or starting a site: audit pages to find layout tables, swap outer structure to semantic elements, implement layout with Grid/Flexbox, remove unnecessary wrappers to avoid “divitis,” and validate with accessibility tools and multiple devices. The maintenance pain described and the “div overuse” caution from are both solved by semantic structure plus modern CSS; keep tables strictly for tabular data as recommended.

Recommended Answers

All 35 Replies

With divs, people can't steal your images if you use

style="background-image:url('/temp/img.jpg');"

unless they really want to

In my (about 5) websites, I find that divs load faster, but that's probably just my head. Tables for layouts are frowed upon by the most hard core "standards" people. I dunno, I started learning HTML with XHTML 1.0 Strict, and now I use 1.1, so I guess you could say I never did dabble in table layouts. Anyways... nuff babbling, I say divs :)

I also agree that divs load faster. People can steal your images either way ;) Table people can use table background="/temp/img.jpg" - In any case, I still say divs. The DaniWeb header, footer, and nearly all of the homepage are all div tags. Anyone find it not cross-browser compatible? Personally I feel that I can do more nifty things with div/css than I could do with tables to make it MORE cross-browser compatible ;)

im a tables man myself, i feel i can design just as good with them as i can with div's, but i dont do div's that much so i dunno. i think ill give div's a go and make a better educated desicion later. OFF TO CODE SOME MORE!!!!

Thank you for posting this topic. I am curious as well. I have always used tables and grew very fond of them as I can do just about anything I want with them and their contents. Though, since I have been studying a bit about CSS the past few days I'm seeing a wider versatility with the CSS, and possibly divs. Though, as yet, I haven't tried using either one. So, I'm still on the fence about things.

tables for tabular data,
luv javascript tablesort routines view data any which way
but I use css to style the table,
and use tables for tables not for layout of anything else

Thank you. That helped even better to understand the usage of tables/css. :)

tables for tabular data,
luv javascript tablesort routines view data any which way
but I use css to style the table,
and use tables for tables not for layout of anything else

I'm all for divs. Tables should only be used for tabular data (as has been said many times above). I find divs A LOT more flexible that tables, and also a lot easier to look at in the code side of things.

I work for a place that creates and maintains about 100 or so sites, and when I have to make any structural changes to the older (tabled) sites, its a nightmare. Half the time I can't see when something begins and when it ends. I don't think it helps either that many of them were created in Dreamweaver (shutters).

Member Avatar for Member #120589

DIVs are OK in theory, but I think they can be overdone. Hundreds of nested divs (or divitis), to me is almost as bad as using tables. I like to see sensible markup that isn't linked to presentation. Very often divs are used unnecessarily, e.g. for navigation, you'll sometimes see a <div id="nav">...</div>, when often all you need is something like a <ul id="nav">...</ul>. THat's just my opinion though.

YEAH DIVS!!!! they are the best thing since sliced bread! the only time i use tables is when i'm busy with a client reporting project (once again, that is only for the stats, but the whole site is basically divs). Divs give you that extra that you don't get from tables. Besides that, crawlers finds it easier to read div tags than tables (or so i read).

To find the edge, use divs!

Thank you Laura for your input. I've seen divs and tables. Though I am used to tables, since 1999, and I am going to be trying my hand at the divs and css side of things.

I do use dreamweaver but am in code mode all the time so I keep an eye on the coding. The main reason I use it is for the ease of the visual parts when I haven't uploaded it to the sites yet. I also learn from using it as well. How to code other things such as form items.

I am believing everyone about the newest way to do things with coding using the divs and css. Now I just need to learn how to implement them into web pages. :) Learning one step at a time. :)

I'm all for divs. Tables should only be used for tabular data (as has been said many times above). I find divs A LOT more flexible that tables, and also a lot easier to look at in the code side of things.

I work for a place that creates and maintains about 100 or so sites, and when I have to make any structural changes to the older (tabled) sites, its a nightmare. Half the time I can't see when something begins and when it ends. I don't think it helps either that many of them were created in Dreamweaver (shutters).

That's an interesting idea, Ardav. hmmm

DIVs are OK in theory, but I think they can be overdone. Hundreds of nested divs (or divitis), to me is almost as bad as using tables. I like to see sensible markup that isn't linked to presentation. Very often divs are used unnecessarily, e.g. for navigation, you'll sometimes see a <div id="nav">...</div>, when often all you need is something like a <ul id="nav">...</ul>. THat's just my opinion though.

LOL that is my feelings about tables!

But, I am here to learn more than just tables, and it's alternatives, and basic HTML.

So, all ideas and experiences are more than welcome to come across my screen. I do read ALL of them and check out ALL links posted.

YEAH DIVS!!!! they are the best thing since sliced bread! the only time i use tables is when i'm busy with a client reporting project (once again, that is only for the stats, but the whole site is basically divs). Divs give you that extra that you don't get from tables. Besides that, crawlers finds it easier to read div tags than tables (or so i read).

To find the edge, use divs!

Member Avatar for Member #120589

Just so I'm not misunderstood - divs ARE the way to go IF they are needed. Tables should definitely NOT be used for layout. IMO, anyone still using tables for general layout should be shot.

Gr8 information from all of you its my dr8ful thanx

Ok, you may shoot me now then. LOL

Just so I'm not misunderstood - divs ARE the way to go IF they are needed. Tables should definitely NOT be used for layout. IMO, anyone still using tables for general layout should be shot.

check out w3c and go through a couple tutorials if you're getting started with div/css.

It won't take much time and overall div are much better than tables. Imagine if your site is 1000 pages, trying to change individual table elements would drive you crazy. Of course there's lots of other reasons to use div but don't overdo it and make everything div.

Divs for laying out page elements, tables for data and form element positioning.

My advice is to use divs for layout, unless they refuse to work. One place they refuse to work is when a table is inside a div.

One trick to making a div behave is to set its display attribute to "table cell." Then it keeps other objects from intruding on its borders.

Always use tables for tabular data.

yes the main advantage is that div loads quickly but i agree tables are better then div.

Thanks

virtual base

I too prefer divs they make things so easy

I've got to say I'm a fan of divs rather than tables.

My advice is to use divs for layout, unless they refuse to work. One place they refuse to work is when a table is inside a div.

One trick to making a div behave is to set its display attribute to "table cell." Then it keeps other objects from intruding on its borders.

Always use tables for tabular data.

I was taught (and what I do) is the "proper" way of doing things, according to the W3C, at least, is to use divs for layout and tables for tabular data. However, if that's what one is supposed to do, then how come a div can have its display CSS attribute set to 'table cell' if it's not meant for tabular data?

you can use a motorcyle to deliver a houseload of bricks, two or three at a time,
a truck delivers the bricks, they arrive less damaged, faster, and use less fuel to do it.

can <> should
possible <> best
<table>s and <div>s have their strengths, it is difficult to have sortable divs, POC to have sortable tables

Hi,

Valuable tips are shared here.This will help the web designing beginners.
One of the good advantage of DIVS is that they are secure to use. They responses quickly. Thanks for sharing this post.

Thanks.

commented: divs are secure ? What ? -1

I have to admit I did "cheat" once and use a table to align items instead of floating divs because Internet Explorer hates float. While tables do work... I still think its more of the "idiot" method because it means people can just use tables with html and not even touch css. Tables are for people who know nothing about web development.

old stuff. better dont bump it ,,... div is now used by most web developer and all of smart web developer :)

I have to admit I did "cheat" once and use a table to align items instead of floating divs because Internet Explorer hates float. While tables do work... I still think its more of the "idiot" method because it means people can just use tables with html and not even touch css. Tables are for people who know nothing about web development.

that was exactly the same problem i've faced when i used div for the first time. but then i've got a solution by using clearing element (<br class="clearing" /> which has a clear: both) until now.

clear is your friend :)

I use <div style="clear:both"></div> a LOT.

clear is your friend :)

I use <div style="clear:both"></div> a LOT.

<br class="clearing" /> is simpler anyway :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.