How to create equal-height columns using Materialize and Flexbox?

后端 未结 1 1446
北海茫月
北海茫月 2021-01-27 11:21

I am trying to use Flexboxes in order to strech a panel I created using Materialize.

This is the html that creates my panels:

相关标签:
1条回答
  • 2021-01-27 11:42

    Materilize uses floats which will be negated under flexbox, so we will have to lay out each column separately using flexbox and flex-direction:Column.

    Then we tell each card-panel to be to take upas much space as it can using flex:1.

    Like so:

    .row {
      display: flex;
    }
    
    .col {
      display: flex;
      flex-direction: column;
    }
    
    .card-panel {
      flex: 1;
    }
    <link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" rel="stylesheet" />
    <div class="row">
      <div class="col s6">
        <div class="card-panel">
          panel1
        </div>
        <div class="card-panel">
          panel2
        </div>
        <div class="card-panel">
          panel3
        </div>
      </div>
      <div class="col s6">
        <div class="card-panel">
          panel4
        </div>
      </div>
    </div>

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