第一種:
.table th, .table td { text-align: center; vertical-align: middle!important; }
第二種:直接在td,th標簽里寫
<th style="vertical-align: middle !important;text-align: center;">序號</th> <td style="vertical-align: middle !important;text-align: center;">人員數量</td>
text-align屬性值 | 描述 |
---|---|
left | 把文本排列到左邊。默認值:由瀏覽器決定。 |
right | 把文本排列到右邊。 |
center | 把文本排列到中間。 |
justify | 實現兩端對齊文本效果。 |
inherit | 規定應該從父元素繼承 text-align 屬性的值。 |
vertical-align屬性值 | 描述 |
---|---|
baseline | 默認。元素放置在父元素的基線上。 |
sub | 垂直對齊文本的下標。 |
super | 垂直對齊文本的上標 |
top | 把元素的頂端與行中最高元素的頂端對齊 |
text-top | 把元素的頂端與父元素字體的頂端對齊 |
middle | 把此元素放置在父元素的中部。 |
bottom | 把元素的頂端與行中最低的元素的頂端對齊。 |
text-bottom | 把元素的底端與父元素字體的底端對齊。 |
% | 使用 “line-height” 屬性的百分比值來排列此元素。允許使用負值。 |
inherit | 規定應該從父元素繼承 vertical-align 屬性的值。 |