1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

What is better to use? "div" or "tables"

Discussion in 'HTML & Website Design' started by versatileshikha, Oct 29, 2009.

  1. #1
    Hi all,

    Im new here and I would like to know some doubts that I have. I observer that some websites are using "div" and other "tables".

    What is the difference between those 2? What do I get or what results, if I use "div" or "tables" in my website.

    To be honest, before I was using "tables" in my header and footer templates, and my site had a score of 95% SEO in whois.domaintools.com

    But after I switched all things to "div", now my score had lowered to 85%, is that posible and could had been because of the changing code?

    Some friends told me that using "div" is better for a fastest speed of the website...

    I would like to hear some professional opinions.
    Thanks alot to all,
     
    versatileshikha, Oct 29, 2009 IP
  2. m30

    m30 Guest

    Messages:
    116
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    div for layout, table for data =]
     
    m30, Oct 29, 2009 IP
  3. monia2

    monia2 Member

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    I prefer <table ...>
     
    monia2, Oct 29, 2009 IP
  4. cleverBrand

    cleverBrand Active Member

    Messages:
    144
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #4
    sure div...
     
    cleverBrand, Oct 29, 2009 IP
  5. m30

    m30 Guest

    Messages:
    116
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    tables are for lazy people haha
     
    m30, Oct 29, 2009 IP
  6. LeetPCUser

    LeetPCUser Peon

    Messages:
    711
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The real difference between tables and divs is basic HTML vs. CSS. CSS is a way to add formatting to many different parts of your site and control it all in one file, in comparison with a table which tends to have styling attributes added individually to each table. CSS is a very good way of standardizing your styling in one file. With one line change you can update an entire look of your site. It allows for an easier way to edit the user interface of your site. Also, using divs ends up being a lot easier to read than tables. The problem with tables is when they nest they have extra components. Look at the example below.

    
    <table>
     <tr>
      <td>
       <table background="blue" color="white" width="50%">
        <tr>
         <td align="center">Box 1</td>
         <td align="center">Box 2</td>
        </tr>
       </table>
      </td>
     </tr>
     <tr>
      <td>
       <table background="black" color="white" width="50%">
        <tr>
         <td align="center">Box 1</td>
         <td align="center">Box 2</td>
        </tr>
       </table>
      </td>
     </tr>
    </table>
    
    Code (markup):
    Now compare this with a way of doing it using CSS.

    HTML file
    
    <div id="layoutHolder">
     <div id="blueBox">
      <div class="leftBox">Box 1</div>
      <div class="rightBox">Box 2</div>
     </div>
    
     <div id="blackBox">
      <div class="leftBox">Box 1</div>
      <div class="rightBox">Box 2</div>
     </div>
    </div>
    
    Code (markup):
    CSS
    
    #layoutHolder
    {
     width:100%;
     float:left;
     color:white;
    }
    
    #blueBox
    {
     width:50%;
     background:blue;
     float:left;
    }
    
    #blackBox
    {
     width:50%;
     background:black;
     float:left;
    }
    
    .leftBox
    {
     width:50%;
     text-align:center;
    }
    
    .rightBox
    {
     width:50%;
     text-align:center;
    }
    
    Code (markup):
    Notice the hierarchy to the system. If I decided now that I wanted all of the contents in class rightBox to align right I can change one line like below.

    
    .rightBox
    {
     width:50%;
     text-align:[b]right[/b];
    }
    
    Code (markup):
    As you can see, it is VERY powerful. You can use this throughout a site and easily format. If you have any other questions, feel free to PM me or checkout the CSS section of the form.
     
    LeetPCUser, Oct 29, 2009 IP
  7. darshan1994

    darshan1994 Peon

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I would go with divs as they can be placed anywhere on the page and if used right can have great impression.
     
    darshan1994, Oct 29, 2009 IP
  8. BlueEew

    BlueEew Well-Known Member

    Messages:
    2,434
    Likes Received:
    79
    Best Answers:
    1
    Trophy Points:
    150
    #8
    Divs. Simple and plain. They are actually easier to use in my opinion also.
     
    BlueEew, Oct 29, 2009 IP
  9. hw26

    hw26 Peon

    Messages:
    101
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I've always used divs myself, i only use tables for data. CSS is so powerfull and much faster than using tables.

    Hannah
     
    hw26, Oct 29, 2009 IP
  10. sequencehosting

    sequencehosting Peon

    Messages:
    170
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Divs with CSS.

    If your not using Divs styled with CSS your missing out on a lot. :D

    Using a table inside a table inside a table really isn't a good way to go.

    Divs/CSS is:

    - better for SEO (> content over code ratio)
    - faster loading (less code)
    - browser friendly
    - easier to edit (control your websites design/style from 1 file)
    - 2009 not 2000 :)
     
    sequencehosting, Oct 29, 2009 IP
  11. phatuis

    phatuis Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Divs make the loading time slower, and are used more nowadays
     
    phatuis, Oct 29, 2009 IP
  12. forextrendalerts

    forextrendalerts Guest

    Messages:
    132
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Tables are better to use if you are making a site with the purpose of SEO and if you don't think about SEO and about the search engine ranking DIV is The best.
     
    forextrendalerts, Oct 30, 2009 IP
  13. myst_dg

    myst_dg Active Member

    Messages:
    224
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #13
    Agree. Tables for layouts are maintenance nightmares.
     
    myst_dg, Oct 30, 2009 IP
  14. sequencehosting

    sequencehosting Peon

    Messages:
    170
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Tables ARE NOT better for SEO because there is much more code. So this means it's harder for Google to crawl your content. Someone said divs are slower but there much faster than tables once again due to less code..
     
    sequencehosting, Oct 30, 2009 IP
  15. LeetPCUser

    LeetPCUser Peon

    Messages:
    711
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Agreed. Tables are NOT good for SEO. Tables are for tabulated data. A good example of something that would be put in a table is a z-index chart (example).
     
    LeetPCUser, Oct 30, 2009 IP
  16. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #16
    A simple table shouldn't affect SEO either way. While it would make me a happier person, the SE's don't currently know code from jack. They read the content for the most part, with some ability with microformats and things like header tags. But go ahead and dump a bunch of highly-sought-after info inside a big td and the googles wouldn't know the difference. Niet een slimme bot.

    Esp since people often mix tables with more semantic tags inside. I actually see more tables like this (div-based code for headers, footers and sidebars, a huge freaking table in the middle for the main content for some unknown reason) than completely-tabled pages with no other types of tags.

    (don't anyone construe the above as being pro tables-for-layout, it's not)
     
    Stomme poes, Oct 30, 2009 IP
  17. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #17
    The issue is not tables vs divs. The real issue is whether you want well structured, semantic markup, or not. No non-trivial table layout can be well structured, and people who use table based layout tend not to know or understand semantic markup.

    cheers,

    gary
     
    kk5st, Oct 30, 2009 IP
  18. wicketywick

    wicketywick Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    I can't say for sure that divs are better than tables but divs add much more flexibility which is nice.
    Secondly if you compare the code of a site which uses divs with all the codes saved in an external css file compared to a table site which no external css file, you will notice what how much lighter the actual page is.

    Making the evaluation of the page easier. Which Google probably adovocates, saves storage space and bandwidth = more money for Google.
     
    wicketywick, Oct 30, 2009 IP
  19. namendra

    namendra Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #19
    I am also with DIV
     
    namendra, Oct 30, 2009 IP
  20. shieldme

    shieldme Peon

    Messages:
    468
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Are you an idiot?
     
    shieldme, Oct 30, 2009 IP