请老师检查代码
来源:2-9 自由编程
wowawawoa
2021-03-02 18:31:24
<!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 {
height: 240px;
width: 300px;
overflow: hidden;
margin: 50px auto;
position: relative;
}
div p {
position: absolute;
bottom: -30px;
transition: bottom .5s linear 0s;
background-color: rgba(0, 0, 0, .5);
color: white;
width: 290px;
height: 30px;
line-height: 30px;
padding-left: 10px;
}
div:hover p {
bottom: 0;
}
</style>
</head>
<body>
<div>
<img src="img/duck.png" alt="">
<p>这是一只小黄鸭</p>
</div>
</body>
</html>
1回答
同学你好,代码实现效果很棒。继续加油,祝学习愉快!
相似问题