Welcome to WebmasterWorld Guest from 54.226.62.26

Forum Moderators: not2easy

Message Too Old, No Replies

CSS- Divs and Tables

Are Tables The Devil?

     

digitalghost

8:32 pm on Dec 10, 2002 (gmt 0)

WebmasterWorld Senior Member digitalghost is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I prefer that sites utilizing CSS for the layout stay away from tables unless tabular data needs to be presented. I really loathe the idea of slapping a table into a div.

However, we have a designer that insists tables have their place and there's nothing wrong with using a table as part of the layout, or using a table inside a div even if there's is no tabular data to be presented. Is he right? Don't really know what to make of him, he once told us that NN4.7x made up 25% of the surfing population. (that was only a few months ago, logs indicated only about 2%)

It just seems odd to me to take the time to create a CSS layout that uses divs, then slap a table into one of those divs. If the sole reason for doing that is to support some ancient browser I'd rather just drop support for the old browser.

I don't want to get into the NN4.7x debates. I just want to know if there is really a good reason for using other than for presenting tabular data.

Nick_W

8:38 pm on Dec 10, 2002 (gmt 0)

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I'm sorry to say that that sounds awfully like an excuse for sloppy coding to me. (of course I don't have the details so....)

There are lots of reasons to use tables, mostly down to browser support and user stats (high nn4 useage etc) but if we're not talking tabular data and you're not tooooo.... woried about nn4 then there's no reason really why you should have to compromise. Not in general terms anyway, each situation is different of course...

Nick

pageoneresults

8:41 pm on Dec 10, 2002 (gmt 0)

WebmasterWorld Senior Member pageoneresults is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I just want to know if there is really a good reason for using other than for presenting tabular data.

Not that I can think of. I utilize divs as much as possible. I then use tables when it comes to tabular data because I haven't quite nailed down the process of replicating that tabular data in divs.

I typically use tables where forms are involved. One of my goals for the new year is to nail down the div equivalents to using tables.

Nick_W

8:47 pm on Dec 10, 2002 (gmt 0)

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member



nailed down the process of replicating that tabular data in divs.

I wouldn't even tty pageoneresults, that's what tables were designed for. Right tool for the job ;)

I typically use tables where forms are involved

That is tricky isn't it? -- I don't do it but then I've not really had to do a very complex form yet with CSS so....

But for simple contact/order forms it's not to hard. It just takes a slightly different approach.

I suspect many CSS problems come from trying to replicate what you're used to with tables. Turn it on it's head and go at it with fresh eyes (yeah, easy to say right? ;)) and you'll find it comes together a lot quicker...

Nick

Longhaired Genius

8:51 pm on Dec 10, 2002 (gmt 0)

10+ Year Member



Tables and divs are both "springy" but in different ways; eg divs take the whole screen laterally by default and tables shrink-to-fit laterally by default. So I think it's possible that a table might be a effort-saving solution in some particular notional layout.

As long as you're not using nested tables for margins etc. I wouldn't worry. When the code starts getting convoluted and ugly, alarms should sound.

pageoneresults

8:57 pm on Dec 10, 2002 (gmt 0)

WebmasterWorld Senior Member pageoneresults is a WebmasterWorld Top Contributor of All Time 10+ Year Member



As long as you're not using nested tables for margins etc.

Good point LG! I try to stay away from nesting as much as possible. When you are dealing with column headings and multiple cells, you cannot get away from at least one nesting, sometimes two.

I've experimented a couple of times with trying to replace those tables with divs and just failed miserably. Mostly because I'm still not fully versed in the use of divs and their equivalent attributes to replicate a tabular structure.

Hey Nick, how about some simple examples of let's say, a two column table, or even a three column table that houses text in column one (field names aligned right), fields in column two (fields aligned left) and then more text in column three (text aligned left).

Nick_W

9:15 pm on Dec 10, 2002 (gmt 0)

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member



It can be done I'm sure, but that's tabular data right? -- Right tool for the job? - A table! ;)

Nick

digitalghost

4:04 am on Dec 11, 2002 (gmt 0)

WebmasterWorld Senior Member digitalghost is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Thanks for the response guys. I understand that sometimes replicating an existing site that uses tables with CSS and divs can be difficult. In this case however, it was a redesign with an entirely new structure. I just didn't see the need to clutter up the design with nasssty old tables when the idea was to clean up the code and present the important code to the spiders as quickly as possible on the page.

None of the data was tabular and I felt like this was just a designer that wanted to do things quickly rather than correctly.

SuzyUK

7:27 am on Dec 11, 2002 (gmt 0)

WebmasterWorld Senior Member suzyuk is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I typically use tables where forms are involved

I just did some of this and I used <fieldset>, <legend> and <label>...then with CSS It made for an easily styled form

Only heard about the <fieldest> tag recently (from Nick I think :)) and it was the first time I've used it, and it was quite easy to make a nice looking form.

I also have one link on same site that leads to a description of codes used in the site I was just about to start a 3 column CSS layout when I realised it was tabular data...so it's in a table! much easier

Suzy

Nick_W

7:30 am on Dec 11, 2002 (gmt 0)

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Here's the discussion on Good Looking Forms with CSS [webmasterworld.com]

Nick

ancarett

3:40 am on Dec 16, 2002 (gmt 0)

10+ Year Member



I'm green as grass when it comes to CSS, but I'm having a rotten time trying to do a columnar layout using only CSS div commands. I can do a rotten job using float: left and float: right but the two columns don't seem to run in parallel.

Of course, I can do this in a table without even thinking, but I know that people can do it in CSS and it's maddening me that I haven't figured it out yet. Time to go into work and dig out the book with CSS examples, I guess. . . .

 

Featured Threads

Hot Threads This Week

Hot Threads This Month