如何显示表格行像colspan = 3

Âng*_*igo 5 css

我需要两排,第一个有3列第二,我需要跨越就像所有的宽度 td colspan=3会做

或显示:table-cell; 表现得像colspan = 3

我在用 display: table-row; width: 100%;

怎么做到呢 ?

这是我的CSS:

<style>
      .boxer {
         display: table;
         border-collapse: collapse;
      }
      .boxer .box-row {
         display: table-row;
      }
      .boxer .box-row-search {
         display: table-row;
         width: 100%;
      }
      .boxer .box {
         display: table-cell;
         text-align: left;
         vertical-align: top;
         border: 1px solid black;
      }
</style>
Run Code Online (Sandbox Code Playgroud)

Rok*_*jan 6

使用display: table; 无法完成(遗憾的是CSS中没有colspan: 3;rowspan属性,因此样式表无法模仿真实<table>元素)

但是,嘿,flex救援!

.row{
  display: flex;
  flex-flow: wrap;
}
.cell{
  width: 25%;
  background:#eee;
}
.colspan2{
  flex: 2;
}
Run Code Online (Sandbox Code Playgroud)
<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>
Run Code Online (Sandbox Code Playgroud)