I recently attempted to center an image vertically using the line-height property in the parent and the vertical-align property in the child element:
<div style="height:500px; line-height:500px">
<img src="someimage.jpg" style="vertical-align:middle" />
</div>
While this method worked within the body tag, when I placed the content inside a colorbox, the image aligned to the top instead. Could this be due to any restrictions on these properties within absolute positioned elements or floated elements?
If you have a better solution for vertically centering images (other than using top:50%), please share your insights
Thank you