make div fill up remaining space

后端 未结 3 614
不思量自难忘°
不思量自难忘° 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:51

    What about something like this? https://jsfiddle.net/Siculus/9vs5nzy2/

    CSS:

    #container{
        width: 100%;
        float:left;
        overflow:hidden; /* instead of clearfix div */
    }
    #right{
        float:right;
        width:50px;
        background:yellow;
    }
    #left{
        float:left;
        width:50px;
        background:red;
    }
    #remaining{
        overflow: hidden;
        background:#DEDEDE;
    }
    

    Body:

    div1
    div2, remaining

提交回复
热议问题