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.

<div> vs <td>

Discussion in 'HTML & Website Design' started by ghyper.com, Jun 7, 2010.

  1. apollotony

    apollotony Peon

    Messages:
    60
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #21
    A little of both is what I go by!
     
    apollotony, Jun 11, 2010 IP
  2. kothinti

    kothinti Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #22
    Sample Table

    <html>
    <body>
    <table border="1">
    <tr>
    <td>City</td>
    <td>Average Temp</td>
    </tr>
    <tr>
    <td>Atlanta</td>
    <td>68</td>
    </tr>
    <tr>
    <td>New York</td>
    <td>58</td>
    </tr>
    <tr>
    <td>San Diego</td>
    <td>77</td>
    </tr>
    </table>
    </body>
    </html>

    Sample 3 Column Div Layout

    <html>
    <style type="text/css">
    #left{
    float: left; width:30%; margin:0; padding:0; background:red;
    }
    #middle{
    float: left; width:30% margin:0; padding:0; background:yellow;
    }
    #right{
    width:30%; margin:0; padding:0;background:green;
    }
    </style>
    <body>

    <div id="left">I am on the left</div>
    <div id="middle">I am in the middle</div>
    <div id="right">I am on the right</div>

    </body>
    </html>
     
    kothinti, Jun 19, 2010 IP
  3. ked38

    ked38 Peon

    Messages:
    232
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #23
    Need use more <div> than table.
    In our side, even web jobs interview testing for make a rotated/corss/slant/overlapping pictures/graphics,
    can't do it with table.

    Forgive my poor english.


    Ked38
     
    ked38, Jun 19, 2010 IP
  4. jezzz

    jezzz Notable Member

    Messages:
    4,884
    Likes Received:
    190
    Best Answers:
    0
    Trophy Points:
    200
    #24
    Interesting Comment by all for tables... infact every one started web development in tables form of coding as the time progressed Div overcome Tables so it doesnt mean that Tables are useless to work with! Still there are thousands of websites running on same basic development done on tables
     
    jezzz, Jun 19, 2010 IP
  5. ked38

    ked38 Peon

    Messages:
    232
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #25
    Yes,can't agree any more.

    Reworking the current site to be tableless.
    Less tables is meaning less calcultion
    I follow this direction ....

    Ked38
     
    ked38, Jun 19, 2010 IP
  6. unigogo

    unigogo Peon

    Messages:
    286
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #26
    Not just ie6, ie7, ff, safari, Chrome, they are all possible to have some differences. But always, there's a cross-browser solution.
     
    unigogo, Jun 19, 2010 IP
  7. bvraghav

    bvraghav Member

    Messages:
    123
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    33
    #27
    I, agree with Astroman.

    However while aiming at columns, <table> (and of course <tr> & <td>) is less likely to fall/drop or malfunction, with respect to div.

    Look at
    http://forums.digitalpoint.com/showthread.php?t=1842577&p=14417957#post14417957
    It is required to apply some ie hacks, INVARIABLY, to set things straight, while using <div> with float property.

    <table> on the other hand will require to specify cellspacing attribute correction
    <table cellspacing="0"> .... </table>
    Code (markup):
    as cellspacing is different for different browsers. (read MSIE is the mischief monger)
    refer http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/

    Also, there is one property of tables that it automatically sets the column width, based on the cell content(s). This may turn out to be an advantage with IE, but the effect is not consistent across the browsers. Some layout might be pleasing with the IE and at the same time look like an eye-sore in google chrome.

    All in all, its more of an author's personal choice. I, for example, personally, feel div provide a better and more explicit control.
     
    bvraghav, Jun 19, 2010 IP
  8. Plazey

    Plazey Member

    Messages:
    81
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #28
    <div> is definately the way to go. As some have posted already <td> should only be used for tabular data. Sometimes it is benificial using <td> for layouts especially in email blasts. But try to use <div> instead.
     
    Plazey, Jun 19, 2010 IP
  9. diggathedog

    diggathedog Peon

    Messages:
    235
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #29
    Then again, why not go retro and use the magic of frames? or a stack of pre-positioned pop-ups?? :)
     
    diggathedog, Jun 22, 2010 IP
  10. josephwaldman1984

    josephwaldman1984 Peon

    Messages:
    306
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #30
    DIV <<< is always better ..
     
    josephwaldman1984, Jun 22, 2010 IP
  11. johneva

    johneva Well-Known Member

    Messages:
    1,480
    Likes Received:
    46
    Best Answers:
    1
    Trophy Points:
    170
    #31
    I am so supprised this question is still being asked really, but am glad to see the answers are so much better than a few years ago when divs were starting to be used for layouts more widespread.

    Divs for layout much quicker and easier to design and edit designs at a later date (Assuming your pretty good with CSS)
    Tables are for tabular data only really (Or at a real push for helping make your first one or two websites as its much easier to learn how to do tables meaning you can do a basic layout for your first few web pages/sites)
     
    johneva, Jun 22, 2010 IP
  12. seoshanu

    seoshanu Member

    Messages:
    183
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    46
    #32
    <div> is the best
     
    seoshanu, Jun 22, 2010 IP
  13. tuba

    tuba Member

    Messages:
    266
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #33
    I try to use div always as much as possible
     
    tuba, Jun 22, 2010 IP
  14. hemantwebmaster

    hemantwebmaster Member

    Messages:
    349
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #34
    Yes u are right, div more faster but div is not for IE6, Lot of developers still likes to work in IE6
     
    hemantwebmaster, Jun 23, 2010 IP
  15. Astroman

    Astroman Well-Known Member

    Messages:
    2,355
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    135
    #35
    Utter nonsense, on both counts.
     
    Astroman, Jun 23, 2010 IP
  16. leksa

    leksa Active Member

    Messages:
    432
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #36
    And honestly, i was forget exactly how to code in Table TR TD .. lol :D

    But table still work for some purpose,.. i could not blame developer that use it. Especially for fix layout that need more convinience structure like ADMIN page at the backend. Although the dashboard WP still use table for their admin side.

    No problem to use tableless in IE, even IE5. Just need some adjustment to your code, maybe :) .. thats why some people said "IE sucks"
     
    leksa, Jun 23, 2010 IP
  17. ked38

    ked38 Peon

    Messages:
    232
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #37
    For CSS with old IE version,

    with the use of "!important" in the styling may fix some cases.


    Ked
     
    ked38, Jun 23, 2010 IP
  18. v4vhen

    v4vhen Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #38
    I always use <div> for layouting. For me it's much easier to use.
     
    v4vhen, Jun 24, 2010 IP
  19. Skuvnar

    Skuvnar Peon

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #39
    I personally like td than div - quicker to develop and is usually consistent accross multiple browsers (not saying that div is not, but harder)
     
    Skuvnar, Jun 24, 2010 IP
  20. silv3r.m00n

    silv3r.m00n Active Member

    Messages:
    53
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    63
    #40
    It depends on what you want to do. For web layouts div , because tables are rigid
    For tabular data or rigid layouts like list of items , invoice , receipts , where size and layout should stay constant , you can use tables and td.
     
    silv3r.m00n, Jun 27, 2010 IP