Bootstrap table设置th,td内容水平、垂直居中

第一种:

.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 属性的值。
posted @ 2020-07-21 18:34  芃蓉蓁蓁  阅读(1663)  评论(0编辑  收藏  举报