老师请检查还有优化的地方吗
来源:2-9 自由编程
我代码么问题
2021-07-31 16:07:18
<!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;
overflow:hidden;
position:relative;
}
img{
width:300px;
height:240px;
}
p{
display:block;
width:300px;
height:40px;
line-height:40px;
text-align:center;
position:absolute;
top:240px;
background-color: rgba(0,0,0,.5);
color:rgba(255,255,255,1);
transition:transform 1s ease 0s;
}
div:hover p{
transform:translate(0,-40px);
}
</style>
</head>
<body>
<div>
<img src="../one/duck.png">
<p>这是一只小黄鸭</p>
</div>
</body>
</html>
1回答
好帮手慕言
2021-07-31
同学你好,效果是可以的,不用优化了,祝学习愉快~
相似问题