make div fill up remaining space

后端 未结 3 739
不思量自难忘°
不思量自难忘° 2021-02-05 18:58

i have 3 divs conatined within an outer div. i am aligning them horizontally by floating them left. and div3 as float right

3条回答
  •  感动是毒
    2021-02-05 19:50

    This is a technique using display: table; https://jsfiddle.net/sxk509x2/

    Browser support (ie 11+): http://caniuse.com/#feat=css-table

    HTML

    $
    .00

    CSS

    .outer{
        width:300px;
        height:34px;
        display:table;
        position: relative;
        box-sizing: border-box;
    }
    .static{
        display:table-cell;
        vertical-align:middle;
        box-sizing: border-box;
    }
    .dynamic{
        display:table-cell;
        vertical-align:middle;
        box-sizing: border-box;
        width: 100%;
        height:100%;
    }
    .pretty{
        border: 1px solid #ccc;
        padding-left: 7px;
        padding-right: 7px;
        font-size:16px;
    }
    .pretty-extended{
        background: #eee;
        text-align:center;
    }
    

    The classes that contain "pretty" are not required to accomplish what you are trying to do. I just added them for appearances.

提交回复
热议问题