I've tried resizing the div. After that I gave up on the div as the problem seems not to be there, but in the hyperlink itself. When I remove the hyperlink it seems to fit in. I need to preserve the hyperlink, size the border to fit the image (because I need two images in the same line) and keep the zoom inside the div.
Here's the fiddle: https://jsfiddle.net/Zvonimir1308/5p2y16w7/26/
a[href $= ".jpg"] {
margin: 20px;
border: 1px solid black;
overflow: hidden;
}
a[href $= ".jpg"] img {
transition: transform .4s;
}
a[href $= ".jpg"]:hover img {
transform: scale(1.3);
transform-origin: 50% 50%;
}
a[href $= ".jpg"] {
display: flex;
columns: 2;
margin: 0 0;
border-radius: 5px;
}
<div id="#container">
<a href="https://as.ftcdn.net/r/v1/pics/7b11b8176a3611dbfb25406156a6ef50cd3a5009/home/discover_collections/optimized/image-2019-10-11-11-36-27-681.jpg"><img src="https://as.ftcdn.net/r/v1/pics/7b11b8176a3611dbfb25406156a6ef50cd3a5009/home/discover_collections/optimized/image-2019-10-11-11-36-27-681.jpg"></a>
</div>