3
I have this problem. I’m going to be very direct. Self-explanatory images.
I can decrease the source but I don’t know how much content will be in the block. So I want to make a working code. I researched something about Object-fit.
.container-fluid {
width: 100%;
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
.row {
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin-right: -15px;
margin-left: -15px;
}
.col-6 {
-ms-flex: 0 0 50%;
flex: 0 0 50%;
max-width: 50%;
}
.col-1 {
-ms-flex: 0 0 8.333333%;
flex: 0 0 8.333333%;
max-width: 8.333333%;
}
.col-4 {
-ms-flex: 0 0 33.333333%;
flex: 0 0 33.333333%;
max-width: 33.333333%;
}
#page {
background: #1b6491;
color: #fff;
}
<section id="page">
<div class="container-fluid">
<div class="row">
<div class="col-6"><img class="img-fluid" src="https://picsum.photos/300/300" alt=""></div>
<div class="col-1"></div>
<div class="col-4">
<h2>Lorem ipsum</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sequi iusto quam, dignissimos, totam recusandae repellendus iure cumque ab possimus esse eum nam architecto, dolorum consectetur ipsum laudantium distinctio. Maxime, dicta
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sequi iusto quam, dignissimos, totam recusandae repellendus iure cumque ab possimus esse eum nam architecto, dolorum consectetur ipsum laudantium distinctio. Maxime, dicta
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sequi iusto quam, dignissimos, totam recusandae repellendus iure cumque ab possimus esse eum nam architecto, dolorum consectetur ipsum laudantium distinctio. Maxime, dicta
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sequi iusto quam, dignissimos, totam recusandae repellendus iure cumque ab possimus esse eum nam architecto, dolorum consectetur ipsum laudantium distinctio. Maxime, dicta.</p>
</div>
<div class="col-1"></div>
</div>
</div>
</section>
you want the image to be filled across the div?
– Gabriel Gonçalves
I don’t quite understand what you want?
– Ricardo Pontual
That, that the image follows the height of the div. You can even zoom in, like that background formatting(cover center).
– Lucas Granvilla
That seems to have worked here, but in my code I believe you’re pulling something else as well. Because the image was inside the box, but she took 100% of my screen.
– Lucas Granvilla
Cara gave an edited one in my reply. Now the img occupies 100% of the container width, but does not distort the height ever.
– hugocsl