Using Bootstrap grids, I have split the full page into two rows (25% height and 75% height). I like an image to be contained inside the first 25% row in a responsive manner. I like to avoid setting a fixed height and want the image to occupy as much height as possible. I have tried following most answers in similar previous questions 1, 2 and 3, but none of them are working.
What I did till now: I tried using object-fit
, but could not get it to work. Also it appears the parent div display property set to flex
is the issue. But I am not able to find an alternative. Below is code and also please find MCVE in jsFiddle [link].
<div class="container-fluid h-100">
<div class="row h-25">
<div class="col">
<img src="https://getbootstrap.com/docs/5.0/assets/img/bootstrap-icons.png"
class="img-fluid" alt="Responsive image">
</div>
</div>
<div class="row h-75">
<div class="col">
75 Percent Height
</div>
</div>
</div>
html,body {
height: 100%;
}