Jump to content


Photo

variable column div


  • Please log in to reply
No replies to this topic

#1 jmag

jmag
  • Members
  • PipPip
  • Member
  • 22 posts
  • LocationSweden

Posted 01 June 2006 - 11:34 AM

I'm actually just trying stuff out, but it would be cool to be able to do it. Lets say I've got 3 or 4 columns and I want them to float next to eachother, but one or two of them should take the leftover space and just divide it between them.

If a site is supposed to be perhaps 900px wide, and then 2 columns are 150px each. Then I want the other columns to just take up what space is left over and fill it without getting on the next line.

here's a sample of what I had in mind.

CSS:
    div {
        border: 1px #000000 solid;
        padding: 3px;
        margin: 3px;
    }
    
    #header, #footer {
        width: 900px;
        clear: both;
    }
    
    #content {
        width: 900px;
    }
    
    #menu, #somespace {
        float: left;
        width: 200px;
        background-color: #eeeeee;
    }
    
    #main, #fourth {
        float: left;
        width: 200px;
        background-color: #FF0000;
    }

HTML:
    <div name="header" id="header">
        header
    </div>
    
    <div name="content" id="content">
        <div name="menu" id="menu">
            menu
        </div>
        
        <div name="main" id="main">
            main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content main content 
        </div>
        
        <div name="somespace" id="somespace">
            bannerspace
        </div>
        
        <div name="fourth" id="fourth">
            fourth column
        </div>
    </div>
    
    <div name="footer" id="footer">
        footer
    </div>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users