老师,麻烦检查下
来源:2-9 自由编程
澄月
2022-03-15 19:18:20
<!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{
width: 300px;
height: 240px;
margin: 0 auto;
position: relative;
overflow: hidden;
}
p{
width: 300px;
height: 40px;
position: absolute;
top: 240px;
line-height: 40px;
text-indent: 2em;
color: white;
background-color: rgba(37, 35, 35, 0.5);
cursor: pointer;
transition: top .6s linear;
}
div:hover p{
top:200px;
}
</style>
</head>
<body>
<div>
<img src="duck.png" alt="小黄鸭">
<p>这是一只小黄鸭</p>
</div>
</body>
</html>1回答
同学你好,代码正确,很棒,祝学习愉快!
相似问题