954,086 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Tables?! Don't be a div.

For some reason, it's fasionable to abort tables even if a good situation exists for their usage. When did this happen? I like tables, and I don't think they should be overlooked.

Most of the time, I create my pages with a huge table holding everything together. Sure, I could fight with DIVs and the annoying difference in their representation on different browsers, but I'd rather not. I'd rather use a big table, and I know my table will appear (almost) the same everywhere, when I do (almost) anything to it.

The reason I say this, is the number of sites I find in my google bounces, advocating DIVs as the way to lay out a site. Sure. If you want to make static pages containing information, they provide a way of some interesting effects, but it's certainly amusing that most of the biggest advocates of whom I've read code have nested their DIVs in a way that would be frankly un-interperatable if they ever want to make a change in something. At least with tables you don't need to practically print out your CSS to be able to read your HTML.

I use DIVs, where it's appropriate, and I use TABLEs, when I know I need tabular layout; and I don't mean restricted row-cell datasheets, but whole pages where I know the top banner should be this big, the sidebanner should be this big, and the middle should be this big. Sometimes, I nest my tables. ;)

Each to his own I suppose, but I don't like this ganging-up on an element, based on the way it is supposed to be used. This is exactly what happened to FRAMEs, and look where they ended up. FRAMEs worked for a purpose, and nothing actually does what a frame does, except rewriting the entire concept, and calling it something else. Fair enough, it's a limited purpose, but now, those who regard themselves as "web-savvy and modern" would (apparently rightfully) scream if they saw one.

I like the idea of the diversity of the Web. I don't like the idea of (widely spoken) rules about how things should or shouldn't be done. I appreciate accessibility standards, but not style standards, or even the idea of "the standard usage of a website".

In conclusion.. whatever. :lol:

MattEvans
Veteran Poster
Moderator
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
 

I'm afraid I have to disagree with you. I am one of those ultra CSS advocates. The freedom of keeping style and content entirely separate entities! To be able to change the whole look and design by just changing the CSS. Plus it makes for better crawlability by search engines, and you can't fight that :)

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

I think table's have a use. Ifyou want to quickly put up data and have it displayed properly in the least amout of time, i would go with a table.

Creating a table format in CSS is no easy task.

As dani said CSS has it's benefits. Ease of design changes and better for crawlability.

+ / -

kub365
Junior Poster in Training
89 posts since Nov 2003
Reputation Points: 11
Solved Threads: 1
 

Oh c'mon, CSS is easy :) The two column layout here on DaniWeb is pure CSS, and never had a browser compatibility problem.

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

Change your username from CSCGal to CSSGal

kub365
Junior Poster in Training
89 posts since Nov 2003
Reputation Points: 11
Solved Threads: 1
 

haha :)

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

You can't keep style and content separate with JUST CSS. The order of elements is always important to a degree. If you have to change just ONE tag in HTML, you fail to keep the two separate :P

I find editing HTML/script to edit layout and CSS to edit the style of the layout more intuitive. Infact, I generate my HTML from XML, and there needs to be a defined way of things appearing in the right place. DIVs -but- only if their in table cells for me :P

Because of that (XML source), my new site won't even be interperable by search engines O_o

Check out the beta though; I'll admit, the style is lacking:

http://www.fusiongroupuk.com/fuse/data/index.xml

(username: guest/matt, password: password/password)

XSLT forever!

MattEvans
Veteran Poster
Moderator
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
 

Ah, but that's the point of absolute positioning with CSS :) You can reposition elements on the page, change their order, etc, without touching the XHTML. Hence the power of CSS :)

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

Aah but with that, things stick all over the place (how do you measure relativity to text?), and it doesn't pertain to consistency on every screen at every size (think handheld devices), and it leaves CSS files as huge lists of where's thats, which is surely what HTML is (or maybe was) for. I'm optimising my site's underlying structure to be easily editable by people other than me, (don't know how well that's gonna work) but I'd still rather keep my tables, and I'd still rather keep my CSS to a list of colors and (maybe) some floats.

Maybe, I'll change my mind by the time I've finished, but it hasn't happened yet, and I maintain, tables do what they should, and shouldn't be automatically dismissed.

Still, good design Dani. Did you build everything we see here? I like the style or I probably wouldn't be here.

Matt

MattEvans
Veteran Poster
Moderator
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
 

I'm gonna have to agree with the author and say tables is generally the way to go. DIVs cause more problems than its worth. With tables, I have a nice layout that views the same across every browser. With DIVs, I could spend an hour and have a different effect in every browser. Not necessarily a problem with the DIV tag, I know its all the browser incompatibilities, but until all the companys can agree on standards (and actually adhear to them) I'll stick with tables.

Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51
 

1. Pick the proper doctype. This forces the browser to adhere to a document standard, rather than rely on its own interpretation/model.

2. Arrange your page into logical blocks of content. The best way to do this is with DIVs and Paragraphs. Why force things into a "tabular" structure if there is nothing tabular about your content?

3. CSS

This approach minimizes browser inconsistencies and greatly eases the maintenance of the site. It also greatly increases the flexibility of your site layout should you choose to have several different "skins", for example.

I think the key here is that you absolutely have to give your pages a "doctype". It's critical.

tgreer
Made Her Cry
Team Colleague
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
 

I think that a large part of it has to do with how comfortable someone feels programming. For example, I feel very comfortable with making two-column layouts in CSS, and so for me it takes no longer than doing it with tables.

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

I agree that a large part of it has to do with how comfortable someone feels programming as quoted bu cscgal plus situation. If you want to make and work it out fast a new small web page table is a quicker approach, since you donot have to check it out with every browser. what i rhink is both table and css have their own place and if used appropriately it is surely going to give you desired result.

vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
 

one thing that i always revert to tables for is central vertical alignment.. why is vertical-align:center; not recognised in div{} css when using transitional and strict html? :|

what i was trying to say, originally, is that there isn't some line in-the-sand between tables and divs. tables can be affected with CSS too y'know :|

EDIT: that should be vertical-align:middle; but hey, neither work.

MattEvans
Veteran Poster
Moderator
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
 

I disagree with most of this but I agree that tables still hold a place in web. Tables were not intended to display the design of the website but to display tabular information as one might expect. So the original intention was to have them display spreadsheet type information and then people found out if I stuck a bunch of images instead of text in there I could make a pretty website. However I believe that CSS is a lot more flexible and allows a website to be more configurable.

mikeandike22
Nearly a Posting Virtuoso
1,496 posts since May 2004
Reputation Points: 33
Solved Threads: 19
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: