I would like to display arbitrary rectangular images within a circle and have them display as large as they will fit.
I am using border-radius
to make an image (or it's container) circular. The problem with this is object-fit: contain
only takes account of the rectangular bounding box, not the circular area so the images are cropped by the circle rather than fitting within it.
The best I have acheived so far is scaling all images by 70%. This makes any image fit without clipping, even a completely square image.
However this means the taller or wider the images get the more space there is between them and the edge (making them look too small).
What I really want is this...
Is this kind of "containing" possible in CSS/HTML, or only in Javascript?