Let's say I have a 100x100 container which will be populated with different images via javascript. If the first image is e.g. 25x50, i want to display it inside the container centered at 50x100. Another image could be 50x25, but must be displayed at 100x50. Making a CSS with width=100% and height=100% would render all images to 100x100. How can I do that using CSS?
.container
{
width: 100px;
height:100px;
}
.image
{
max-height:100px;
max-width:100px;
position: relative;
}