I'm trying to achieve a fluid layout on my page by splitting it in specific ratios.
<div class="container">
<div class="top">Top</div>
<div class="image">image</div>
<div class="footer">footer</div>
</div>
.container{
height: 100vh;
width: 100vw;
display: flex;
flex-direction: column;
}
.top {
flex: 25%;
width: 100%;
background-color: red;
}
.image {
flex: 50%;
width: 100%;
background-color: green;
}
.footer{
flex: 25%;
width: 100%;
background-color:blue;
}
However, I'm facing an issue with inserting an image in the specified ratio as mentioned above. The image is getting stretched instead of fitting properly:
.container{
height: 100vh;
width: 100vw;
display: flex;
flex-direction: column;
}
.top {
flex: 25%;
width: 100%;
background-color: red;
}
.image {
flex: 50%;
width: 100%;
background-color: green;
max-width: 100%;
object-fit: contain;
}
.footer{
flex: 25%;
width: 100%;
background-color: blue;
}
Here's the updated demo link for reference
If anyone could provide assistance on this issue, it would be greatly appreciated.