如何在Bootstrap表格中分割已经被分割的单元格?

问题描述 投票:0回答:1

我有一个有多行的bootstrap表,我想把单元格分割成不同的部分,我可以把行分割成Split-1,但我很困惑如何把Split-1分割成Split-2。我想把单元格分割成不同的部分,我可以把行分割成Split-1,但我很困惑如何把Split-1分割成Split-2。我试图使用rowspan来实现Split-2,但由于某些原因,它变得一团糟。谁能帮帮我。enter image description here

 <table class="table table-bordered">
    <tbody>
        <tr>
            <td rowspan="2" style="background-color: #a854a8;text-align: center;"> MAIN FIELD </td>
            <td > TIME-1 </td>
            <td>
                <input type="datetime-local" class="form-control" ng-model="formdata.time" id="time" placeholder="Time 2">
            </td>
        </tr>
        <tr>
            <td style="background-color: #eedded;width: 10%;"> TIME-2 </td>
            <td>
                <input type="datetime-local" class="form-control" ng-model="formdata.time2" id="time2" placeholder="Time2">
            </td>
        </tr>
    </tbody>
</table>
html bootstrap-4 html-table row bootstrap-table
1个回答
1
投票

你很接近......下面的片段应该有帮助。

th {
  background-color: lightpink;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">

<table class="table table-bordered">
  <tr>
    <th>column 1</th>
    <th>column 2</th>
    <th>column 3</th>
  </tr>
  <tr>
    <td rowspan="4" style="background-color: #a854a8;text-align: center;">Main field</td>
    <td rowspan="2" style="background-color: #eedded;width: 10%;">Time1 split 1</td>
    <td>split-2 result</td>
  </tr>
  <tr>
    <td>split-2 result</td>
  </tr>
  <tr>
    <td rowspan="2" style="background-color: #eedded;width: 10%;">Time2 split 1</td>
    <td>split-2 result</td>
  </tr>
  <tr>
    <td>split-2 result</td>
  </tr>
</table>
© www.soinside.com 2019 - 2024. All rights reserved.