I have seen this, question has been asked a lot but I have not really gotten an answer that works. I am trying to create 3 centred divs with multiple rows using (flex box) not grid please. Is it possible and what simple way. it should be center aligned.
I am trying to achieve this.
see as its centrally aligned. but mine is kinda alined to the left and if I use Justify content:center
for the wrapper the two boxes go in the middle, like this.
this is my code
<div class="wrapper">
<div id="squares">
<a href="yourlinkhere1.php"><img src="images/galleryimage1.jpg"/></a>
</div>
<div id="squares">
<a href="yourlinkhere2.php"><img src="images/galleryimage2.jpg"/></a>
</div>
<div id="squares">
<a href="yourlinkhere1.php"><img src="images/galleryimage1.jpg"/></a>
</div>
<div id="squares">
<a href="yourlinkhere2.php"><img src="images/galleryimage2.jpg"/></a>
</div>
<div id="squares">
<a href="yourlinkhere2.php"><img src="images/galleryimage2.jpg"/></a>
</div>
</div>
.wrapper {
background: #ff0000;
text-align: center;
width: 90%;
height: auto;
display: -webkit-flex;
display: flex;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
padding: 0 5% 0;
justify-content: center;
}
#squares {
background: #00ff00;
width: 30%;
height: 100px;
margin: 10px;
}
#squares img {
max-height: 300px;
width: 100%;
}
#squares h5 {
margin: 20px 0;
}
here's the link to my jfiddle for a clearer picture. https://jsfiddle.net/9ros2v4j/6/
Thanks to anyone that can explain.