【问题标题】:Table header inside another table header in bootstrap引导程序中另一个表头内的表头
【发布时间】:2015-05-25 09:36:31
【问题描述】:

我正在尝试在另一个表头中插入表头。上面是它的样子。我希望更新和删除选项卡应用行跨度。我几乎得到了我想要的,但是在更新 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>

我想在标题In the Liquidated Society. 下从govt shareSurplus amount remitted to CDF 的标题

【问题讨论】:

  • 无效的 HTML 代码,&lt;tr&gt; 不允许在 &lt;tr&gt; 中。你能张贴一张你想要的图片吗?
  • 这与你的 CSS 有关。正如您在我的图片中看到的那样,边框是正确的。尝试检查 firebug 中的 CSS。也许在那里你可以找到为什么它没有正确关闭

标签: html twitter-bootstrap html-table


【解决方案1】:

你会怎么做

<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>

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

您可以使用&lt;th colspan="5"&gt;,而不是像我的回答那样使用five &lt;th&gt; 标签。

编辑:

这就是你将如何实现它

<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>

看起来像这样

【讨论】:

  • 嗨@Ankit,感谢您的回复。请看我上传的图片。除了最后 2 列之外,我得到了一切正常。它也应该和其他人在同一行。
  • @kdr 您没有在同一行中获得最后一列,因为 HTML 语法错误。正如我在上面的回答中解释的那样,以及 OkoTikashi 也说过的话。你需要有两行。
  • 在我的相同代码中,您给出的一些与边框相关的方法无法正常工作。更新前边界不正常
  • @kdr 你也需要发布你的 CSS,否则我无法帮助你。
  • 我修好了。这是一个 CSS 错误。谢谢@Ankit
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-07-18
  • 1970-01-01
  • 1970-01-01
  • 2021-11-19
  • 2020-11-11
  • 2018-06-27
相关资源
最近更新 更多