<div class="img-wrapper">
<img class="inner-img" src="https://source.unsplash.com/random/400x400" />
</div>
<!-- Additional examples -->
<div class="img-wrapper">
<img class="inner-img" src="https://source.unsplash.com/random/401x401" width="400px" height="400px" />
</div>
<div class="img-wrapper">
<img class="inner-img" src="https://source.unsplash.com/random/402x402" width="400px" height="400px" />
</div>
.img-wrapper {
width: 400px;
height: 400px;
overflow: hidden;
}
.inner-img {
transition: 0.3s;
}
.inner-img:hover {
transform: scale(1.1);
}
/* Other styling elements, that are not necessary for the example */
.img-wrapper {
display: inline-block;
box-sizing: border-box;
//border: 1px solid #000;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.