Child div 100% height to parent auto height

后端 未结 7 887
忘了有多久
忘了有多久 2021-02-12 19:47

Im here because other similar questions couldn\'t help my particular problem.

I need right div to be 100% height all the time, where the parent

相关标签:
7条回答
  • 2021-02-12 20:52

    You can accomplish this using flexbox and some creativity.

    .container {
      display: flex;
      background: black;
      padding: 5px;
      width: 300px
    }
    
    .left {
      height: 200px;
      flex: 1 0 0px;
      background: blue;
    }
    
    .right {
      flex: 1 0 0px;
      overflow: auto;
      background: green;
    }
    
    .column {
      display: flex;
      flex-direction: column;
      width: 20%;
    }
    <div class="container">
      <div class="left"></div>
      <div class="column">
        <div class="right"></div>
      </div>
    </div>

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