公開日2015-03-26タグCSS親要素に対して子要素を上下左右に中央配置する TRBL メソッドというものがある。 .wrap { position: relative; width: 300px; height: 300px; border: 1px solid magenta; resize: both; overflow: hidden; } .inner { position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; width: 176px; height: 244px; background-color: grey; } .inner を img 要素にして、画像の大きさが不定の時でも頑張る方法は以前記事にしているので参考までに。 この TRBL メソッドでさらに頑張ると、背景指定ではなく