请老师检查作业
来源:2-9 自由编程
以你为瘾丶
2021-08-13 14:12:33
<!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;
}
.box{
width: 300px;
height: 240px;
margin:50px auto;
/* 设置相对定位 */
position: relative;
overflow: hidden;
}
.box img{
width: 300px;
height: 240px;
display: block;
}
.box .info{
width: 280px;
height: 50px;
background-color: rgba(0,0,0,.2);
font-size: 20px;
padding-left: 20px;
line-height: 50px;
/* 设置绝对定位 */
position: absolute;
bottom:-50px;
transition: bottom 1s linear ;
color: white;
}
.box:hover .info{
bottom: 0px;
}
</style>
</head>
<body>
<div class="box">
<img src="images/duck.png" alt="">
<div class="info">这是一只小黄鸭</div>
</div>
</body>
</html>
1回答
好帮手慕星星
2021-08-13
同学你好,代码实现效果很棒。继续加油,祝学习愉快!