CSS side by side div with Pixel and Percent widths

后端 未结 7 999
半阙折子戏
半阙折子戏 2020-12-08 10:54

I have two div\'s (side by side) inside a parent div, i want right div to occupy 100% of remaining space (i.e. 100% - 200px) and should always stay next to left div (not bel

7条回答
  •  余生分开走
    2020-12-08 11:34

    Add position properties to your right div. Left div 200px and right div occupies remaining space.

    #right{
        background-color:Aqua;
        height:100px;
        position:absolute;
        top:0;
        right:0;
        left:200px;
    }
    

    Check working example at http://jsfiddle.net/EpA5F/1/

提交回复
热议问题