我正忙着让我的下拉导航工作 - 当单击“插入符号”时,并非所有内容都显示出来。我认为它可能是z-index的一个问题,但我也无法让它工作。这是我的代码:
的 HTML:
<body>
<nav class="navbar navbar-default">
<div class="container">
<h1 class="jumbotron"><a href="index.html">Gaming Nation</a></h1>
<div class="row">
<div class="col-xs-12">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
</div>
<div id="myNavbar" class="collapse navbar-collapse">
<div class="row">
<div class="col-xs-12">
<ul id="nav-ul" class="nav navbar list-inline">
<li class="active"><a href="#">Home</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Reviews<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Adventure</a></li>
<li><a href="#">Fighting</a></li>
<li><a href="#">Platforms</a></li>
<li><a href="#">RPG</a></li>
<li><a href="#">Shooter</a></li>
<li><a href="#">Strategy</a></li>
<li><a href="#">Survival</a></li>
</ul>
</li>
<li><a href="#">Forum</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<form class="navbar-form navbar-right">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search this site...">
<div class="input-group-btn">
<button class="btn btn-primary" type="submit">
<span class="glyphicon glyphicon-search"></span>
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</nav>
</body>
的 CSS:
@font-face {
font-family: "goodTimes";
src: url("../fonts/goodtimes.ttf");
}
body {
background-color: #fde6e7;
}
.list-inline {
display: flex;
}
.list-inline li {
text-align: center;
justify-content: space-between;
flex-grow: 1;
}
nav {
z-index: 111;
}
nav h1 {
font-size: 5rem;
font-family: goodTimes;
letter-spacing: 15px;
text-align: center;
}
nav a {
color: #1047C6;
}
nav li {
font-size: 2rem;
}
.dropdown-menu li {
margin-bottom: 1rem;
}
.jumbotron {
background-color: #ededed;
padding: 0;
margin: 2rem 0;
border: 4px solid #000000;
}