我使用Bootstrap Material Design Template作为网站。它有three different colored navbars我要使用最后一个。但我不确定如何使用最后一个。我是否需要手动更改导航栏的颜色,还是可以在某处更改一件事,以便所有按钮和单选按钮的颜色也发生变化?
我在github页面上找到了一篇文章,指出如何change the primary color to a cusom one。但我不想要,我只想使用你在third navbar option here中看到的蓝色。
我有什么想法可以做到这一点?欢迎所有提示!
答案 0 :(得分:1)
实际上你只需要使用不同的类来改变颜色,默认情况下,Bootstrap主题有navbar-default
和navbar-inverse
但是在你正在使用的主题中有一个名为navbar-material-light-blue-300
的类需要以下列方式添加。
<div class="navbar navbar-material-light-blue-300">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-material-light-blue-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="javascript:void(0)">Brand</a>
</div>
<div class="navbar-collapse collapse navbar-material-light-blue-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="javascript:void(0)">Active</a></li>
<li><a href="javascript:void(0)">Link</a></li>
<li class="dropdown">
<a href="index.html" data-target="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="javascript:void(0)">Action</a></li>
<li><a href="javascript:void(0)">Another action</a></li>
<li><a href="javascript:void(0)">Something else here</a></li>
<li class="divider"></li>
<li class="dropdown-header">Dropdown header</li>
<li><a href="javascript:void(0)">Separated link</a></li>
<li><a href="javascript:void(0)">One more separated link</a></li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left">
<input type="text" class="form-control col-lg-8" placeholder="Search">
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="javascript:void(0)">Link</a></li>
<li class="dropdown">
<a href="index.html" data-target="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="javascript:void(0)">Action</a></li>
<li><a href="javascript:void(0)">Another action</a></li>
<li><a href="javascript:void(0)">Something else here</a></li>
<li class="divider"></li>
<li><a href="javascript:void(0)">Separated link</a></li>
</ul>
</li>
</ul>
</div>
</div>
快乐编码:)
答案 1 :(得分:1)
.navbar-inverse
是影响其颜色的类。
<div class="navbar navbar-inverse">
....
</div>
除了第三个之外的其他两个分别有.navbar-default
和.navbar-warning
个类。
使用以下代码:
<div class="navbar navbar-inverse">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-inverse-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="javascript:void(0)">Brand</a>
</div>
<div class="navbar-collapse collapse navbar-inverse-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="javascript:void(0)">Active</a>
</li>
<li><a href="javascript:void(0)">Link</a>
</li>
<li class="dropdown">
<a href="bootstrap-elements.html" data-target="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="javascript:void(0)">Action</a>
</li>
<li><a href="javascript:void(0)">Another action</a>
</li>
<li><a href="javascript:void(0)">Something else here</a>
</li>
<li class="divider"></li>
<li class="dropdown-header">Dropdown header</li>
<li><a href="javascript:void(0)">Separated link</a>
</li>
<li><a href="javascript:void(0)">One more separated link</a>
</li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left">
<input class="form-control col-lg-8" placeholder="Search" type="text">
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="javascript:void(0)">Link</a>
</li>
<li class="dropdown">
<a href="bootstrap-elements.html" data-target="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="javascript:void(0)">Action</a>
</li>
<li><a href="javascript:void(0)">Another action</a>
</li>
<li><a href="javascript:void(0)">Something else here</a>
</li>
<li class="divider"></li>
<li><a href="javascript:void(0)">Separated link</a>
</li>
</ul>
</li>
</ul>
</div>
</div>