How to make a div fill a remaining horizontal space?

前端 未结 25 1437
野的像风
野的像风 2020-11-22 00:45

I have 2 divs: one in the left side and one in the right side of my page. The one in the left side has fixed width and I want the one of the right side to f

相关标签:
25条回答
  • 2020-11-22 01:49

    .container {
      width:100%;
      display:table;
      vertical-align:middle;
    }
    
    .left {
      width:100%;
      display:table-cell;
      text-align:center;
    }
    
    .right {
      width:40px;
      height:40px;
      display:table-cell;
      float:right;
    }
    <div class="container">
      <div class="left">Left</div>
      <div class="right">Right</div>
    </div

    Try this. It worked for me.

    0 讨论(0)
提交回复
热议问题