I have centered a lot of stuff in my webdevelopment career, but I was wondering if there is a simple way to centering an image vertically without knowing the image\'s dimens
I found this while searching for a solution to a similar problem the solution uses CSS3 so won't work on IE8 and below.
While this is an old question I figured an updated answer might be useful to someone:
#parent{
width:400px;
height:400px;
background:red; /* just used to highlight box */
text-align:center;
}
#parent img{
position:relative;
top: 50%;
transform: translateY(-50%);
}
See this fiddle: http://jsfiddle.net/E9sTk/