gpt4 book ai didi

html - Bootstrap3 - 垂直居中对齐表格内容

转载 作者:行者123 更新时间:2023-11-28 04:00:58 26 4
gpt4 key购买 nike

我有一个表结构如下。

<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="actions">Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="event-object">
<a href="#" class="pull-left">
<img src="images/event-small.jpg" width="48" height="48" alt="Event Name">
</a>
<div class="event-info">
<h5 class="event-heading">Bangalore Fashion Week</h5>
<p>Sheraton, Bangalore</p>
</div>
</div>
</td>
<td>Conference</td>
<td>
<div class="table-controls">
<a href="#" class="btn btn-xs btn-default">
<i class="fa fa-pencil"></i>
</a>
<a href="#" class="btn btn-xs btn-default">
<i class="fa fa-times"></i>
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>

由于第一列的高度较大,我希望其他表格列垂直居中,以便在表格中具有良好的无缝外观。

最佳答案

你可以给vertical-align: middle;到表格单元格。然而,由于 Twitter Bootstrap 使用像 .table>tbody>tr>td 这样的选择器,它具有更高的 specificity。 value 而不是简单的 tdtable td 您必须使用相同的选择器或另一个具有更高特异性值的选择器来覆盖 Bootstrap 的默认样式:

Example Here

.table > tbody > tr > td {
vertical-align: middle;
}

关于html - Bootstrap3 - 垂直居中对齐表格内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25932622/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com