我正在尝试在Bootstrap 4中配置导航栏,以显示其他图标以保留仅在移动设备上显示的汉堡菜单。
我无法使图标内联显示,也无法弄清我要去哪里。
我将类navbar-nav添加到列表中,将d-lg-none隐藏在更大的设备上。引导程序中是否有内置类可以解决这些问题?我什至无法弄清楚我要去哪里。
HTML:
<nav class="navbar navbar-expand-lg">
<div class="container">
<a class="navbar-brand" href="#">
<img src="assets/images/logo-blue-sm.png" alt="">
</a>
<ul class="navbar-nav d-lg-none ml-auto navbar-icons ">
<li class="nav-item">
<a class="nav-link" href="tel:+1234567890"><i class="fa fa-3x fa-map-marker"></i></a>
</li>
<li class="nav-item">
<a class="nav-link" href="tel:+1234567890"><i class="fa fa-3x fa-comments"></i></a>
</li>
</ul>
<button class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"> </span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="docMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Experience</a>
<ul class="dropdown-menu" aria-labelledby="docMenu">
<li> <a class="dropdown-item" href="#">Our Story</a> </li>
</ul>
</li>
</ul>
</div>
<div class="nav-item border-0 d-none d-lg-inline-block align-self-center">
<a href="#" class=" btn btn-sm btn-grad text-white mb-0">Get Started</a>
</div>
</div>
</div>
</nav>
其他CSS:
.navbar-icons .nav-item{
border-bottom:none;
padding:0 5px;
position:relative;
}