Multi-column layouts

Discussion in 'CSS' started by wizardswitch, Jun 13, 2007.

  1. #1
    Hello,

    I've been teaching myself CSS over the last month. I'm getting there but I have a question that I hope somebody might be able to answer. Any help would be appreciated. Basically I have a 4 column layout and wanted to ask if my method of creating 4 columns is valid and acceptable.

    Below is the general framework for the column area. Obviously they're styled and have widths etc but this is how I've gone about creating the columns. I have a page wrapper that is fixed width, just under 800px.

    #col1 {
    width:
    }

    #col2 {
    width:
    float: left;
    }

    #col3 {
    width:
    float: left;

    }

    #col4 {
    width:
    float: left;
    }

    Is this a good method to create 4 columns? Or is there a more solid method?

    Thanks a bunch!
     
    wizardswitch, Jun 13, 2007 IP
  2. Enzyme Online

    Enzyme Online Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    this is fine
    if you're making all of them have the same width and general properties, might as well use the same type of div all four times

    I suggest assigning widths with percentages
     
    Enzyme Online, Jun 13, 2007 IP
  3. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I don't. Using percentages puts the total width at the mercy of the browser viewport. I prefer using EMs instead for liquid layouts and px for fixed width layouts (except for text areas - so the text can expand and contract as needed).
     
    Dan Schulz, Jun 13, 2007 IP
  4. Enzyme Online

    Enzyme Online Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    he said he was putting these fluid divs into a fixed width container, so it's not fluid. the percentage is just a faster way of saying how much of the set-width container to take up
     
    Enzyme Online, Jun 13, 2007 IP
  5. wizardswitch

    wizardswitch Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yep I might do this but at the moment they're defined in pixels. Anyway thanks for the help. At least I'm on the right track!
     
    wizardswitch, Jun 13, 2007 IP