我的Bootstrap Navbar出现问题。它似乎在几个月前工作正常,但现在它只是奇怪的事情,不明白为什么。我最大的问题是,当我在小窗口尺寸上尝试扩展我的Navmenu时,它会在右侧而不是在实际的汉堡包下面。
这是我的导航代码:
<div class="menue">
<nav class="navbar navbar-expand-lg navbar-light">
<a class="navbar-brand" href="#">Kosmetik Asura</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="nav-item">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#ueber">Über</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#angebote">Angebot</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#news">News</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#kontakt">Kontakt</a>
</li>
</ul>
</div>
</nav>
</div>
有谁能告诉我需要改变什么?
提前致谢!
PS:这是
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
CSS:
/*NAV*/
nav li{
border-left: 2px solid black;
font-size: 1em;
}
nav li:hover{
border-left: 2px solid black;
box-shadow: inset 0px 0px 5px #000;
}
.navbar{
background-color: #f2f2f2;
height: 90px;
border-bottom: 1px solid grey;
border-top: 1px solid grey;
-webkit-box-shadow: 0px 10px 20px 0px rgba(0,0,0,0.4);
-moz-box-shadow: 0px 10px 20px 0px rgba(0,0,0,0.4);
box-shadow: 0px 10px 20px 0px rgba(0,0,0,0.4);
}
.nav-link{
width: 150px;
text-align: center;
}
答案 0 :(得分:2)
align
ul
至right
.navbar-nav{
float: right!important;
}
&#13;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
<div class="menue">
<nav class="navbar navbar-expand-lg navbar-light">
<a class="navbar-brand" href="#">Kosmetik Asura</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="nav-item">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#ueber">Über</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#angebote">Angebot</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#news">News</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#kontakt">Kontakt</a>
</li>
</ul>
</div>
</nav>
</div>
&#13;
我在扩展菜单的左边看到了一个黑色的条形图 透明的。
从你的css中删除它:
border-left: 2px solid black;
box-shadow: inset 0px 0px 5px #000;