Image hover top to bottom with html css images
Source Code
HTML CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body>
<div class="container">
<div class="imgHover">
<img src="./img/1.png" alt="" class="imgOne">
<img src="./img/2.png" alt="" class="imgOne">
</div>
</div>
</body>
</html>
CSS CODE
body {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.container {
display: grid;
justify-content: center;
align-items: center;
height: 100vh;
}
.imgOne {
width: 500px;
height: 300px;
object-fit: cover;
object-position: top;
box-shadow: 20px 20px 40px rgba(0, 0, 0, .5);
border-radius: 20px;
border: 1px solid red;
cursor: pointer;
transition: all 9s ease;
margin: 30px;
}
.imgOne:hover {
object-position: bottom;
}
0 Comments