Two floated columns - one fixed, one loose width

前端 未结 8 1131
醉酒成梦
醉酒成梦 2021-02-02 06:34

I\'ve looked around SO, but I cannot find one that matches my occurrence, I basically have two columns one fixed width (185px) and the other column has no fixed wid

8条回答
  •  深忆病人
    2021-02-02 07:07

    Edited the solution, this time using flexbox, made the left column fixed using flex: 185px 0 0; then made the right column auto grow using flex-grow:1

    *{
      box-sizing: border-box;
    }
    
    body{
      padding:0;
      margin:0;
    }
    
    #container{
      display:flex;
    }
    
    #left{
      height: 100vh;
      flex: 185px 0 0;
      background-color:tomato;
    }
    
    #right{
      flex-grow: 1;
    }
    
    #right > div{
      background:pink;
    }
      
        
    Left

提交回复
热议问题