Jump to content

Vertical alignment of img inside div


son

Recommended Posts

Dynamically I display several photos inside a div that has a border. The photo can either be portrait or landscape. I would like the photo to be horizontally and vertically in middle/center, but struggle with the vertical alignment. I set the div as:

height:100px; width:100px; vertical-align:middle;

To the photo (which can only have max height and width of 100px) I applied

margin:auto 0;

It simply won't display vertically in middle. With text-align center I have them nicely horizontally aligned. Is there any good way to achieve this for the vertical display?Thanks,Son

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...