<ul>
  <li><img src="http://mias.kilo.jp/material/photo/img01.jpg" alt=""></li>
  <li><img src="http://mias.kilo.jp/material/photo/img02.jpg" alt=""></li>
  <li><img src="http://mias.kilo.jp/material/photo/img03.jpg" alt=""></li>
  <li><img src="http://mias.kilo.jp/material/photo/img04.jpg" alt=""></li>
  <li><img src="http://mias.kilo.jp/material/photo/img03.jpg" alt=""></li>
  <li><img src="http://mias.kilo.jp/material/photo/img04.jpg" alt=""></li>
  <li><img src="http://mias.kilo.jp/material/photo/img01.jpg" alt=""></li>
  <li><img src="http://mias.kilo.jp/material/photo/img02.jpg" alt=""></li>
</ul>
ul{
  display: flex;
  flex-wrap: wrap;
}
li{
  position: relative;
  width: 25%;
}
li:before{
  content: "";
  display: block;
  padding-top: 100%;
}
img{
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  object-fit: cover;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.