请老师帮忙看下作业
来源:2-9 自由编程
html小小白
2021-11-30 11:31:22
<!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;
border: 1px solid black;
margin: 100px auto;
position: relative;
}
.box img {
width: 300px;
height: 240px;
}
.box .infor {
width: 290px;
height: 40px;
background-color:rgba(0,0,0,.3);
line-height: 40px;
padding-left: 10px;
color: white;
position: absolute;
left: 0;
bottom: -40px;
opacity: 0;
transition: bottom 1s linear 0s;
}
.box:hover .infor {
opacity: 1;
bottom: 0px;
}
</style>
</head>
<body>
<div class="box">
<img src="images/duck.png" alt="">
<p class="infor">这是一只小黄鸭</p>
</div>
</body>
</html>
1回答
好帮手慕久久
2021-11-30
同学你好,代码需要做如下调整:
1、鼠标移入时,能看到p标签从图片底下移上来,这样的效果不好看:
建议设置超出隐藏:
2、建议让p标签的bottom、opacity属性都有过渡效果,这样整体效果更好:
祝学习愉快!
相似问题
回答 1
回答 1
回答 1
回答 1
回答 1