17 replies [Last post]
beerOclock
Offline
Regular
Last seen: 11 years 27 weeks ago
Timezone: GMT-4
Joined: 2009-02-13
Posts: 11
Points: 8

Ok I realize this is probably one of the most asked questions but I'm having such problems getting divs to do what I want, that I have to ask again:

WHY is everyone jumping on the divs-for-layout bandwagon and insisting that I jump on as well? The simple fact is I can get tables to do what I want, while divs are problematic and inconsistant across browsers.

Everyone says use tables for tabular data ONLY. Use divs for layout. I dont care if the CSS gods want me to use divs, the plain and simple fact is that tables work much better and get the job done. Maybe somewhere down the road divs will be improved, and I'll gladly switch over. But right now today tables are better.

The reasons for using divs seem very flakey to me. "Because divs are meant for layout and tables are not." Well so what? I dont care what was meant for what, the fact remains tables work better!

Does anyone else feel the same? Or am I just about to get schooled?

Deuce
Deuce's picture
Offline
Guru
Somewhere, USA
Last seen: 4 years 10 weeks ago
Somewhere, USA
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4424
Points: 1843

There is plenty of

There is plenty of information out there as to WHY you should do it the correct way, but I look at it like this. What you just said makes this think of statements like...

What do I need to change my oil every 3,000 miles for? My car runs just fine with the oil I have.

What do you mean I should brush my teeth every day? My teeth look fine.

It's a lot easier to use this lead based paint to paint my child's crib, what's all this who-ha about lead being bad?

and the list can go on...
Basically, it comes down to. You're wrong. You might have a "preference" but it's still wrong.

DIVs aren't buggy, your CSS is buggy.

http://www.smashingmagazine.com/2009/04/08/from-table-hell-to-div-hell/

all » http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 31 weeks 2 days ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

beerOclock wrote:Ok

beerOclock wrote:

Ok
Everyone says use tables for tabular data ONLY. Use divs for layout.

No they don't. Using exclusively DIVS for layout is just as out of date as using tables for layout. The latest approach is to use semantic html to mark up meaning, and CSS to define presentation, including layout.

If you think it's "tables vs. divs" you are caught in a false dichotomy.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

beerOclock
Offline
Regular
Last seen: 11 years 27 weeks ago
Timezone: GMT-4
Joined: 2009-02-13
Posts: 11
Points: 8

Deuce wrote:There is plenty

Deuce wrote:

There is plenty of information out there as to WHY you should do it the correct way, but I look at it like this. What you just said makes this think of statements like...

What do I need to change my oil every 3,000 miles for? My car runs just fine with the oil I have.

What do you mean I should brush my teeth every day? My teeth look fine.

It's a lot easier to use this lead based paint to paint my child's crib, what's all this who-ha about lead being bad?

and the list can go on...
Basically, it comes down to. You're wrong. You might have a "preference" but it's still wrong.

DIVs aren't buggy, your CSS is buggy.

http://www.smashingmagazine.com/2009/04/08/from-table-hell-to-div-hell/

This is exactly the kind of blind, brainwashed "we must use DIVs because we must use DIVs" nonsense I was talking about.

Your analogies dont make sense and dont apply to the topic at hand. Are you saying that if I use tables for layout, that my website will start off looking fine but will slowly disintegrate over time? Or are you saying if a baby licks my website, he will develop brain damage? It would be better if you gave some concrete facts and not abstract riddles.

Basically all you've said was that I am wrong. Thats not much of an explanation. There are some things that tables can do, which DIVs cannot. Being a guru, you probably know even more examples of this than I do. I am trying to accomplish a layout that apparently DIVs cannot do. Ive spent many hours googling and experimenting trying to get the DIVs to cooperate and finally Im ready to stop fooling myself and just use a table because I know I can get it done in 5 minutes. I did give DIVs a fair chance but it seems they are simply not ready yet.

Ive already read the article you provided, and many others too. The problem is, when you actually TRY those examples from the article, the result looks nothing like what they say it does. In fact Ive tried the examples in 3 different browsers and got 3 different results, none of which looked like the article claims.

Furthermore when you start seeing browser specific custom CSS code, thats a good sign to stay away from something.

Personally, given the choice between using
a)something that works now, but may not work later
or
b)something that doesnt work well now, but will work much better later

I think I have to chose a) and then switch to b) when necessary.

Sorry if I was rude but I'm kind of frustrated right now. Everyone worships DIVs like a religion but I have yet to hear a good reason...

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 31 weeks 2 days ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

beerOclock wrote: Basically

beerOclock wrote:

Basically all you've said was that I am wrong.

Well the subject's been pretty well done to death. Yours is about the ten thousandth thread with the same basic thrust. Your question has been answered a thousand or so times, and the reasons for not using tables for layout are all over the web. Try doing a little research.

Quote:

Personally, given the choice between using
a)something that works now, but may not work later
or
b)something that doesnt work well now, but will work much better later

I think I have to chose a) and then switch to b) when necessary.

