Hey everyone! I'm facing an issue but my English isn't great. I'll do my best to explain it thoroughly, and if anything is unclear, please feel free to let me know! So here's the problem: today there's a block for users to upload photos! The dimensions of the uploaded photo cannot exceed 360px in width and height, with a minimum of 100px, and the maximum height can't go over 200px (with a minimum of 100px).
My question is, can this requirement be met using only CSS? Or would JavaScript be needed? But if JavaScript is necessary, I'm not sure how to get started as my JavaScript skills are quite limited. Any valuable suggestions from you guys would be greatly appreciated, thank you!
I've included an example below. The original photo size is only 50PX in height. How can the photo's height be increased to 100PX without affecting the ratio?
.photo{
width: 360px;
height: 200px;
object-fit:contain;
object-position:left center
}
<div class="demo">
<img class="photo" src="https://upload.cc/i1/2021/09/30/s73jb5.jpg" alt="">
</div>