DIV vs TABLES

Discussion in 'HTML & Website Design' started by trackpaps, Feb 15, 2011.

  1. #1
    Hi,

    i am a backend programmer and was asked to create a website for a friend .. i have been following this forum for a while .. can somebody explain to me the benefit of using DIVs and not tables?

    is it the CODE vs content issue?

    cheers
     
    trackpaps, Feb 15, 2011 IP
  2. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #2
    Only in part. First, tables were never created to be used for layout. Second, tables are a fixed grid system forcing you to put your content into a pre-determined layout. Third, any other element can be positioned and styled far more than a table and, related, having to change the position or style of content in a table is not always easy.

    The guy who originally thought of using tables for layout regretted it and published an article saying so back in 1998!! This is not a question anyone should be asking anymore. DIV has been an HTML element since at least that long yet people are still treating it as if it were new.
     
    drhowarddrfine, Feb 16, 2011 IP
  3. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #3
    TABLE is meant for tabular data.

    so, we can say not only IE there are some people 13 years behind standards.
     
    radiant_luv, Feb 16, 2011 IP
  4. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #4
    Oh, yeah!........
     
    drhowarddrfine, Feb 16, 2011 IP
  5. HorixonDesigns

    HorixonDesigns Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thanks for the info about this
     
    HorixonDesigns, Feb 16, 2011 IP
  6. johneva

    johneva Well-Known Member

    Messages:
    1,480
    Likes Received:
    46
    Best Answers:
    1
    Trophy Points:
    170
    #6
    johneva, Feb 16, 2011 IP
  7. pom4ik

    pom4ik Greenhorn

    Messages:
    31
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    16
    #7
    i have spend alot of time redoing other people's work and converting from tables to divs ...
     
    pom4ik, Feb 16, 2011 IP
  8. aaricmartin

    aaricmartin Guest

    Messages:
    66
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Div is best
     
    aaricmartin, Feb 18, 2011 IP
  9. alia.y

    alia.y Peon

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Tables make your page very large. So increasing load time and cost of your website. Second thing is tables are not comfortable for SEO purpose. Because it inserts lots of unnecessary elements in content of page like td, tr, th etc..
    Using DIV for your website makes your webpage more search engine friendly..
     
    alia.y, Feb 18, 2011 IP
  10. mstealth

    mstealth Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    thanks a lot as i had the same problem for about a week and now sorted via this post :)
     
    mstealth, Feb 18, 2011 IP
  11. mediatunes

    mediatunes Member

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #11
    I just had this conversation with someone I was training recently. As I shared with them there are a bunch of sites built on tables. Even though there are few advantages to tables, I agree with others here that building a layout based on DIV's is far superior. I was even able to do a side by side comparison to show them the advantages of using div's. A layout based on a table is very rigid and difficult to update site wide. Editing a CSS file is much easier than updating 10, 20, 100 pages that used tables. It requires more html code to build a layout with tables. With all that said, here is why I think div's are better. It gives the designer greater flexibility in creating the layout. One site I know that shows this is css Zen Garden.
     
    mediatunes, Feb 19, 2011 IP
  12. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #12
    You do NOT base layouts on the div element. DIVs are just one of the elements you use to structure a page. Some pages I've created have NO divs at all.
     
    drhowarddrfine, Feb 19, 2011 IP
  13. johneva

    johneva Well-Known Member

    Messages:
    1,480
    Likes Received:
    46
    Best Answers:
    1
    Trophy Points:
    170
    #13
    So how would you advise setting up a 3 column layout with header and footer with no divs?

    Yeah if you simpley have a very basic bage with text, images and lists you can do it without divs but generally 99.9% of websites ever made need divs or tables for layout and tables are the worst option you could possibly even think of for a website. Tables should only be used for displaying tabular data.

    I dont get why people are still even asking this question to be honest, the same question has been asked and answered with the same answer for years and years.
     
    johneva, Feb 21, 2011 IP
  14. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #14
    Depends. Notice I didn't say not to use divs. I said you don't base a layout on one HTML element. A div is a helpful HTML element just like all the others.
     
    drhowarddrfine, Feb 21, 2011 IP
  15. winx

    winx Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    It is a myth that search engines will rank you down. IF you are more comfortable with tables use tables, if you are happier with divs, use divs.

    Like I keep telling people, if you provide the content, they will come. Google will see your page in the same way wether it is divs or tables.
     
    winx, Feb 22, 2011 IP