请老师检查
来源:2-9 自由编程
慕UI4313976
2021-03-07 11:30:41
<!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: 0;
padding: 0;
}
.box{
width: 1200px;
overflow: hidden;
position: relative;
}
.box img{
width: 320px;
height: 240px;
display: block;
}
.box div{
position: absolute;
bottom: 0;
width: 300px;
height: 40px;
padding-left: 20px;
line-height: 40px;
color:#fff;
background-color: rgba(0,0,0,0.5);
opacity: 0;
transform: translateY(40px);
transition: all 1s ease 0s;
}
.box:hover div{
opacity: 1;
transform: translateY(0px);
}
</style>
</head>
<body>
<div class="box">
<img src="./img/duck.png" alt="">
<div>这是一直小黄鸭</div>
</div>
</body>
</html>
1回答
同学你好,代码实现正确,继续加油。
祝学习愉快!
相似问题