我在Bootstrap 3中有一个透明的Navbar,如果在移动设备上,我试图让导航栏不再透明。换句话说,如果您在移动设备上展开菜单,我希望菜单项具有不透明的彩色背景。
无法弄清楚如何做到这一点 - 任何想法?
我的HTML代码如下:
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top navbar-absolute navbar-transparent big" role="navigation" id="navigation">
<div class="container">
<!-- Head -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">
<img src="assets/images/logo_big.png" class="img-responsive">
</a>
</div>
<!-- Items -->
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<!-- Left -->
<ul class="nav navbar-nav">
<li class="active"><a href="">HOME</a></li>
<li><a href="blog/">BLOG</a></li>
<li><a href="price/">PRICING</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
答案 0 :(得分:2)
为移动设备添加您自己的媒体查询
@media (max-width: 767px) {
.navbar-transparent {
background: #000 !important; /*Add your own background*/
}
}
演示版为here