How can one without using JS achieve these effects all together with any image (both large and small, with arbitrary size ratio) and any container sizes (but fixed).
- image is centered both horizontally and vertically with respect to container
- image aspect ratio is preserved
- if image width/height is larger than that of container, than image height is 100% of container, and image is cropped by width. If width/height of image is smaller than that of container, than image width is 100% of container, and image is cropped by height.
I know about solution using background image.
Please offer only solutions with <img>