4
我試圖讓搜索框位於我的Bootstrap導航欄的中心。刪除導航欄左側似乎會破壞導航欄上的對齊。我想要的東西就像linkedin.com頁面。最簡單的方法是什麼?
繼承人鏈接到我的導航欄的一個JSFiddle https://jsfiddle.net/b6pmy9w4/。預先感謝您的幫助。
HTML代碼:如何將Bootstrap導航欄中的表單元素(搜索框)居中?
<nav class="navbar navbar-default" style="border-radius: 0;">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed burger-button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand jura-font" href="/#!/">COLIGN</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<!-- <button type="submit" class="btn btn-default">Submit</button> -->
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="glyphicon glyphicon-comment"></span></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-user"></span></a>
<ul class="dropdown-menu">
<li><a href="#">View Profile</a></li>
<li><a href="#">Manage Account</a></li>
<li><a href="#">Invite a friend</a></li>
<li role="separator" class="divider"></li>
<li><a href="/auth/signout">Log out</a></li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
它似乎沒有設置顯示工作:塊,你認爲它可以,如果我不包括它? –
@DanielJacobson是啊對不起,這是愚蠢的我,表單有一個默認顯示塊不需要它。 – trebor