Image zoom on hover goes out of boundaries

76 Views Asked by At

I've tried to make an image zoom on hover but in the lower part, it overflows even if I set it. The with and height are responsive %. I've specified overflow: auto but in the bottom it goes out of boundaries, if I put vertical-align: top, on mouseout it shows the bottom overflow

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(50rem, 1fr));
  column-gap: 10px;
  row-gap: 10px;
  top: 0px;
  height: 100%;
  overflow: hidden;
  margin: 0 auto;
  padding: 0px;
}

.gridelement {
  overflow: hidden;
}

.gridelement img {
  transition: 0.7s ease-in-out;
}

.gridelement:hover img {
  transform: scale(1.1);
}
<div>
  <a href="portofolio/test.html">
    <div class="gridelement"><img class="img" src="image.jpg" alt=""></div>
  </a>
</div>

I've specified overflow: auto but in the bottom, it goes out of boundaries, if I put vertical-align: top, on mouseout it shows the bottom overflow

0

There are 0 best solutions below