在双头表中的引导程序中居中 <th>

mecabpazzo95

你好,我有一张桌子,我想将一个 th 放在另外两个 th 之间。我想更改要显示在ProvisionnelRégularisation中心的th Vieillesse de base的位置

这是我的 HTML :

<div class="row mt-1">
   <div class="col-12">
      <table class="table table-striped table-adjust ">
         <thead class="cordonnes-cabinet">
            <tr>
               <th scope="col">Date</th>
               <th scope="col" style="text-align:center" colspan="2">Vieillesse de base</th>
               <th scope="col" style="text-align:right">Complémentaire</th>
               <th scope="col" style="text-align:right">Total</th>
            </tr>
            <tr>
               <th scope="col">...</th>
               <th scope="col" style="text-align:right">Provisionnel</th>
               <th scope="col" style="text-align:right">Régularisation</th>
               <th scope="col" style="text-align:right">...</th>
               <th scope="col" style="text-align:right">...</th>
            </tr>
         </thead>
         <tbody class="cordonnes-cabinet">
            @for (int i = 0; i < echeancierGeneriqueAjustee.Count; i++)
            {
            <tr>
               <th style="font-weight:100">@(echeancierGeneriqueAjustee[i]["Date"])</th>
               <td style="text-align:right">@(echeancierGeneriqueAjustee[i]["MontantProv"])</td>
               <td style="text-align:right">@(echeancierGeneriqueAjustee[i]["MontantRegul"])</td>
               <td style="text-align:right">@(echeancierGeneriqueAjustee[i]["MontantComplement"])</td>
               <td style="text-align:right">@(echeancierGeneriqueAjustee[i]["TotalEcheance"])</td>
            </tr>
            }
            <tr>
               <th style="font-size:14px">Total</th>
               <td style="text-align:right">@(echeancierGeneriqueAjustee[0]["TotalProv"])</td>
               <td style="text-align:right">@(echeancierGeneriqueAjustee[0]["TotalRegul"])</td>
               <td style="text-align:right">@(echeancierGeneriqueAjustee[0]["TotalComplement"])</td>
               <td style="text-align:right">@(echeancierGeneriqueAjustee[0]["Total"])</td>
            </tr>
         </tbody>
      </table>
   </div>
</div>

这样做的关键是colspanth, 中使用 html来模拟宽度与第二行的相等性。那么你只需要使用.text-center.
在您的特殊情况下,colspan="2"在第二个使用th

JS小提琴演示

<table class="table">
  <thead class="cordonnes-cabinet">
    <tr>
      <th>Date</th>
      <th colspan="2" class="text-center">Vieillesse de base</th>
      <th>Complémentaire</th>
      <th>Total</th>
    </tr>
    <tr>
      <th style="width:10%">...</th>
      <th class="text-center">Provisionnel</th>
      <th class="text-center">Régularisation</th>
      <th>...</th>
      <th>...</th>
    </tr>
  </thead>
  <tbbody>
    <tr>
      <th>col1</th>
      <td class="text-center">col2</td>
      <td class="text-center">col3</td>
      <td>col4</td>
      <td>col5</td>
    </tr>
  </tbbody>
</table>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

在Bootstrap 3中将<td>和<th>元素居中

来自分类Dev

计算HTML表中的行数,除非不将<th> </ th>计为一行

来自分类Dev

CSS中的类的样式<th>

来自分类Dev

表th中的CSS垂直文本

来自分类Dev

在table.th.tr和table.tbody.tr中选择两种类型的表中的th

来自分类Dev

在字符串中获取?th元素

来自分类Dev

如何在导出html表数据中包含<th>行?

来自分类Dev

如何在引导表中对齐th

来自分类Dev

在js表中添加<th>

来自分类Dev

结合th:each和th:if时如何在Thymeleaf中获得过滤列表的大小?

来自分类Dev

将图标添加到HTML表中的<th>

来自分类Dev

在页眉(th)上添加按钮以隐藏和显示引导表中的过滤器控件

来自分类Dev

C ++中数字的N-TH根

来自分类Dev

<th> <div>标头单元格中的Javascript Fadein Fadeout文本

来自分类Dev

jQuery将类分配给表中的th

来自分类Dev

在可排序的jQueryUI中的表之间移动包括th的列

来自分类Dev

在<th>中对齐多个元素

来自分类Dev

与表格中的列相比,不同数量的TH

来自分类Dev

在jQuery中获取TH值

来自分类Dev

在jQuery中使用$ .each()从th集合中获取“ th”文本

来自分类Dev

在html和jquery中隐藏列th

来自分类Dev

Thlceleaf th标签在blc标签中

来自分类Dev

<th> 元素中的 Javascript

来自分类Dev

Thymeleaf:th:text 中的 Html 标签

来自分类Dev

在 TH 中对齐两个 DIV

来自分类Dev

仅从 td 表而不是从 Header (th) 中搜索

来自分类Dev

使用 Javascript 更改 TH 中的文本

来自分类Dev

如何从标签“<th>Australia</th>”中获取“Australia”

来自分类Dev

如何在 Umbraco 中根据 <th></th> 匹配表 <td></td>