Or as I pointed out above, try (c), the one that actually works best.

Quote:

Sorry if I was rude but I'm kind of frustrated right now. Everyone worships DIVs like a religion but I have yet to hear a good reason...

Look around this forum and you will see dozens of posts from the "gurus" around here complaining about and advising against "divitis", which is seen as just as bad as tables for layout.

You are still suffering from the hallucination that the debate is about tables vs. divs. It isn't. On this forum the experienced web designers don't "worship divs" any more than they worship tables.

You are beating a straw man that was already dead ten years ago.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

Ashton_Sanders
Ashton_Sanders's picture
Offline
newbie
Montana
Last seen: 12 years 18 weeks ago
Montana
Timezone: GMT-6
Joined: 2009-05-24
Posts: 2
Points: 0

Hey man, There's many

Hey man,

There's many reasons to not use tables: extraneous code, browsers need to read the table an extra time to figure out the table structure (adding a small lag), etc. Tables are supposed to be used for tabular data. If you need something to look like an excel spreadsheet, use a table. (There's ways to make Divs act like a table, which is even more code and plain ridiculous.)

If you use a table for layout, but it validates and works in all browsers... great. Sure it's not the "best practice," but I don't brush my teeth every day like I should... As long as my breath doesn't annoy anyone, and my teeth stay healthy (which they do)... who's complaining.

You make some good points. CSS has some very odd quirks in the different browsers. But, that doesn't mean CSS never works; it just makes the CSS learning curve a little longer (as if it wasn't a 2 hour learning curve to begin with). Just like anything, the more you do it the better you get, and when you get good at CSS, so many more possibilities open up in your design.

Enjoy,

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 29 weeks 4 days ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

It appears that you've run

It appears that you've run into a wall that just won't give it up for you. Instead of making general statements that seem to be troll bait more than anything substantive (look again at this site's name), simply describe what you're trying to do, where you've run up against it, and show us what you've done so far.

BTW, the issue is not table vs div; it's about non-semantic, poorly structured documents vs the separation of semantic structure and presentation.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 6 years 49 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

beerOclock wrote:The simple

beerOclock wrote:

The simple fact is I can get tables to do what I want, while divs are problematic and inconsistant across browsers.

Do whatever works for you then. The rest of us will do the same.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

Deuce
Deuce's picture
Offline
Guru
Somewhere, USA
Last seen: 4 years 10 weeks ago
Somewhere, USA
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4424
Points: 1843

Tyssen wrote:Do whatever

Tyssen wrote:

Do whatever works for you then. The rest of us will do the same.

Couldn't have said it better. :thumbsup:

all » http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

Stomme poes
Stomme poes's picture
Offline
Elder
Netherlands
Last seen: 9 years 47 weeks ago
Netherlands
Timezone: GMT+2
Joined: 2008-02-04
Posts: 1854
Points: 378

I still like the "build your

I still like the "build your house out of spoons if it works for you" analogy.

I'm no expert, but I fake one on teh Internets

ljbailey
ljbailey's picture
Offline
Enthusiast
Scotland
Last seen: 10 years 45 weeks ago
Scotland
Joined: 2009-01-10
Posts: 224
Points: 59

Tables suck

In response to your tables do what I ant divs don't, I say: tables suck, CSS rocks.

There is not anything you can do with tables that you cannot do using CSS attached to the proper elements, it just takes longer to learn. Did you read the table-hell vs div-hell article, it is not a tutorial but it makes a lot of sense.

I have come onto this forum when I have run into problems with getting CSS to do what i wanted, and have learned a lot in the process.

Why not post your problems and let the experts help you, instead of slagging off the technology simply because you cannot grasp properly how to use it.

when it comes to tables vs css, tables are monkey coding and CSS is surgeon coding; it's more precise and a lot harder to learn, but well worth it in the end results.

Liam Bailey is director of Galloway Web Services, a Stranraer web design company, sister of SEO copywriting services company Write About Property.

Stomme poes
Stomme poes's picture
Offline
Elder
Netherlands
Last seen: 9 years 47 weeks ago
Netherlands
Timezone: GMT+2
Joined: 2008-02-04
Posts: 1854
Points: 378

hey now, to be fair the OP

hey now, to be fair the OP has done that in other threads (asked questions) and there is a valid point in there:

Many newer web developers take a religious stance on "tables suck, divs rule" and you're a better developer if you know why (several reasons why) to use div/html in place of tables for layout.
There is indeed a lot of dogma, and dogma is not a convincing argument against tables for layout to someone who is used to using tables (and knows plenty of tricks around many of the common arguments against tables, like the "they take longer to load".. a competent table-designer knows how to get around those).

That smashing mag encourages using lists in forms "so that it can tell a screen reader how many questions there are". Bleh. Bad argument against tables in forms-- you could build everything in lists too. That is, I think, the best argument against layout tables. You can build a house out of spoons, you can make a web page out of nothing but divs, or nothing but lists, or nothing but tables. But that's not the right material. And if HTML has any semantics to offer, they should be used. I don't eat with a house. This doesn't mean I can't use some other non-standard things to build a house-- I can build one out of tires, dirt and concrete just fine (great insulation!) and we can do some pretty strange things with HTML and even have a good reason for it (or a wacky one) but in general the whole "build with the right tool" and "don't use a screwdriver as a hammer" arguments I like best.

I'm no expert, but I fake one on teh Internets

ljbailey
ljbailey's picture
Offline
Enthusiast
Scotland
Last seen: 10 years 45 weeks ago
Scotland
Joined: 2009-01-10
Posts: 224
Points: 59

Yes, you are right. But I

Yes, you are right. But I did not say it was divs vs tables, did I?

It also works a lot better I have found if you use put your styles around the right element, for example, before I learned that, I would use span tags as my headers for sidebar colums, but couldn't set the width. Now I use a p tag, which gives me a space between each column and alows me to set the width so my top and bottom borders on the header title are the right width for the side column.

But you can't argue with what i said about the fact that you can do everything with html and css that you can with tables and a whole lot more.

Liam Bailey is director of Galloway Web Services, a Stranraer web design company, sister of SEO copywriting services company Write About Property.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 29 weeks 4 days ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

ljbailey wrote:It also works

ljbailey wrote:

It also works a lot better I have found if you use put your styles around the right element, for example, before I learned that, I would use span tags as my headers for sidebar colums, but couldn't set the width. Now I use a p tag, which gives me a space between each column and alows me to set the width so my top and bottom borders on the header title are the right width for the side column

Is there some compelling reason you don't use heading tags at the appropriate level for your headings? Wink

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

ljbailey
ljbailey's picture
Offline
Enthusiast
Scotland
Last seen: 10 years 45 weeks ago
Scotland
Joined: 2009-01-10
Posts: 224
Points: 59

I do use heading tags, 1

I do use heading tags, 1 through 5 as much as possible, but I try to keep them on keywords, the headings for my sidebar columns are not keywords.

Liam Bailey is director of Galloway Web Services, a Stranraer web design company, sister of SEO copywriting services company Write About Property.

Stomme poes
Stomme poes's picture
Offline
Elder
Netherlands
Last seen: 9 years 47 weeks ago
Netherlands
Timezone: GMT+2
Joined: 2008-02-04
Posts: 1854
Points: 378

Quote:But you can't argue

Quote:

But you can't argue with what i said about the fact that you can do everything with html and css that you can with tables and a whole lot more.

No, not really (*edit, I'm saying no, I can't argue with that fact : ) ie, agreeing with you). The only things I can think of are all the vertical-aligning stuff that also can be done with CSS, but a bit more painfully (because of display: table not being universally accepted yet)... I have seen people wrap an entire page in a single table with a single td simply to get an effect that, yes, with more code, could be done with CSS.

