My issue is that my grid elements all have various height lengths, which leaves extra space below the row underneath. It looks exactly what I want it to look like on mobile, however, on desktop I can't seem to push the images up where there is extra space.
I have tried using display: flex; align-items: flex-start;, but it still leaves the extra spacing.
Have a look at my website to see: https://eylenkim.github.io/ArtByEylen/Portfolio/portfolio.html
Here is my code:
sample HTML
<div class="grid">
    <div class="item">
        <div class="item-content">
            <img src="myimage1.JPG" style="height:auto; width: 100%">
        </div>
        <div class="item-content">
            <img src="myimage2.JPG" style="height:auto; width: 100%">
        </div>
    </div>
</div>
CSS
.grid {
  position: relative;
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  align-items: flex-start;
  margin: 0 5% 0 5%;
}
.item {
  /*position: absolute; */
  max-width: 400px;
  width:400%;
  height: auto;
  z-index: 1;
  transition: transform 0.6s ease;
  cursor: pointer;
  margin: 5px;
  overflow: hidden;
}
img {
  max-width:400px !important;
       -o-object-fit: cover;
  object-fit: cover;
  -webkit-transform: scale(1);
  -ms-transform: scale(1);
  transform: scale(1);
  -webkit-transition: all 0.3s ease-in-out;
  -o-transition: all 0.3s ease-in-out;
  transition: all 0.3s ease-in-out;
}
.item img:hover {
  -webkit-transform: scale(1.03);
    -ms-transform: scale(1.03);
    transform: scale(1.03);
}
.item-content {
  cursor: pointer;
  position: relative;
  width: 100%;
  height: 100%;
}
 
     
    
 
     
    