As long as you have static heights to work with, you can use a couple of strategies for vertical centering.
The most simple is to combine line-height
and vertical-align: middle
:
.image_container {
width: 570px;
height: 120px;
margin: 275px auto 0;
line-height: 120px;
}
.image_container img {
vertical-align: middle;
}
<div class="image_container">
<img src="http://jsfiddle.net/img/logo.png" />
</div>
See it: http://jsfiddle.net/ka8Hw/1/ (note: I removed your top margin for the demo)
The line-height
rule is a sort-of hacky way for inline elements to treat the entire box's height as a single line. The image will treat the middle of the box as the line that it needs to align with. But, it will align so the bottom of the image rides the midpoint. So, we use vertical-align:middle
to tell the image to align its midpoint with the line's midpoint.
Documentation