CSS - Equal Height Columns?

前端 未结 11 1110
情歌与酒
情歌与酒 2020-11-21 06:08

In CSS, I can do something like this:

But I\'ve no idea how to change that to something like:


Is this possible with CSS?

11条回答
  •  清酒与你
    2020-11-21 07:00

    Yes.

    Here is the completed CSS the article uses. It is well worth reading the entire article, as the author goes step by step into what you need to make this work.

    #container3 {
        float:left;
        width:100%;
        background:green;
        overflow:hidden;
        position:relative;
    }
    #container2 {
        float:left;
        width:100%;
        background:yellow;
        position:relative;
        right:30%;
    }
    #container1 {
        float:left;
        width:100%;
        background:red;
        position:relative;
        right:40%;
    }
    #col1 {
        float:left;
        width:26%;
        position:relative;
        left:72%;
        overflow:hidden;
    }
    #col2 {
        float:left;
        width:36%;
        position:relative;
        left:76%;
        overflow:hidden;
    }
    #col3 {
        float:left;
        width:26%;
        position:relative;
        left:80%;
        overflow:hidden;
    }
    

    This isn't the only method for doing it, but this is probably the most elegant method I've encountered.

    There is another site that is done completely in this manner, viewing the source will allow you to see how they did it.

提交回复
热议问题