如何将表格标题中的文本垂直对齐到底部?

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

我有一系列桌子放在一张桌子上,这是基本结构:

<table>
   <tr>
      <td>
         <table>
            <thead>
              <tr>
                <th></th>
                <th></th>
                <th></th>
              </tr>
            <thead>
         <table>
         <table>
            <thead>
              <tr>
                <th></th>
                <th></th>
                <th></th>
              </tr>
            <thead>
         <table>
      </td>
   </tr>
</table>

我希望所有表格具有相同的高度,以便所有表格都有宽度属性。但是当数据填满表格时,有时标题包含两个单词,我想打破它: “标题 标题” 但是一旦我这样做了,其他 1 个单词的标题就会得到底部填充,并且看起来离第一个单元格的底部很远

有没有办法让所有 1 字标题更靠近单元格底部?

css html-table
1个回答
3
投票

可以通过CSS属性vertical-align设置为bottom来解决。

像这样:

.align-bottom {
   vertical-align: bottom
}
<th class="align-bottom"></th>

© www.soinside.com 2019 - 2024. All rights reserved.