麻烦老师检查代码
来源:2-9 自由编程
淡淡嚣风
2021-03-17 10:20:42
相关代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
padding: 0;
margin: 0;
}
div {
position: relative;
width: 300px;
height: 240px;
margin: 200px auto;
overflow: hidden;
}
div p {
position: absolute;
width: 280px;
height: 30px;
padding-left: 20px;
line-height: 30px;
background-color: rgba(0, 0, 0, .4);
top: 240px;
transition: top 1s linear 0s;
}
div:hover p {
top: 210px
}
</style>
</head>
<body>
<div>
<img src="img/duck.png" alt="">
<p>这是一只小黄鸭</p>
</div>
</body>
</html>
1回答
同学你好,代码效果实现是对的,继续加油,祝学习愉快~
相似问题