I'm aiming to position an image to the middle inside a div. It works great, but for some reason, top
doesn't have any effect on the Android browser.
Very likely, I have my divs set incorrectly where the img one cannot determine it's container height (so percentage makes no sense...).
Here is a jsfiddle.
HTML:
<div class="container">
<img src="http://i.imgur.com/qRkEJni.jpg">
</div>
CSS:
.container {
height:200px;
width:200px;
float:left;
overflow: hidden;
}
.container img {
height: auto;
width:100%;
top:50%;
left:0;
position: relative;
-webkit-transform: translate(0,-50%);
-moz-transform: translate(0,-50%);
-ms-transform: translate(0,-50%);
-o-transform: translate(0,-50%);
transform: translate(0,-50%);
}