Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 03-02-2012, 06:45 AM
Contributing Member
Latest Blog:
None

 
Join Date: 11-22-11
Posts: 60
iTrader: 0 / 0%
Difference between table and Div in html

What is the difference between table and div. If both are same then it means that one is useless. Expecting positive replies from the community. Thanks
 
Reply With Quote
  #2 (permalink)  
Old 03-02-2012, 07:44 AM
Member
Latest Blog:
None

 
Join Date: 03-10-11
Posts: 43
iTrader: 0 / 0%
Table is a very old way to code a website and not particularly easy to use.

Once you get used to using divs with CSS styling, the way you can style a website becomes much more flexible and powerful, using the float function etc. Absolutely do not code a whole website using a table, always use CSS and divs. Also search engines don't crawl or rank table based sites as well.
 
Reply With Quote
  #3 (permalink)  
Old 03-02-2012, 08:01 AM
Member
Latest Blog:
None

 
Join Date: 05-19-11
Location: Poland
Posts: 35
iTrader: 1 / 100%
I think most webmasters building their websites based on DIV structure. The same layout usually takes less code comparing to tables which is better for search engine crawlers. Parsing DOM content takes less time for them in case of using DIVs. Tables are for presenting data. Some geeks keep saying that correctly designed website should not have any table. Personally I don't agree. It doesn't have a big impact on SEO if you use tables reasonably. Also some trick are very hard to accomplish not using tables. I use them when need to center button that has flexible width . The construction of the button is :

HTML Code:
<a><span>hyperlink text</span></a>
If I want the button automatically adjust its width the <a> and <span> elements have in their CSS definition float:left/right. If you don't wrap it with additional container width fixed width centering the button will be awkward. This is where tables comes in handy. A following construction does the job:

HTML Code:
<table align="center"> <a><span>hyperlink text</span></a> </table>
<table> with align="center" attribute center its content regardless of its width.
 
Reply With Quote
  #4 (permalink)  
Old 03-02-2012, 08:14 AM
stone's Avatar
Contributing Member
 
Join Date: 03-28-06
Location: Macon GA USA
Posts: 268
iTrader: 0 / 0%
Tables are an efficient way to position various elements on a webpage. Unfortunately, tables load kind of slow, and adding tables inside of other tables slow page-load geometrically.

Divs can also be used to position various elements on a webpage, but require quite a bit more knowledge to use, adding in the various properties to get things to go where you want, only to discover that the page looks completely different on different browsers, and different sized screens.

Divs are said to load faster, so... learning how to use them maybe a valuable skill to pick up even when you can code perfectly well with tables.
 
Reply With Quote
  #5 (permalink)  
Old 03-02-2012, 09:30 AM
big_mistake's Avatar
Junior Member
 
Join Date: 02-04-12
Posts: 28
iTrader: 0 / 0%
div is without td,tr tags while table must have td,tr tags otherwise it is incomplete
 
Reply With Quote
  #6 (permalink)  
Old 03-02-2012, 03:03 PM
ScriptMan's Avatar
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 12,022
iTrader: 4 / 100%
Quote:
Originally Posted by zohail View Post
What is the difference between table and div. If both are same then it means that one is useless. Expecting positive replies from the community. Thanks
No personal attack intended toward you.

To repeat once again what has been said many times. Tables were never meant to be used for layout purposes. Nested tables are an abomination when used for layout purposes and should be used very sparingly for data purposes.

Tables are meant for the presentation of data in and organized form.

Divs are for layout and can be used to do anything that tables do for layout purposes. They are also about a 1000 times easier to edit when you need to make changes.
__________________
SEO does not mean Spam Everywhere Online
Scriptman's Playhouse || Ramblings from an old man
 
Reply With Quote
  #7 (permalink)  
Old 03-03-2012, 06:14 PM
Contributing Member
 
Join Date: 02-02-12
Location: New York
Posts: 864
iTrader: 0 / 0%
The difference ? - Depends upon who you ask because one side will swear by tables while the other side will swear by div's. I personally prefer tables and will continue to use them because they are far easier to maintain and use for ME.

Use what you feel is best for you and not what the general community says.
__________________
Create Your Own Online Radio Station With Ease

Wordpress Plugin Creates Sticky Magnetic Viral Content For Instant Backlinks
 
Reply With Quote
  #8 (permalink)  
Old 03-03-2012, 07:03 PM
Bob Barr's Avatar
Moderator
Latest Blog:
None

 
Join Date: 05-17-08
Location: Morgan Hill, California
Posts: 2,394
iTrader: 0 / 0%
Quote:
Originally Posted by Ord Allenbea View Post
The difference ? - Depends upon who you ask because one side will swear by tables while the other side will swear by div's. I personally prefer tables and will continue to use them because they are far easier to maintain and use for ME.

Use what you feel is best for you and not what the general community says.
Sorry, but I have to disagree with that thought. I used to feel the same way as you do. Getting switched over from tables to div's was something of a struggle that I literally had to drag myself through.

When I was starting out, tables were far easier to understand and manipulate than div's. While tables are simple in concept, things could get really ugly when you needed to embed tables within other tables. (Even with that messiness, I never thought I'd get away from using them.)

A few years ago, though, I took over maintenance of a site that had been initially designed with div's. I immediately saw the benefits of using them. Once I went through the learning curve and started using only div's on my other sites, I found that there are huge advantages to using them. Maintenance and layout changes, especially, on a div-based site are far simpler than on a table-based site.
__________________
South SF Bay Area Carpet Cleaning Cleanway USA Inc.
 
Reply With Quote
  #9 (permalink)  
Old 03-03-2012, 07:13 PM
Contributing Member
 
Join Date: 02-02-12
Location: New York
Posts: 864
iTrader: 0 / 0%
As I stated it depends upon who you ask. I have been building sites online even before 1995. Yes I do have some sites that are div, some that are tables only and some that are a mixture. To ME I will take tables over div's any day of the week.

Why create elements in div's when those elements already exist.

The best thing to use it what works for YOU and not what others suggest.

Quote:
Originally Posted by Bob Barr View Post
Sorry, but I have to disagree with that thought. I used to feel the same way as you do. Getting switched over from tables to div's was something of a struggle that I literally had to drag myself through.

When I was starting out, tables were far easier to understand and manipulate than div's. While tables are simple in concept, things could get really ugly when you needed to embed tables within other tables. (Even with that messiness, I never thought I'd get away from using them.)

A few years ago, though, I took over maintenance of a site that had been initially designed with div's. I immediately saw the benefits of using them. Once I went through the learning curve and started using only div's on my other sites, I found that there are huge advantages to using them. Maintenance and layout changes, especially, on a div-based site are far simpler than on a table-based site.
__________________
Create Your Own Online Radio Station With Ease

Wordpress Plugin Creates Sticky Magnetic Viral Content For Instant Backlinks
 
Reply With Quote
  #10 (permalink)  
Old 03-04-2012, 06:09 AM
Banned
 
Join Date: 02-23-12
Location: Germany
Posts: 6
iTrader: 0 / 0%
I prefer divs for website building, but in php scripts I use tables.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML Table problems. splap Coding Forum 14 02-05-2010 05:16 PM
What is the difference between XHTML and HTML? Dina312 SEO Forum 3 10-16-2008 11:20 PM
HTML Help: Table background positioning digitalracks Tech Talk 1 02-08-2008 08:10 AM
fixed position for fireworks html in a table lajones3 Coding Forum 0 12-19-2007 02:26 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 09:15 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2014 Escalate Media




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.