Expand a div to fill the remaining width

前端 未结 21 1208
一生所求
一生所求 2020-11-21 22:21

I want a two-column div layout, where each one can have variable width e.g.

21条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-21 23:05

    Pat - You are right. That's why this solution would satisfy both "dinosaurs" and contemporaries. :)

    .btnCont {
      display: table-layout;
      width: 500px;
    }
    
    .txtCont {
      display: table-cell;
      width: 70%;
      max-width: 80%;
      min-width: 20%;
    }
    
    .subCont {
      display: table-cell;
      width: 30%;
      max-width: 80%;
      min-width: 20%;
    }
    Long text that will auto adjust as it grows. The best part is that the width of the container would not go beyond 500px!
    This column as well as the entire container works like a table. Isn't Amazing!!!

提交回复
热议问题