黑马前端p296练习 利用过渡制作小米效果图
-
效果图
-
代码
( 还可以优化的地方 希望指出)
<!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">
<title>Document</title>
<style>
*{
margin: 0px;
padding: 0px;
}
div{
position: relative;
width: 64px;
height: 64px;
background-color: aqua;
top: 100px;
left: 100px;
overflow: hidden;
}
div img{
position: absolute;
left: 0px;
transition: all 2s;
display: block;
}
div:hover img{
left: -64px;
}
</style>
</head>
<body>
<div>
<img src="../images/gd.png" alt="">
</div>
</body>
</html>```