我有一个bootstrap导航栏下拉菜单,当它处于切换模式(移动大小的浏览器)时,下拉列表后的链接不会在下拉链接下方移动。我附上了一个很难描述的截图。新闻是像EVENTS一样的主要链接。
<nav class="navbar navbar-default navbar-fixed-top navbar-header-full">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="header-full-title img-responsive">
<img src="~/Content/img/MTC_logo_header.png" class="img-responsive" />
</div>
@*<a class="navbar-brand" href="#">
<img src="~/Content/img/MTC_logo_header.png" class="img-responsive" alt="">
</a>*@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class=" nav navbar-nav navbar-right">
<li><a href="#" class="navStyle">OUR STORY</a></li>
<li><a href="#" class="navStyle">VISIT</a></li>
<li><a href="#" class="navStyle">DIRECTORY</a></li>
<li><a href="#" class="navStyle">CONDOS</a></li>
<li><a href="#" class="navStyle">APARTMENTS</a></li>
<li class="dropdown">
<a href="#" class="navStyle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">EVENTS</a>
<ul class="dropdown-menu dropDownMTC pull-left">
<li><a href="#">YOGA ROCKS THE PARK</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">MONDAY NIGHT MOVIES</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">HORSES OF HONOR</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">THURSDAY IN THE PARK</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">EVENT SHUTTLE</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">HOLIDAY LIGHTS FESTIVAL</a></li>
</ul>
</li>
<li><a href="#" class="navStyle">NEWS</a></li>
</ul>
</div>
</div>
</nav>
.navStyle{
color:white;
padding:5px 5px 5px 5px;
margin: 0px;
text-decoration:none;
}
.dropDownMTC{
background-color:#00306a;
opacity: 0.9;
color: #bfd300;
left: 0;
float: right;
min-width: 250px;
padding: 10px 0;
margin: 0px 0 0;
font-size: 14px;
text-align: right;
list-style: none;
}
答案 0 :(得分:0)
你正在添加的“拉”课程会给你带来麻烦。从Bootstrap 3.1.0开始,它已被弃用,文档建议使用dropdown-menu-left:
我检查了Bootstrap的CSS为3.3.6,左拉的样式为:
.pull-left {
float: left !important;
}
我在猜测是为什么菜单的其余部分都在它周围。我将你的代码复制到了Bootply中,并用左下角菜单替换了左下角,我相信它给了我们预期的结果: