Float a div without defining height property

后端 未结 3 660
有刺的猬
有刺的猬 2021-01-18 20:44

It looks very simple (and maybe is, just got stucked) -> just for fun, no practical need right now.

I got this:

3条回答
  •  再見小時候
    2021-01-18 21:35

    You will need to use display:table on the container and display:table-cell on the children:

    FIDDLE

    CSS:

    .master {
        width: 100%;
        height: 100%;
        display:table;
    }
    .left {
        background: red;
        display:table-cell;
        width:10%;
    }
    .left p {
        padding: 5px;
        color: #fff;
        text-align: center;
    }
    .right {
        border-left: 10px solid #fff;
        background: blue;
        color: #FFF;
        display:table-cell;
    }
    .right p {
        padding: 0px 15px 0px 15px;
        text-align: justify
    }
    

提交回复
热议问题