Reputation: 54989
I have a Table structure as follows.
<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>
Since the first column is larger in height, I would want the other table columns to the center vertically to have a good seamless look in the table.
Upvotes: 1
Views: 15419
Reputation: 99564
You could give vertical-align: middle;
to the table cells. However since Twitter bootstrap uses selectors like .table>tbody>tr>td
which has a higher specificity value than simple td
or table td
you have to use the same selector or another one having higher specificity value to override the bootstrap's default styling:
.table > tbody > tr > td {
vertical-align: middle;
}
Upvotes: 13
Reputation: 646
.table-responsive>.table>tbody>tr>td{
vertical-align: middle;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/>
<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;
to td
try this example
Upvotes: 1