I am looking to ensure that an <img>
has the smallest possible size without any empty spaces inside a div, while also being perfectly centered both horizontally and vertically. The image size may vary.
To better illustrate, here is an example: http://jsfiddle.net/q2c9D/
Additionally, similar to Mikel Ward's approach, I want the images to completely fill the div
, so there is no visible background. Although the div
currently has a black background for clarity, I require the images to be centered and take up the least amount of space possible without distorting them while filling the div
.