You can center an image, both horizontally and vertically, using margin: auto
and absolute positioning. Also:
.responsive-container {_x000D_
margin: 1em auto;_x000D_
min-width: 200px; /* cap container min width */_x000D_
max-width: 500px; /* cap container max width */_x000D_
position: relative; _x000D_
overflow: hidden; /* crop if image is larger than container */_x000D_
background-color: #CCC; _x000D_
}_x000D_
.responsive-container:before {_x000D_
content: ""; /* using pseudo element for 1:1 ratio */_x000D_
display: block;_x000D_
padding-top: 100%;_x000D_
}_x000D_
.responsive-container img {_x000D_
position: absolute;_x000D_
top: -999px; /* use sufficiently large number */_x000D_
bottom: -999px;_x000D_
left: -999px;_x000D_
right: -999px;_x000D_
margin: auto; /* center horizontally and vertically */_x000D_
}
_x000D_
<p>Note: images are center-cropped on <400px screen width._x000D_
<br>Open full page demo and resize browser.</p>_x000D_
<div class="responsive-container">_x000D_
<img src="http://lorempixel.com/400/400/sports/9/">_x000D_
</div>_x000D_
<div class="responsive-container">_x000D_
<img src="http://lorempixel.com/400/200/sports/8/">_x000D_
</div>_x000D_
<div class="responsive-container">_x000D_
<img src="http://lorempixel.com/200/400/sports/7/">_x000D_
</div>_x000D_
<div class="responsive-container">_x000D_
<img src="http://lorempixel.com/200/200/sports/6/">_x000D_
</div>
_x000D_