我需要将下拉菜单对齐到屏幕的右端。我尝试过添加dropdown-menu-right mr-auto。
下拉直到等级=" nav navbar-nav">直到屏幕结束
<div class="container">
<!-- Static navbar -->
<div class="navbar navbar-fixed-top navbar-default">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="offcanvas" data-target="#navbar-offcanvas" data-canvas="body">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Project name</a>
</div>
<div class="navbar-offcanvas offcanvas" id ="navbar-offcanvas">
<ul class="nav navbar-nav">
<li><a href="../navmenu/">Slide in</a></li>
<li><a href="../navmenu-push/">Push</a></li>
<li><a href="../navmenu-reveal">Reveal</a></li>
<li class="active"><a href="./">Off canvas navbar</a></li>
<li class="dropdown ml-auto">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu dropdown-menu-right mr-auto">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
答案 0 :(得分:0)
Is this what you want?
目前尚不清楚您是否只想使用bootstrap解决此问题,但我设法使用css样式表将下拉菜单转到右侧:position=absolute
中的right=0
和li.dropdown