florin1z
florin1z

Reputation: 3

Image zoom on hover goes out of boundaries

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

Upvotes: 0

Views: 84

Answers (0)

Related Questions