I've searched everywhere but can't seem to find the right CSS solution for my problem. How can I ensure that an image always fills 100% of the height and width of the screen while maintaining its aspect ratio?
.myimage {
object-fit: cover;
width: 100%;
height: 250px;
}
The code above almost does what I need, but I want to avoid hardcoding the height and have the image fill almost 100% of the browser's view while preserving its aspect ratio. Essentially, I want the image to always fit perfectly in terms of height and width without any scrolling, and to maintain this even when the browser is resized. I am working with the Bootstrap 5 framework.