1
Apparently what you want is for the height to be constant, while the width does not.
I think this can be solved with:
background: url(...);
background-repeat: no-repeat;
background-position: center;
background-size: auto 100%;
div {
background: url(https://cdn.pixabay.com/photo/2016/02/24/08/53/flower-1219360_960_720.jpg) no-repeat;
background-position: center;
background-size: auto 100%;
width: 100%;
max-width: 250px;
height: 90vh;
resize: horizontal;
overflow: auto;
border: 2px solid #000;
}
<div></div>
In the above example it is possible to resize the image at its edge, as you narrow the image, only the center will be shown.
Good evening, you can use the css Object-fit Leia: https://www.w3schools.com/css/css3_object-fit.asp Ex: https://jsfiddle.net/nupqf4hz/
– Thalisson Chagas