尝试让自举导航栏在响应式网站的左侧,中间和右侧有链接。
这甚至可能吗?也许navbar-justified是错误的导航栏上的内容?
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<ul class="nav navbar-nav navbar-left">
<a class="navbar-brand" href="#home"> LEFT </a>
</ul>
<ul class="nav navbar-nav navbar-justified">
<a href="#"> CENTER </a>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#facebook"> <img src="fb.png" class="fb"> RIGHT </a>
</li>
</ul>
</div>
</nav>
答案 0 :(得分:1)
您可以使用navbar-left/navar-right
类来定位您的链接和自定义类,以根据您需要的大小定位navbar-brand
。请参阅工作示例代码段。
.navbar-custom .navbar-brand.navbar-brand-centered {
position: absolute;
left: 50%;
display: block;
width: 200px;
text-align: center;
top: 0;
}
.navbar.navbar-custom > .container .navbar-brand.navbar-brand-centered,
.navbar.navbar-custom > .container-fluid .navbar-brand.navbar-brand-centered {
margin-left: -100px;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="navbar navbar-default navbar-custom" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#js-navbar-collapse"> <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div> <a class="navbar-brand navbar-brand-centered" href="#/">Brand</a>
<div class="collapse navbar-collapse" id="js-navbar-collapse">
<ul class="nav navbar-nav navbar-left">
<li><a href="#/">Link</a>
</li>
<li><a href="#">Link</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Link</a>
</li>
<li><a href="#">Link</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="well">Yup</div>
</div>
&#13;