This is a very common problem, but the technology moves on and new ways of doing this emerge. I'm currently trying to use flexbox for this purpose, but i now have another problem:
- The container i need to center things in is 200x200 pixels (fixed size)
- The image is unknown aspect ratio and unknown size
- Image size can be higher or lower than the container
- I need to downscale the image so that it is always less or equal to 98% of the container
If the image was square or landscape, i could do max-width: 98%. Is there any way to do the same for the image height?