Everyone is aware that utilizing background-size: cover
causes the background image to scale perfectly on the browser's viewport.
However, if we apply this to a small DIV, such as one measuring 100x100px, the image will still scale based on the total browser's viewport rather than the container DIV size, resulting in only part of the image being displayed.
Is there any way to work around this issue without using background-size: 100% 100%
, which does not maintain the proportions when scaling?
The utility of background-size: cover
lies in its ability to easily resize images without requiring JavaScript or server-side modifications.
Thank you for your help in advance.