麻烦老师检查作业
来源:2-9 自由编程
慕尼黑8359237
2021-08-24 16:07:01
<!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;
}
div {
margin: 0 auto;
width: 300px;
height: 240px;
overflow: hidden;
position: relative;
}
div img {
width: 300px;
height: 240px;
}
div p {
width: 290px;
height: 50px;
background-color: rgba(128, 128, 128, 0.438);
line-height: 50px;
padding-left: 10px;
color: white;
position: absolute;
top: 240px;
left: 0;
transition: top 0.3s linear 0s;
}
div:hover p {
top: 200px;
}
</style>
</head>
<body>
<div>
<img src="images/duck.png">
<p>这是一只小黄鸭</p>
</div>
</body>
</html>
1回答
好帮手慕慕子
2021-08-24
同学你好,代码实现是对的,很棒!!!祝学习愉快~
相似问题