Simple problem: How do I vertically align a col within a col using bootstrap? Example here (I want to vertically align child1a and child1b):
http://bootply.com/7366
Prinsen's answer is the best choice. But, to fix the issue where the columns don't collapse his code needs to be surrounded by a media check statement. This way these styles are only applied when the larger columns are active. Here is the updated complete answer.
HTML:
<div class="row display-table">
<div class="col-xs-12 col-sm-4 display-cell">
img
</div>
<div class="col-xs-12 col-sm-8 display-cell">
text
</div>
</div>
CSS:
@media (min-width: 768px){
.display-table{
display: table;
table-layout: fixed;
}
.display-cell{
display: table-cell;
vertical-align: middle;
float: none;
}
}
For the parent: display: table;
For the child: display: table-cell;
Then add vertical-align: middle;
I can make a fiddle but home time now, yay!
OK here is the lovely fiddle: http://jsfiddle.net/lharby/AJAhR/
.parent {
display:table;
}
.child {
display:table-cell;
vertical-align:middle;
text-align:center;
}