Web Design Forums

Welcome! Please register or log in: Forgot your password? Why register?
You are here: Web Design Forums » Web Design Help » HTML and CSS Help » div instead of table RSS

div instead of table

This thread was started by MaryJo and has been viewed 669 times, and contains 11 replies, with the last reply made by Curtster.
Post Reply
1
View MaryJo's reputation
Posted June 13 '09 at 11:39 AM
      Posts: 36
My instructor started out teaching us how to create a page with tables. As I understand it that is the old way of doing it. Are div's used to set up the page instead of tables? As I understand it you should only use a table unless you are going to have tabular data. Is that correct?

Thanks

Advertisement Register for free to hide these ads and participate in discussions!

2
794 points at 99% Donor Moderator Repute WDFplus Member
Posted June 13 '09 at 03:41 PM
      Posts: 11,793
Not only is it an "old" way of doing it, it's the wrong way. However, using just a bunch of div tags is also not necessarily correct. You should use the correct tag for the job, and if one won't do but you still need one, use <div> for a block item or <span> for something inline.

For example, if you have a list of items that comprise a sidebar, you shouldn't use a table nor a div for it. Instead, a <ul> makes sense because you're representing an unordered list, which is the purpose of the <ul> tag. Tables should only be used for tabular data.

I can't believe anybody would still teach table-based designs. They were wrong but effectively necessary about 7 or 8 years ago. Now they're wrong and there are limitless ways of acheiving the same result without using tables.
filburt1, Web Design Forums.net founder
Want to advertise on this site?
Site of the Month contest: submit your site or vote for the winner!

3
9 points at 100%
Posted June 13 '09 at 06:38 PM
      Posts: 45
Sometimes tables are necessary (although admittedly rarely) if you want to present tabular data like in excel but on a webpage. This isn't needed very often and I have never used tables as div are so much more useful with the use of CSS as well; they are what should be used as a standard these days.
Ali Hitch
Collossal Pixel - Web Design
http://www.collossalpixel.com

4
794 points at 99% Donor Moderator Repute WDFplus Member
Posted June 13 '09 at 11:43 PM
      Posts: 11,793
Using tables to represent tabular data is just fine. In fact what you just said is the metaphor I most often use: if it would naturally work in Excel, then it's probably tabular data and HTML tables are the correct thing. Otherwise, they're not.
filburt1, Web Design Forums.net founder
Want to advertise on this site?
Site of the Month contest: submit your site or vote for the winner!

5
View MaryJo's reputation
Posted June 15 '09 at 12:40 PM
      Posts: 36
Thanks everyone for clarifying what to use when.

6
View stanneon's reputation
Posted June 18 '09 at 06:52 AM
      Posts: 8
That's right, table is for tabular data only. But that was way way back, now you could almost do anything using DIV including displaying tabular data...

7
2 points at 100%
Posted June 23 '09 at 10:18 AM
      Posts: 30
Tables are used for data. Div's are used for layouts. Plus it's much easier for google to navigate your site if you use divs and SEO goes much smoother.

8
794 points at 99% Donor Moderator Repute WDFplus Member
Posted June 23 '09 at 10:33 AM
      Posts: 11,793
Tables are used for data. Div's are used for layouts. Plus it's much easier for google to navigate your site if you use divs and SEO goes much smoother.
Tables are used for data, but divs are not used for layout. A <div> tag means a division, or a logical group of content on a page. No tag in XHTML should be used for its layout behavior. The entire point of semantic HTML is not to use divs but to use the right tag to describe the data. 90% of the time it won't be a div, but a p, ul, ol, etc.
filburt1, Web Design Forums.net founder
Want to advertise on this site?
Site of the Month contest: submit your site or vote for the winner!

9
2 points at 100%
Posted June 23 '09 at 10:44 AM
      Posts: 30
Yes you will use those tags as well, however you still need div's within most layouts.

10
44 points at 77%
Dorky, Freelance Home page   Private message  
Posted June 23 '09 at 01:09 PM
      Posts: 790
it didnt think it was an either or situation. i have seen the video put out by google on seo, and they said some very dif thing then any of what i see i this thread.
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein

11
View nitin's reputation
nitin, WDF Noob Private message  
Posted July 3 '09 at 02:22 AM
      Posts: 14
using div in table would be very useful for the navigation.

12
View Curtster's reputation
Posted July 3 '09 at 02:40 AM
      Posts: 15
css is definitely the best way to do a layout. I still use tables in my pages often though personally, for when I just want to easily line things up side by side, in columns, or in a grid layout. For the layout of my page though, I use all css with div tags. Although as said above, it is probably proper to use other types of tags as well.

I had to take a intro to web development course in college this year, and the professeur siad that is pretty much a toss up between tables and css for layout. He said he preferred to use tables, probably just because he is old school. I sent him an email on the subject but never got a response haha. So yeah, table layouts are still being taught in school, even though they are archaic. They are also much more difficult to code and handle I think, so much harder for people to learn.

Post Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is diffrence between table and div desing? extomas Web Design Discussion 12 June 13 '09 03:54 PM
format of links in a div or table ketanco HTML and CSS Help 2 February 9 '09 03:05 PM
Need someone who is great at Firexo/IE CSS discrepency issues... kennedrw HTML and CSS Help 1 November 14 '07 02:21 AM
Need Myspace Code Help Audiologic HTML and CSS Help 3 November 1 '07 11:22 AM
empty div acting as a table cell with 100% height for whitespaces blue_francis14 HTML and CSS Help 7 June 15 '07 06:09 PM