SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2004
    Location
    CA
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Columns - table or divs?

    I'm trying to use tables as little as possible, but I'm not clear on how to use divs for creating side-by-side columns. How is that done? At what number of columns do you switch from using divs to tables? Three? Four? Thanks for any pointers.

  2. #2
    SitePoint Zealot
    Join Date
    Apr 2007
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tonearm View Post
    At what number of columns do you switch from using divs to tables? Three? Four? Thanks for any pointers.
    Never.

    There is a wealth of information regarding multi-column css layouts out there. do a search on the forums/google first and read the pinned CSS articles in the CSS forum as a starting point.

  3. #3
    SitePoint Enthusiast Azmeen's Avatar
    Join Date
    Apr 2007
    Location
    Johor Bahru, Johor, Malaysia
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you may have got the whole tables vs divs thing all wrong.

    The rule of thumb is simple; if it's for layout, use divs. If you want to present tabular data, then use tables.

    The thing about tableless design is that for years, talentless web designers have been using tables for layout.

  4. #4
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure you can blame it all on the designers. Browser support also has a lot to do with it. Nowadays there's no excuse of course, but in 1998 browser support was not what it is today.

  5. #5
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I do is use a combination of floats and (if necessary) negative margins. I don't like to have the right column come before the main column in the HTML source code, so I stick it after the main column, then use a negative margin and 100% width on the main column to force the right column up. Of course the columns would need widths applied to them.

  6. #6
    SitePoint Wizard silver trophybronze trophy Nadia P's Avatar
    Join Date
    Oct 2004
    Location
    NSW Australia
    Posts
    3,564
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Azmeen View Post
    The thing about tableless design is that for years, talentless web designers have been using tables for layout.
    Give me a break !! Zealotry at its finest

    Nadia

  7. #7
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No kidding. Not only that, but at the time, tables were the standard.

  8. #8
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It may be a bit harsh wording, but there really are only three reasons for using layout tables:
    1. Lack of CSS skills (could be considered a required talent nowadays)
    2. Dependence on bad WYSIWYG tools
    3. A need to support graphic design in version 4 browsers
    Birnam wood is come to Dunsinane

  9. #9
    SitePoint Evangelist croatiankid's Avatar
    Join Date
    Mar 2007
    Location
    Zagreb, Croatia
    Posts
    409
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Schulz View Post
    What I do is use a combination of floats and (if necessary) negative margins. I don't like to have the right column come before the main column in the HTML source code, so I stick it after the main column, then use a negative margin and 100% width on the main column to force the right column up. Of course the columns would need widths applied to them.
    Don't you mean the left column?
    I like using negative margins too for logical source-code order.

  10. #10
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nope, the right column. The left column just gets floated to the left, with the main column riding alongside. The main column also has a 100% width to it and margins equal to the widths of the left and right columns. I then float the right column to the right which forces it up alongside the main column.

  11. #11
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    813
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sometime you might need table for displaying data, but it is not really a good reason for site layout.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •