I've been attempting to create a gallery-like layout using flexbox, where the divs are displayed in rows of three columns each. However, I'm facing an issue where all the divs align in one row without dropping to the next line when there are more than three.
Below is my HTML code:
<div class="container">
<div class="inner">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid
perferendis dolor, ducimus facilis voluptas provident consectetur natus modi
eum soluta dolores explicabo deserunt debitis incidunt aperiam placeat,
doloribus vel fuga?
</p>
</div>
<div class="inner">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid
perferendis dolor, ducimus facilis voluptas provident consectetur natus modi
eum soluta dolores explicabo deserunt debitis incidunt aperiam placeat,
doloribus vel fuga?
</p>
</div>
<div class="inner">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid
perferendis dolor, ducimus facilis voluptas provident consectetur natus modi
eum soluta dolores explicabo deserunt debitis incidunt aperiam placeat,
doloribus vel fuga?
</p>
</div>
<div class="inner">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid
perferendis dolor, ducimus facilis voluptas provident consectetur natus modi
eum soluta dolores explicabo deserunt debitis incidunt aperiam placeat,
doloribus vel fuga?
</p>
</div>
</div>
And here is my CSS code:
.container{
display:flex;
justify-content:space-evenly;
align-items:center;
}
.inner{
width:30%;
background:#efefef;
margin-left:1.662%;
margin-right:1.662%;
}