Bootstrap表 - 将行的列中的一个拆分为两个

Ami*_*mir 7 html twitter-bootstrap

我设法为Bootstrap中的表创建"双行":

<table class="table table-striped table-bordered">
    <tr>
        <th>1</th>
        <th>2</th>
        <th>3</th>
    </tr>
    <tr>
        <td>A</td>
        <td>A</td>
        <td>A</td>
    </tr>
    <tr>
        <td rowspan="2">B</td>
        <td>B1</td>
        <td>B1</td>
    </tr>

    <tr>
        <td>B2</td>
        <td>B2</td>
    </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

理想情况下,我希望它看起来像这样: 在此输入图像描述

玩弄colspan并没有真正的帮助,只是打破了东西.我尝试将colspan每一行的第一列设置为2,将B中的一列设置为1,并<td>为B1和B2 添加额外的列,不起作用.

Ram*_*ler 8

最后,我有一个解决方案:

SNIPPET

.container {
  background-color: #ccc;
}
thead{
  background:#C9E4F4;
}
table,
th,
td {
  text-align: center !important;
  border: 1.5px solid #929292 !important;
}
#text1 {
  background-color: #cac;
}
#text2 {
  background-color: #cca;
}
#navigation {
  background-color: #acc;
}
Run Code Online (Sandbox Code Playgroud)
<script src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.0/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table class="table table-bordered">
  <tr>
    <thead>
      <th colspan="2">1</th>
      <th>2</th>
      <th>3</th>
    </thead>
  </tr>
  <tr>
    <td colspan="2">A</td>
    <td>A</td>
    <td>A</td>
  </tr>
  <tr>
    <td rowspan="2">B</td>
    <td>B1</td>
    <td>B1</td>
    <td>B1</td>
  </tr>
  <tr>
    <td>B2</td>
    <td>B2</td>
    <td>B2</td>
  </tr>
</table>
Run Code Online (Sandbox Code Playgroud)