But reading the OP's post, I read an argument against anti-table dogma in there as well as the other arguments, which have been debated elsewhere of course. A guy posted a "tables rock" blog thing where he argued for tables... and it riled a lot of people but again I read his argument as basically saying "dogma sucks" (the guy uses CSS himself of course).

Quote:

but I try to keep them on keywords, the headings for my sidebar columns are not keywords.

The question is, "are they headers"? If they are headers then they are headers. I even sometimes have headers (hidden in CSS, mostly for screen readers) stating "Main Site Menu" or some such. It's heading the main site navigation, as opposed to the many other lists I might have on that page. And google will see it-- tough. If it thinks that means my page is about "main site navigation" then it's a terrible search engine. As such, I don't worry about it-- I worry about the right tag for my content period.

Plus headers let screen reader and other users jump around the page easier-- jumping by headers is nice and pretty easy, if the author used headers appropriately. Once I added a header that was a little redundant simply because it was over a sidebar, and this was partially for navigation reason (someone could jump to the head of that sidebar while also getting confirmation that yes, this is what the sidebar is about).

I'm no expert, but I fake one on teh Internets

ljbailey
ljbailey's picture
Offline
Enthusiast
Scotland
Last seen: 10 years 45 weeks ago
Scotland
Joined: 2009-01-10
Posts: 224
Points: 59

Fair point

Fair point I suppose. Each to their own indeed. I am currently working on a redesign and reworking where I use h tags. Your thoughts will be on board during this process.

Liam Bailey is director of Galloway Web Services, a Stranraer web design company, sister of SEO copywriting services company Write About Property.

Stomme poes
Stomme poes's picture
Offline
Elder
Netherlands
Last seen: 9 years 47 weeks ago
Netherlands
Timezone: GMT+2
Joined: 2008-02-04
Posts: 1854
Points: 378

Hm, to keep it most honest,

Hm, to keep it most honest, it's not my idea (the hidden header if a page is filled with many lists). I swiped it from Mike Cherim...*edit link: http://green-beast.com/blog/?p=237

(also mentions some reasons NOT to do such a thing as well)

I'm no expert, but I fake one on teh Internets