So I want an img
to be displayed
- as big as possible (filling the width when it is landscape / height when it is portrait)
- no crop
- no skew or stretch (original aspect ratio)
- centred both vertically and horizontally
Also, the image's original size is not known.
I've tried quite a few different options for this, including a flexbox one (to get the vertical center), but nothing seems to tick all the boxes.
Ideally I'd like this to be an all CSS solution of course, but I have been looking into some JS as well.
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…