我有bootstrap 4导航栏的问题,我想改变手机上的背景颜色(只有放置链接的地方),标题是蓝色的。
HTML代码:
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top ">
<div class="container"> <ul class="nav navbar-nav navbar-logo mx-auto">
<li class="nav-item">
<a class="nav-link" href="index.php"><img src="logo.svg" class="img-fluid logo"/></a>
</li>
</ul> <button class="navbar-toggler order-first" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation" >
<span class="custom-toggler navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="#">link1</a>
</li>
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="#">link2</a>
</li>
</ul>
</div>
</nav>
示例我希望如何获得
提前感谢您的帮助!
答案 0 :(得分:2)
.navbar-collapse {
background: #333;
margin: -.5rem -1rem;
padding: .5rem 1rem;
}
答案 1 :(得分:0)
@media only screen and (max-width: 800px) {
.navbar-collapse {
background: #eeefef;
}
}
根据可以切换菜单的宽度,您应该更改 max-width
属性。