Elastic layout with max-width and min-width using grid based design

后端 未结 0 2041
轻奢々
轻奢々 2021-01-15 11:09

I want to develop 4 column layout ( in addition to mastead and footer which takes the full available width of the page) such that right-most column is fixed at 200px and oth

相关标签:
回答
  • 2021-01-15 11:20

    I tested this in IE7/8 and recent versions of Chrome, Firefox, Opera, Safari.

    This will not work in IE6 (as @meagar said) because of min-width and max-width - there are plenty of resources online detailing hacks to get around this. I'm not going to expend effort on doing this myself unless the rest of my code is correct for you. Also, I have no interest in using a CSS grid system.

    Live Demo (with taller right column)
    Live Demo (with taller fluid column)

    HTML:

    <div id="container">
        <div id="header">header</div>
        <div id="fluidColumnContainer">
            <div class="column">column 1</div>
            <div class="column">column 2</div>
            <div class="column">column 3</div>
        </div>
        <div id="fixedColumn">i'm 200px wide!<br />o<br />o<br />o<br />o</div>
        <div id="footer">footer</div>
    </div>
    

    CSS:

    html, body {
        margin: 0;
        padding: 0;
        border: 0
    }
    #container {
        margin: 0 auto;
        min-width: 960px;
        max-width: 1216px;
        overflow: auto
    }
    #fluidColumnContainer {
        padding: 0 200px 0 0
    }
    #fixedColumn {
        width: 200px;
        float: right
    }
    .column {
        float: left;
        width: 33%
    }
    #header {
        height: 90px
    }
    #footer {
        height: 90px;
        clear: both
    }
    
    0 讨论(0)
  • 消灭零回复
提交回复
热议问题