CSS 2 div size auto same height

前端 未结 4 1978
北恋
北恋 2021-01-03 05:24

i have an question in CSS:

How i can do that:

\"CSS

When the green div has (auto)

4条回答
  •  梦谈多话
    2021-01-03 05:56

    First, read this excellent article. Then, check out the fiddle:

    http://jsfiddle.net/UnsungHero97/qUT3d/

    HTML

    Column 1
    Column 2
    Column 3

    CSS

    #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;
    }​
    

提交回复
热议问题