zoom effect css code example
Example 1: zoom image css
/*Zoom on hover*/
<style>
.zoom {
padding: 50px;
background-color: green;
transition: transform .2s;
width: 200px;
height: 200px;
margin: 0 auto;
}
.zoom:hover {
transform: scale(1.5);
}
</style>
<div class="zoom"></div>
/*credits: w3schools.com */
Example 2: zoom level in css
.zoom {
zoom: 150%;
}
Example 3: equivalent zoom css
-moz-transform: scale(0.5);
-webkit-transform: scale(0.5);
-o-transform: scale(0.5);
-ms-transform: scale(0.5);
transform: scale(0.5);
Example 4: how to enlarge image when hover on in css
img:hover {
transform: scale(1.3);
}
Example 5: on hover zoom card
transform: scale(1.5);
Example 6: how to use image zoom effect in css
.parent {
width: 400px;
height: 300px;
}
.child {
width: 100%;
height: 100%;
background-color: black; /* fallback color */
background-image: url("images/city.jpg");
background-position: center;
background-size: cover;
}