I am attempting to create a collection of images with rounded borders that will expand on hover, while staying within a specified box size. I want the effect to give the illusion that the image is only zooming inside the box and not physically enlarging on the webpage. Despite trying various methods, I have been unsuccessful in achieving this desired outcome. Any guidance or advice would be greatly appreciated.
https://i.sstatic.net/xnOIN.jpg
.foto{
overflow: hidden;
max-width: 100%;
border-radius: 25px;
}
.popis{
position: absolute;
bottom: 5px;
left: 50px;
}
.popis h3{
font-weight: 600;
color: white;
}
main img{
filter: brightness(60%);
width: 100%;
overflow: hidden;
border-radius: 25px;
-webkit-transform: scale(0.9);
-ms-transform: scale(0.9);
transform: scale(0.9);
transition: transform 0.5s, opacity 0.5s;
}
main img:hover{
opacity: 1;
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
transition: transform 0.5s, opacity 0.5s;
}
<main role="main" class="container">
<div class="row" id="nprace">
<div class="col-lg-12 col-md-12 text-center nadpis">
<h2>Lorem ipsum</h2>
</div>
<div class="row">
<div class="foto col-lg-4 col-md-4">
<img src="https://i.sstatic.net/XZ4V5.jpg">
<div class="popis">
<h3>Hagendaz</h3>
</div>
</div>
<div class="foto col-lg-4 col-md-4">
<img src="img/hagendaz.jpg">
<div class="popis">
<h3>Hagendaz</h3>
</div>
</div>
<div class="foto col-lg-4 col-md-4">
<img src="img/hagendaz.jpg">
<div class="popis">
<h3>Hagendaz</h3>
</div>
</div>
<div class="foto col-lg-4 col-md-4">
<img src="img/hagendaz.jpg">
<div class="popis">
<h3>Hagendaz</h3>
</div>
</div>
<div class="foto col-lg-8 col-md-8">
<h3>Text</h3>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus porttitor turpis ac leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Fusce nibh. Aenean vel massa quis mauris vehicula lacinia. Nulla quis diam. Etiam quis </p>
</div>
<div class="foto col-lg-4 col-md-4">
<img src="img/hagendaz.jpg">
<div class="popis">
<h3>Hagendaz</h3>
</div>
</div>
<div class="foto col-lg-4 col-md-4">
<img src="img/hagendaz.jpg">
<div class="popis">
<h3>Hagendaz</h3>
</div>
</div>
<div class="foto col-lg-4 col-md-4">
<img src="img/hagendaz.jpg">
<div class="popis">
<h3>Hagendaz</h3>
</div>
</div>
</div>
</div>
</main>