I have a little problem with my gallery’s images. There size doesn’t keep good ratio on chrome and android. That’s working very well on Firefox but that’s it.
I’am not talented in JS, so my imageResizer.js it’s part of few code that I found (I know, it’s terrible, but everyone’s got their own vocation, and mine it’s definitly more graphic…
So, my problem. I would like, for all my images : to adjust the width of my image if this one is lower than this container, with a min-height to 300px ( heigth of the container of my image). Can you help me ?
For what it’s worth, I don’t see your site as working in Firefox on Linux - as the screen width gets smaller, the images become narrower but the height stays the same.
I modify my css, and it’s seems that’s better now. However my images doesn’t take the all cover of their container. I’m wonderwing if there is not an other solution than background-size:cover
If you want to support only modern browsers you can use object-fit:cover on the image but the image and its parent containers would need to be set to width and height of 100%.
Note that this does not negate the laws of the known universe and your image will not magically fit the box unless its aspect ratio is exactly the same size as the box you place it in.
The image will fill the box and it will maintain aspect ratio but in order to do so the width or height will be manipulated by the object-fit rule so that both dimensions fill the area required. This may result in some of the image being cropped in order to do so. This is not a limitation of css but purely the laws of physics.