Having trouble with aligning images of different sizes in a DIV.
I found a solution on StackOverflow (How to vertically align an image inside div) that uses a <SPAN>
as a dummy element with vertical-align: middle
. It works well for resizing larger images, but they end up being displayed below the DIV.
If I take out the <SPAN>
, the horizontal alignment works but not the vertical alignment.
If there's a simple change I can make, I'd prefer to keep the simplicity of this solution.
You can see tests at: