I have this setup here, where I have a few tabs and to the right is a checkbox.
I would like the checkbox to be vertically aligned in the center along with the tab labels.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<br>
<br>
<div class="container">
<div class="row">
<div class="col-sm-6">
<ul class="nav nav-tabs" role="tablist">
<li id="tab_1" role="presentation" class="active"><a id="lnk_1" href="#">Tab1</a></li>
<li id="tab_2" role="presentation" class=""><a id="lnk_2" href="#)">Tab2</a></li>
<li id="tab_3" role="presentation" class=""><a id="lnk_3" href="#">Tab3</a></li>
</ul>
</div>
<div class="col-sm-6 pull-right">
<span><input id="cb_D" type="checkbox" onclick="/* do things */"><label for="cb_D">CB</label></span>
</div>
</div>
</div>
I have seen this answer but adding vcenter class and defining it as given
.vcenter {
display: inline-block;
vertical-align: middle;
float: none;
}
doesn't do the trick for me and neither does assigning those styles to the div with the column itself. I also tried mucking around with display: table
and table-cell
and vertical-align: middle
, but this doesn't work either.
Flexbox is not an option unfortunately.