Expand a div to fill the remaining width

前端 未结 21 1189
一生所求
一生所求 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:15

    If the width of the other column is fixed, how about using the calc CSS function working for all common browsers:

    width: calc(100% - 20px) /* 20px being the first column's width */
    

    This way the width of the second row will be calculated (i.e. remaining width) and applied responsively.

提交回复
热议问题