我在括号上创建了一个slidenav它运行得很好,现在我重新打开它并且它不再工作了,我看到一个空白的屏幕,我已经删除了部分代码但是它现在搞砸了,发生了什么?这是CSS代码
* {
box-sizing: border-box;
}
html, body{
margin: 0;
padding: 0;
width: 100%;
}
.nav{
height: 60px;
background-color: aqua;
overflow:auto;
width: 100%;
}
.openbar div{
height: 5px;
background-color: darkslategray;
margin: 4px 0;
border-radius: 25px;
overflow: auto;
}
.openbar{
width: 30px;
display: block;
margin: 1.2em 0 0 1.2em;
}
.sidenav{
height: 100%;
width: 0;
position: fixed;
z-index: 2;
top: 0;
left: 0;
background-color: mintcream;
transition: 0.5s;
overflow: hidden;
}
.sidenav a{
color: darkslateblue;
font-family: gotham;
text-decoration: none;
display: block;
transition: 0.3s;
text-align: center;
font-size: 30px;
padding: 30px 0;
margin: 0 50px;
}
.sidenav a:nth-child(2){
margin-top: 4em
}
.sidenav .closebtn{
position: absolute;
top: 0;
margin: 20px 0 0 20px;
padding:
}
.sidenav a:hover{
color: white;
background-color: aqua;
border-radius: 25px;
}
答案 0 :(得分:0)
您的导航已移至侧栏。如果您将侧边栏的末端div移回导航栏上方,它应该按您希望的方式工作。 https://jsfiddle.net/2gj3jh19/6/
<div class="wrapper">
<div class="sidenav" id="main">
<a href="#" class="closebtn">X</a>
<a href="#">CONTACT</a>
<a href="#">HOME</a>
<a href="#">CALL US</a>
<a href="#">EMAIL</a>
</div>
<div class="nav">
<a href="#" class="openbar">
<div class="line1"></div>
<div class="line2"></div>
<div class="line3"></div>
</a>
</div>