请老师检查
来源:2-9 自由编程
weixin_慕斯卡6086637
2021-03-19 11:06:23
<!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>小黄鸭</title>
<style>
* {
margin: 0;
padding: 0;
}
.box {
width: 300px;
height: 240px;
margin: 20px auto;
overflow: hidden;
position: relative;
}
.box img {
width: 300px;
height: 240px;
}
.box p {
position: absolute;
top: 240px;
left: 0;
width: 290px;
height: 30px;
padding-left: 10px;
background-color: rgba(0, 0, 0, .3);
transition: top 1s linear 0s;
line-height: 30px;
}
.box:hover p {
top: 210px
}
</style>
</head>
<body>
<div class="box">
<img src="images/duck.png" alt="">
<p>这是一只小黄鸭</p>
</div>
</body>
</html>
1回答
同学你好,代码实现效果很棒。继续加油,祝学习愉快!
相似问题