所以我正在创建一个当前使用Bootstrap 3的仪表板,我正在尝试设置两个单独的下拉菜单,每次我尝试更改侧边栏导航的样式,使其与主菜单导航下拉菜单不同捡起来。因此下拉列表适用于两种导航,但我想要两种不同的样式,我无法弄清楚如何使其工作。谢谢!
边栏
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-3 col-lg-3 sidebar">
<ul class="nav nav-sidebar">
<li class="active"><a hdata-target="#" data-toggle="dropdown">Overview</a>
<ul class="dropdown-menu">
<li><a href="#">blah</a></li>
<li><a href="#">Page 2</a></li>
<li><a href="#">Page 3</a></li>
</ul></li>
<li><a href="#">Reports</a></li>
<li><a href="#">Analytics</a></li>
<li><a href="#">Export</a></li>
</ul>
<ul class="nav nav-sidebar">
<li><a href="">Nav item</a></li>
<li><a href="">Nav item again</a></li>
<li><a href="">One more nav</a></li>
<li><a href="">Another nav item</a></li>
<li><a href="">More navigation</a></li>
</ul>
<ul class="nav nav-sidebar">
<li><a href="">Nav item again</a></li>
<li><a href="">One more nav</a></li>
<li><a href="">Another nav item</a></li>
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-9 col-md-offset-3 col-lg-9 col-lg-offset-3 main">
<h1 class="sub-header">Edit Content</h1>
</div>
</div>
</div>
导航栏
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div>
<ul class="nav navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Application</a>
<ul class="dropdown-menu">
<li><a href="#">Page 1-1</a></li>
<li><a href="#">Page 1-2</a></li>
<li><a href="#">Page 1-3</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Administor</a>
<ul class="dropdown-menu">
<li><a href="#">Page 1-1</a></li>
<li><a href="#">Page 1-2</a></li>
<li><a href="#">Page 1-3</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Reports</a>
<ul class="dropdown-menu">
<li><a href="#">Page 1-1</a></li>
<li><a href="#">Page 1-2</a></li>
<li><a href="#">Page 1-3</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Entities</a>
<ul class="dropdown-menu">
<li><a href="#">Page 1-1</a></li>
<li><a href="#">Page 1-2</a></li>
<li><a href="#">Page 1-3</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Customers</a>
<ul class="dropdown-menu">
<li><a href="#">Page 1-1</a></li>
<li><a href="#">Page 1-2</a></li>
<li><a href="#">Page 1-3</a></li>
</ul></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Marketing</a>
<ul class="dropdown-menu">
<li><a href="#">Page 1-1</a></li>
<li><a href="#">Page 1-2</a></li>
<li><a href="#">Page 1-3</a></li>
</ul></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Monitor</a>
<ul class="dropdown-menu">
<li><a href="#">Page 1-1</a></li>
<li><a href="#">Page 1-2</a></li>
<li><a href="#">Page 1-3</a></li>
</ul></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">My Info</a>
<ul class="dropdown-menu">
<li><a href="#">Page 1-1</a></li>
<li><a href="#">Page 1-2</a></li>
<li><a href="#">Page 1-3</a></li>
</ul></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Help</a>
<ul class="dropdown-menu">
<li><a href="#">Page 1-1</a></li>
<li><a href="#">Page 1-2</a></li>
<li><a href="#">Page 1-3</a></li>
</ul></li>
</ul>
</div>
</div>
</nav>
答案 0 :(得分:0)
不确定我是否完全理解这个问题但是如果你想设置两个不同的Bootstrap下拉列表,我建议你在每个dropdown
类旁边添加一个额外的类,如下所示:
<div class="dropdown drop1">
...
<div class="dropdown drop2">
然后将每个样式设置为:
.dropdown.drop1 {
// custom style
}
.dropdown.drop2 {
// custom style
}
PS:注意CSS特异性。确保CSS规则足以覆盖Bootstrap CSS。