我是bootstrap的新手。我有代码:
<header class="container">
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header"> <a href="." class="navbar-brand">Brand</a>
</div>
<!--<ul class="nav navbar-nav navbar-right">-->
<ul class="nav navbar-nav pull-right">
<li class="nav"><a href=".">Item 1</a>
</li>
<li class="nav"><a href=".">Item 2</a>
</li>
<li class="nav"><a href=".">Item 3</a>
</li>
</ul>
</div>
</header>
所以我想使用navbar-right,但我想从右边使用offset(2)。
现在是:
BRAND x x x x x x x x Item1 Item2 Item3
我想收到:
BRAND x x x x x x Item1 Item2 Item3 x x
答案 0 :(得分:1)
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<div>
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Page 1 <span class="caret"></span></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><a href="#">Page 2</a></li>
<li><a href="#">Page 3</a></li>
</ul>
<ul class="nav navbar-nav navbar-right" style="margin-right:10%;">
<li><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
<li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<h3>Right Aligned Navbar</h3>
<p>The .navbar-right class is used to right-align navigation bar buttons.</p>
</div>
</body>