Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tables vs. Div Tags

Status
Not open for further replies.

conneticat

Programmer
Jul 16, 2004
47
US
Just curious what everyone else's opinions are on abandoning tables for web layouts in favor of div tags & CSS...

cat.gif
 
Tables are for tabular data.
Use css and divs for presentation. It makes for much cleaner layout and is also much easier to modify than table-based layout.


I haven't used a table for non-tabular data in 3 or 4 years.


Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
What other advantages are there for using Div/CSS, aside from being slightly faster (so they say)? Don't you lose your mind trying to revise something created by someone else (or something you created and fogot what you were up to when you did it)?

cat.gif
 
Don't you lose your mind trying to revise something created by someone else (or something you created and fogot what you were up to ...
Occasionally. If it doesn't have to look 'exactly' like it did before, it simply doesn't.[smile]

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
The only problem I have with using CSS over table tags is testing in different browsers and making "tweaks" to make it appear fine.

____________________________________
Just Imagine.
 
I agree with the last post.

Anyhow, ever since I discovered the beauty of CSS and how lovely it can be when it comes to dvi-ing things out, I've never gone back to tables.

=========================
Don't you lose your mind trying to revise something created by someone else (or something you created and forgot what you were up to ...
==============================

Maybe. When I build a site with many div tags I tend to start putting comments here and there. Even in my CSS sheet has comments. It's faster for me to find things, especially since I don't use DW anymore for web building. I find I remember things better when I build code from a clean notepad document.

So just to sum up:
1. Div load faster than tables
2. A left:28px position on a div may render differently across brothers. So the css styles constantly needs tweaking
2. Div can be placed anywhere on the page with CSS and the absolute positioning value.
3. Div html looks cleaner IMO

on the other hand
1. Div don't structure a large mass of data so nicely, that's the job of tables
2. CSS on div constantly needs tweaking across browsers. Especially when it comes to positioning. Many times I have to include the conditional statements for browser recognition.

Well i spoke too much.
 
along with GUJUm0deL on this...
Personally I hate to have to accomodate browsers and platforms and do conditional css and detections.
My vote is tables+css for main layout while divs for dynamics and interactivty (menues,eyecandy etc.)
....you can pretty much make any table 'look & feel' as div if the look is what concerns you.

On the other side divs offer more 'features & interactivty' but heavily depend on CSS and JS browser compatibility.

People that lease cars (div lovers) always want newest and the greatest....those who own cars(old table lovers)are happy with them no matter how old if well maintanied.
It also, IMO, depends on how you are used to looking in the design perspective....tables are more 'vertial-horizontal'oriented objects while layers are somewhat of a 'free-float-coordinate based'.
Utimatly your project should gear you towards one or the other...if you are making lets say a 'gallery of images and thumnails' then tables make the most sense...if you are making a site for 'DJ Flux' then interactivty and fun stuff to click & drag & animate would come from divs.

Either way, I found that if you go div route you are bound to run into a table or two...same goes for table based design,sooner or later you will use a div.....
ok...too much coffee today! :)
All the best!

:--------------------------------------:
fugitive.gif


All around in my home town,
They tryin' to track me down...
 
lebisol, lol, nice metaphor!

I agree, I use css+table. Some developers will insist that css+table is wrong, but I see it as being different.

You should use CSS for formatting (like font style, color, font weight, image placement, width, height, etc).

____________________________________
Just Imagine.
 
I look at it this way - do you want to walk 10 feet to get a dollar or walk a mile to get 1000 dollars? Using CSS may take longer but in the end you're going to have a much better product. There are countless posts on Tek-tips and tutorials on the web about this topic already - so I'd be beating a dead horse to rant about all the advantages of getting rid of table layouts.

It really boils down to whether or not you take any pride in your work. I'm sorry if I offend anybody here, but when I look at the source of a page and see tables used for layout I immediately think "unprofessional".

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
 
I'm sorry if I offend anybody here, but when I look at the source of a page and see tables used for layout I immediately think "unprofessional".

Well said, that man. Anyone who considers themselves a professional web developer and uses tables for layouts is very much misguided.

Even those starting out with HTML for the first time should avoid using tables for layout - if they learn to do so, it's harder to shake the habit. Putting a bit of extra effort in up front will save hours of grief & re-working later. It's also better for accessibility, and potentially SEO.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
From an SEO Standpoint.. CSS rules.

I can use positioning to make sure my main content is always the first thing that spiders see regardless of where it "actually is in the structure of things.

My site at went from obscure to number 1 out of more than 2 million results (for "smoking meat") in Google when I went to the trouble to implement CSS throughout the site.

Using tables with the same layout... I had menus, logos, and lots of other stuff before the content but using divs I was able to put all of the divs for the menus and such at the bottom of the content in the code and still have it appear at the top of the page.

IMHO, CSS just makes sense from that perspective;-)

Jeff
 
Good LORD...there are two million websites on SMOKING MEAT?

cat.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top