演练 缩放效果 划到图片上图片放大的效果 css 1002www.ixigua.com
演练 缩放效果 划到图片上图片放大的效果 css 1002
图片素材
开发思路
鼠标划到图片上时
让图片放大
让图片添加过渡 效果
给父盒子设置一个溢出隐藏
代码
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.one {
width: 400px;
height: 220px;
background-color: lightblue;
overflow: hidden;
}
.one img {
width: 100%;
height: 100%;
transition: all 1s;
}
.one img:hover {
transform: scale(1.5);
}
</style>
</head>
<body>
<div class="one">
<img src="https://pic4.zhimg.com/80/v2-27f64debe5d45df64e3adda8735bc03c_720w.png" alt="">
</div>
<div class="one">
<img src="https://pic4.zhimg.com/80/v2-27f64debe5d45df64e3adda8735bc03c_720w.png" alt="">
</div>
<div class="one">
<img src="https://pic4.zhimg.com/80/v2-27f64debe5d45df64e3adda8735bc03c_720w.png" alt="">
</div>
</body>
</html>