I know there've been a dozen questions to this problem already but none seems to fit my situation. Since using tables for layouting purposes is no good style, I've tried a different although similar aproach, which seems to be a common way of vertically aligning content inside a div. I'm using a standard bootstrap grid with a row and columns inside.
<div class="row" style="height: 100px";>
<div class="col-lg-1 valign">
<img />
</div>
<div class="col-lg-6 valign">
<span />
</div>
<div class="col-lg-5 valign">
<span />
</div>
</div>
My css looks like this:
.valign
{
display: table;
height: 100%;
}
.valign > img, .valign > span
{
display: table-cell;
text-align: center;
vertical-align: middle;
}
I've seen this been used a lot of times, and I have used it a few times myself, but in bootstrap it breaks the bootstrap grid. The last column 'falls out of the row'.
I've tried adding table-layout: fixed
to the elements (span
and img
in this case) as suggested in another thread.
I've also tried the same thing with twelve div
s and the class col-lg-1
with the same result. The last column doesn't seem to fit in the row anymore and it looks like a line break is being created.
Any Ideas?
Cheers, Beejay