JSFiddle - React, Tailwind, and code Playground

HTML

<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>

CSS

.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;
}