I am trying to center an image inside a div that scales responsively and that is always square.
I've got the always-square part working thanks to the awesome CSS-only option here.
CSS:
.thumbnail_container {
position: relative;
width: 25%;
padding-bottom: 25%;
float:left;
}
.thumbnail {
position:absolute;
width:100%;
height:100%;
text-align:center;
}
HTML:
<div class="thumbnail_container vcenter-ext">
<div class="thumbnail vcenter-int">
<img src="http://placehold.it/200x300" />
</div>
</div>
And the v-align in a div is usually pretty straight-forward with:
.vcenter-ext { display: table;}
.center-int { display: table-cell; vertical-align: middle;}
But in the end, I can't seem to use them together... Can anyone point out my problems?!?