I am attempting to create 3 divs in a single row. Each div is divided into two parts, one with an image and the other with three lines of text.
The divs have a box-shadow style applied to them.
However, I am facing issues with spacing between the divs. When I add extra margin or padding, it creates problems when the page is resized.
Currently, my layout is close to what I want, but resizing the browser causes the divs to collide with each other.
I have tried using breakpoints like col-sm-6-md-4
, but it has not been effective.
One solution that worked for me involved positioning the image above the text at the bottom, which resolved the issue.
.box1 {
box-shadow: 1px 1px 3px 1px grey;
}
<section>
<div class="container">
<div class="row">
<div class="col-4 py-4">
<div class="row">
<div class="col ">
<div class="row justify-content-center">
<div class="col-11 box1 d-flex">
<div class="box2"><img style="width: 100px; height: 100px;" src="img/icon/m/img.png" alt="a"></div>
<div class="box2">
<p>text</p>
<p>text</p>
<p>text</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-4 py-4">
<div class="row">
<div class="col ">
<div class="row justify-content-center">
<div class="col-11 box1 d-flex">
<div class="box2"><img style="width: 100px; height: 100px;" src="img/icon/m/img.png" alt="a"></div>
<div class="box2">
<p>text</p>
<p>text</p>
<p>text</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-4 py-4">
<div class="row">
<div class="col ">
<div class="row justify-content-center">
<div class="col-11 box1 d-flex">
<div class="box2"><img style="width: 100px; height: 100px;" src="img/icon/m/img.png" alt="a"></div>
<div class="box2">
<p>text</p>
<p>text</p>
<p>text</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<---- below is working code but with some different layouts that I don't want -->
<---- below is working code but with some different layouts that I don't want -->
<div class="container">
<div class="row">
<div class="col-sm-4">
<div class="box1">
<img class="" src="img/icon/m/img.png" alt="a">
<p>text</p>
<p>text</p>
<p>text</p>
</div>
</div>
<div class="col-sm-4">
<div class="box1">
<img class="" src="img/icon/m/img.png" alt="a">
<p>text</p>
<p>text</p>
<p>text</p>
</div>
</div>
<div class="col-sm-4">
<div class="box1">
<img class="" src="img/icon/m/img.png" alt="a">
<p>text</p>
<p>text</p>
<p>text</p>
</div>
</div>
</div>
</div>