0

I have the following

enter image description here

and want to vertically center-align the image.

How would I do this?

thx

Anirvan
  • 6,214
  • 5
  • 39
  • 53
timpone
  • 19,235
  • 36
  • 121
  • 211
  • possible duplicate of [Vertically aligning an image in a div element?](http://stackoverflow.com/questions/5644737/vertically-aligning-an-image-in-a-div-element) – steveax Mar 15 '12 at 01:40
  • Possible Duplicate: http://stackoverflow.com/questions/7273338/how-to-properly-vertically-align-an-image – Tahir Yasin Feb 23 '15 at 15:08

1 Answers1

0

You can't in divs by default (with straight css anyway). You have to set the containing div as a table-cell and vertical align it middle like so:

.ios-image-box
{
   display: table-cell;
   vertical-align: middle;
}
Wes Crow
  • 2,971
  • 20
  • 24
  • is it possible to do it not as a `display: table-cell`? – timpone Mar 15 '12 at 01:37
  • cool, stumbled across this too http://stackoverflow.com/questions/3655331/css-vertically-center-an-image-within-a-floated-div which also gave more info. this seems to work. thx – timpone Mar 15 '12 at 01:43
  • Yeah, the only way I know to do it without JavaScript is through `display: table-cell;`. I know that it seems kind of hacky, but it seems to be the preferred way to do it. – Wes Crow Mar 15 '12 at 01:53