Cant figure out how to replace a table w/ css

Discussion in 'CSS' started by mopacfan, Nov 8, 2006.

  1. #1
    I'm using a css template from OSWD.org. I have almost everything working the way I want it. However, I have the main content in a <div> and in this div, I need two columns, side by side. I used to use a table for this layout but I would like to eliminate the use of tables and have the two columns in css. I've tried div and span. No matter what I do, the second "container" ends up below the first "container" instead of beside it. Each side should be the same width. The template I'm using is here: http://www.oswd.org/design/preview/id/2450. The div in which I'm working is the class of "article". Any help will be greatly appreciated. Thank you.
     
    mopacfan, Nov 8, 2006 IP
  2. A Posse Ad Esse

    A Posse Ad Esse Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I love CSS (wouldn't have a clue how to use tables) but I still count myself as a newbie so hopefully someone will confirm / correct me :)

    My guess would be to give the second column an id and then float it. Something like:

    #rightcolumn {
    float:right;
    }

    Then clear whatever comes after it - clear:both - (this might not be necessary. Someone with more experience, feel free to correct me.)

    Also, you'd have to compensate for the extra width in the "container" div, widen it by the width of the second column or halve the width of both columns.

    Hope this helps :)

    -Mark
     
    A Posse Ad Esse, Nov 8, 2006 IP
  3. mopacfan

    mopacfan Peon

    Messages:
    3,273
    Likes Received:
    164
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Well I've been using tables since 1995, so teaching this old dog some new tricks is not going over all that well. I really want to get away from tables so I guess I'm going to have to get a book on css and really try to learn this stuff.
     
    mopacfan, Nov 8, 2006 IP
  4. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #4
    I could not see the style sheet at the link you provided. Actually it looked like that site was using frames.

    If all you want is 3 col you just need a 3 col layout. I found this site most helpful. http://www.glish.com/css/

    I am a css virgin but I manged to do a true css 3 column design (with some help) at free2sms dot net. In my case I have the 2 small col on the outside but changing the widths would be easy.
     
    Colbyt, Nov 8, 2006 IP
  5. varunkrish

    varunkrish Peon

    Messages:
    107
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    css columns are hard to master .. and cross browser compatibility is a headache :D
     
    varunkrish, Nov 9, 2006 IP
  6. mopacfan

    mopacfan Peon

    Messages:
    3,273
    Likes Received:
    164
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I know it's easier to help when you can see the code and unfortunately, it's on the in house development server. So I've moved it out to a temp location on the production site:
    (remove the spaces, I don't want the SE's picking this up)
    http:// www. mocap .com/_temp/default2.asp
    http:// www. mocap .com/_temp/insidepage.asp
    http:// www. mocap .com/_temp/main.css

    I've got most of the bugs worked out (or so it seems). But I would really like this to validate. I'm going out today to buy a book on css because that's the easiest way for me to learn is by reading a how to book. So if there is one you recommend, I'd appreciate the heads up.

    Thank you
     
    mopacfan, Nov 9, 2006 IP
  7. MTbiker

    MTbiker Well-Known Member

    Messages:
    2,536
    Likes Received:
    123
    Best Answers:
    0
    Trophy Points:
    170
    #7
    I've been fan of Sitepoint's books, or at least their articles (which are just chapters from books.)
     
    MTbiker, Nov 9, 2006 IP
  8. dp-user-1

    dp-user-1 Well-Known Member

    Messages:
    794
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #8
    Just made my site valid - feel free to look at the source.
     
    dp-user-1, Nov 9, 2006 IP