我制作了一个带有引导程序的导航栏,其中包含一个导航菜单&一个按钮。 导航菜单浮动到左侧,按钮位于右侧。我想改变他们的位置,所以菜单会坚持到右侧&按钮位于左侧。请帮我怎么做这个..这是我的代码:
<nav class="navbar navbar-inverse navbar-fixed-top" id="my-navbar">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="" class="navbar-brand">Wiredwiki</a>
</div><!-- Navbar Header -->
<div class="collapse navbar-collapse" id="navbar-collapse">
<a href="" class="btn btn-warning navbar-btn navbar-right">Download Now</a>
<ul class="nav navbar-nav">
<li><a href="#feedback">Feedback</a></li>
<li><a href="#gallery">Gallery</a></li>
<li><a href="#features">Features</a></li>
<li><a href="#faq">Faq</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div>
</div><!-- End Container -->
</nav><!-- End Navbar -->
答案 0 :(得分:0)
利用navbar-left
和navbar-right
<nav class="navbar navbar-inverse navbar-fixed-top" id="my-navbar">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="" class="navbar-brand">Wiredwiki</a>
</div><!-- Navbar Header -->
<div class="collapse navbar-collapse" id="navbar-collapse">
<a href="" class="btn btn-warning navbar-btn navbar-left">Download Now</a>
<ul class="nav navbar-nav navbar-right">
<li><a href="#feedback">Feedback</a></li>
<li><a href="#gallery">Gallery</a></li>
<li><a href="#features">Features</a></li>
<li><a href="#faq">Faq</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div>
</div><!-- End Container -->
</nav><!-- End Navbar -->
答案 1 :(得分:0)
只需使用navbar-right和navbar-left classe即可 像这样:
<nav class="navbar navbar-inverse navbar-fixed-top" id="my-navbar">
<div class="container">
<div class="navbar-header navbar-right">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="" class="navbar-brand">Wiredwiki</a>
</div><!-- Navbar Header -->
<div class="collapse navbar-collapse navbar-right" id="navbar-collapse">
<a href="" class="btn btn-warning navbar-btn navbar-left">Download Now</a>
<ul class="nav navbar-nav">
<li><a href="#feedback">Feedback</a></li>
<li><a href="#gallery">Gallery</a></li>
<li><a href="#features">Features</a></li>
<li><a href="#faq">Faq</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div>
</div><!-- End Container -->
</nav><!-- End Navbar -->
答案 2 :(得分:0)
<div class="collapse navbar-collapse navbar-right" id="navbar-collapse">
<a href="" class="btn btn-warning navbar-btn navbar-left">Download Now</a>
我希望上面的代码适合你。我已经为整个div做了navbar-right,左边是navbar-left。