<div class="container">
  <div class="photo"><img src="http://placekitten.com/400/400?image=1" alt="Kitten photo"><span>PHOTO</span></div>
  <div class="photo"><img src="http://placekitten.com/400/400?image=2" alt="Kitten photo"><span>PHOTO</span></div>
  <div class="photo"><img src="http://placekitten.com/400/400?image=3" alt="Kitten photo"><span>PHOTO</span></div>
  <div class="photo"><img src="http://placekitten.com/400/400?image=4" alt="Kitten photo"><span>PHOTO</span></div>
  <div class="photo"><img src="http://placekitten.com/400/400?image=5" alt="Kitten photo"><span>PHOTO</span></div>
  <div class="photo"><img src="http://placekitten.com/400/400?image=6" alt="Kitten photo"><span>PHOTO</span></div>
  <div class="photo"><img src="http://placekitten.com/400/400?image=7" alt="Kitten photo"><span>PHOTO</span></div>
  <div class="photo"><img src="http://placekitten.com/400/400?image=8" alt="Kitten photo"><span>PHOTO</span></div>
</div>
* {
  box-sizing: border-box;
}
img {
  max-width: 100%;
}
.container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  grid-column-gap: 3px;
  grid-row-gap: 3px;
}
.photo {
  height: 200px;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  position: relative;
}
.photo img {
  object-fit: cover;
  object-position: center center;
  width: 100%;
  height: 100%;
}
.photo span {
  color: white;
  position: absolute;
  bottom: 0;
  left: 0;
  display: block;
  width: 100%;
  padding: 5px;
  background-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0),
    rgba(0, 0, 0, 0.6)
  );
  font-weight: bold;
}
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.