How can display table-row behave like colspan=3

前端 未结 1 1235
梦如初夏
梦如初夏 2021-01-05 19:20

I need two rows, the first one have 3 columns and the second I need to span all the width just like the td colspan=3 would do

Or display: table-cell; b

相关标签:
1条回答
  • 2021-01-05 19:33

    Using display: table; it cannot be done (cause sadly there's no colspan: 3; or rowspan property in CSS, therefore stylesheet is unable to mimick a real <table> element)

    but hey, flex to the rescue!

    .row{
      display: flex;
      flex-flow: wrap;
    }
    .cell{
      width: 25%;
      background:#eee;
    }
    .colspan2{
      flex: 2;
    }
    <div class="row">
      <div class="cell">Cell1</div>
      <div class="cell">Cell2</div>
      <div class="cell">Cell3</div>
      <div class="cell">Cell4</div>
      <div class="cell">Cell5</div>
      <div class="cell colspan2">Cell6 Colspan2</div>
      <div class="cell">Cell7</div>
    </div>

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