I have a div with an image in which I applied a zoom effect and a slight rotation! but this image should zoom and rotate within the boundaries of the DIV without overflowing, but hide parts that exceed the size of the div.
Code:
* {
margin: 0;
padding: 0;
border: 0;
}
body {
font-family: "Open Sans", sans-serif;
}
ul, ol, li {
list-style: none;
}
.imagem {
background: #ddd;
width: 14%;
height: auto;
display: inline-grid;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.imagem img {
width: 100%;
max-width:260px;
border-radius: 10px;
padding: 5%;
}
.imagem img {
width:100%;
-webkit-transition: all .8s cubic-bezier(.190, 1.000, .220, 1.000);
-moz-transition: all .8s cubic-bezier(.190, 1.000, .220, 1.000);
-ms-transition: all .8s cubic-bezier(.190, 1.000, .220, 1.000);
-o-transition: all .8s cubic-bezier(.190, 1.000, .220, 1.000);
transition: all .8s cubic-bezier(.190, 1.000, .220, 1.000);
}
.imagem:hover > img {
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
transition: all 0.5s ease;
-moz-transform: scale(1.5) rotate(-5deg) ;
-webkit-transform: scale(1.5) rotate(-5deg) ;
-o-transform: scale(1.5) rotate(-5deg) ;
-ms-transform: scale(1.5) rotate(-5deg) ;
transform: scale(1.5) rotate(-5deg);
}
<div class="imagem">
<img alt="folder" src="https://i.imgur.com/7s6gp01.jpg"/>
</div>