老师帮忙检查一下代码的正确性和规范性
具体遇到的问题
报错信息的截图
相关课程内容截图
尝试过的解决思路和结果
粘贴全部相关代码,切记添加代码注释(请勿截图)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style text="style/sheels">
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
.box {
width: 1200px;
overflow: hidden;
margin: 40px auto;
position: relative;
}
.box img {
width: 650px;
height: 650px;
}
.box p {
position: absolute;
width: 630px;
height: 50px;
padding-left: 20px;
line-height: 50px;
background-color: rgba(0, 0, 0, .5);
color: white;
bottom: 0;
opacity: 0;
transition: opacity 1s ease 0s;
}
.box li:hover p {
opacity: 1;
}
</style>
</head>
<body>
<div class="box">
<li>
<img src="images/cat.jpg" alt="">
<p>我是一只小猫咪</p>
</li>
</div>
</body>
</html>
17
收起
正在回答
1回答
同学你好,测试同学的代码(老师使用的是本编程题提供的图片),存在以下问题:
1、鼠标放在下方红框区,描述文字也显示出来了:

这是因为元素的宽度设置的太大了,建议:调小元素的宽度,例如:

2、鼠标放在图片上,文字显示的动画效果与编程题要求的效果不一样,建议:修改bottom值,代码参考:

祝学习愉快~
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星