I have the following code which sets up a container which has a height that changes with the width when the browser is re-sized (to maintain a square aspect ratio).
Try this one
.responsive-container{ display:table; } .img-container{ display:table-cell; vertical-align: middle; }