表头在bootstrap中的另一个表头内

时间:2015-03-22 08:59:30

标签: html5 twitter-bootstrap html-table

enter image description here

我试图在另一个表头中插入表头。以上是它的样子。我想要更新和删除选项卡以应用rowspan。我几乎得到了我想要的,但在更新col之前,表格边框没有正确关闭。请在那里纠正我。

<table class="datatable table-striped table-bordered"> 
        <thead>
            <tr>
                <th rowspan="2">ID</th>
                <th rowspan="2">Name of the Liquidated Society</th>
                <th rowspan="2">Jurisdiction of the Society</th>
                <th rowspan="2">Liquidation Order No & Date</th>
                <th rowspan="2">Name & Designation of Liquidator</th>
                <th colspan="6" class="text-center">In the Liquidated Society</th>
                <th rowspan="2">Update</th>
                <th rowspan="2">Delete</th>
                </tr>
                <tr>
                <th>Govt Share</th>
                <th>Govt Loan</th>
                <th>Assets to be recovered</th>
                <th>Liability to be discharged </th>
                <th>Cancellation Order Number and Date </th>
                <th> Surplus amount remitted to CDF</th>
                </tr>


        </thead>

    </table>

我希望从标题govt share

下的标题Surplus amount remitted to CDF开始到In the Liquidated Society.

1 个答案:

答案 0 :(得分:2)

在这里你将如何做到

<table class="datatable table-striped table-bordered"> 
    <thead>
        <tr>

            <th>ID</th>
            <th>Name of the Liquidated Society</th>
            <th>Jurisdiction of the Society</th>
            <th>Liquidation Order No & Date</th>
            <th>Name & Designation of Liquidator</th>
            <th colspan="6">In the Liquidated Society</th>

            <!-- here you have inserted the row, which is wrong -->

            <th>Update</th>
            <th>Delete</th>
        </tr>

         <!-- created a new row -->

         <tr>
          <!-- buffer of five columns to reach your desired column -->
              <th></th>
              <th></th>
              <th></th>
              <th></th>
              <th></th>

           <!-- add columns below -->   

              <th>Govt Share</th>
              <th>Govt Loan</th>
              <th>Assets to be recovered</th>
              <th>Liability to be discharged </th>
              <th>Cancellation Order Number and Date </th>
              <th> Surplus amount remitted to CDF</th>

             <!-- add buffer of 2 columns -->
               <th clospan="2"></th>
            </tr>
    </thead>

</table>

您错误的是,您已在new row内开始row,其中还有两个columns要显示。首先完成上一行,然后开始一个新行,给出5 columns的缓冲区以到达所需的列,即In the Liquidated Society,再次到达2 columns的缓冲区。

您可以在我的回答中使用<th colspan="5">代替five <th>代码。

编辑:

这就是你将如何实现它

<table border="1" class="datatable table-striped table-bordered"> 
    <thead>
        <tr>

            <th rowspan="2">ID</th>
            <th rowspan="2"> Name of the Liquidated Society</th>
            <th rowspan="2">Jurisdiction of the Society</th>
            <th rowspan="2">Liquidation Order No & Date</th>
            <th rowspan="2">Name & Designation of Liquidator</th>
            <th colspan="6">In the Liquidated Society</th>


            <th rowspan="2">Update</th>
            <th rowspan="2">Delete</th>
        </tr>
         <tr>


              <th>Govt Share</th>
              <th>Govt Loan</th>
              <th>Assets to be recovered</th>
              <th>Liability to be discharged </th>
              <th>Cancellation Order Number and Date </th>
              <th> Surplus amount remitted to CDF</th>

            </tr>
    </thead>

</table>

它看起来像这样

enter image description here