Jump to content

Archived

This topic is now archived and is closed to further replies.

jmag

variable column div

Recommended Posts

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:
[code]    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;
    }[/code]

HTML:
[code]    <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>[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.