4.1:侧边导航栏遮盖层menu-box的高显示为0,请老师指点。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>综合实例</title>
<link rel="stylesheet" href="css/小米.css" />
</head>
<body>
<div class="main" id="main">
<div class="menu-box"></div>
<!--主菜单--》
<!--
描述:图片轮播
-->
<div class="banner" id="banner">
<a href="#">
<div class="banner-slide slide1 slide-active">
</div>
</a>
<a href="#">
<div class="banner-slide slide2">
</div>
</a>
<a href="#">
<div class="banner-slide slide3">
</div>
</a>
</div>
<!--上一张,下一张-->
<a href="javascript:void(0)" class="button prev" id="prev"></a>
<a href="javascript:void(0)" class="button next" id="next"></a>
<!--圆点导航-->
<div class="dots" id="dots">
<span class="active"></span>
<span></span>
<span></span>
</div>
</div>
<script src="js/小米JS.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>
---下面是CSS的代码
*{
margin: 0;
padding: 0;
}
ul{
list-style: none;
}
body{
font-family: "微软雅黑";
color: #14191e;
}
.main{
width: 1200px;
height: 460px;
margin: 30px auto;
overflow: hidden;
position: relative;
}
.banner{
width: 1200px;
height: 460px;
overflow: hidden;
position: relative;
}
.banner-slide{
width: 1200px;
height: 460px;
background-repeat: no-repeat;
position: absolute;
display: none;
}
.slide1{
background-image: url(../img/bg1.jpg);
}
.slide2{
background-image: url(../img/bg2.jpg);
}
.slide3{
background-image: url(../img/bg3.jpg);
}
.slide-active{
display: block;
}
.button{
position: absolute;
width: 40px;
height: 80px;
left: 244px;
top: 50%;
margin-top: -40px;
background:url(../img/arrow.png) no-repeat center center;
}
.next{
left:auto;
right: 0;
}
.prev{
transform: rotate(180deg);
}
.button:hover{
background-color: #333;
opacity: 0.8;
filter:alpha(opacity=80);
}
.dots{
position: absolute;
right: 20px;
bottom: 24px;
text-align: right;
}
.dots span{
display: inline-block;
width: 12px;
height: 12px;
border-radius: 50%;
background:rgba(7,17,27,0.4);
margin-left: 8px;
line-height: 12px;
box-shadow: 0 0 0 2px rgba(255,255,255,0.8) inset;
cursor: pointer;
}
.dots span.active{
box-shadow: 0 0 0 2px rgba(7,17,27,0.4) inset;
background: #fff;
}
//导航菜单
.menu-box{
width: 244px;
height: 460px;
position: absolute;
left: 0;
top: 0;
background:rgba(7,17,27,0.5);
opacity: 0.5;
z-index: 9;
}
正在回答 回答被采纳积分+1
PS:我是比着老师的代码写的,menu-box的宽设置了但显示为0,Z-INDEX也设置了,不管用,不知道什么地方出错了。
- 参与学习 人
- 提交作业 1088 份
- 解答问题 10204 个
如果你有Java语言基础,又想以后从事Java Web开发,那么本路径是你的不二选择!本路径从网页搭建开始入手,通过大量案例来学习Java Web基础。定能助你完成Java Web小白的蜕变!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星