我想將登錄按鈕與設置圖標沿着來自導航欄的鏈接上方的一條線對齊。導航欄內的subnavbars html css
我該如何做到這一點?
這裏,說明正是我的問題小提琴:
和我寫的代碼:
<body>
<div>
<header>
</header>
<nav class="navbar navbar-default">
<div class="container-fluid pull-right" id="nav_login">
<ul class="nav navbar-nav">
<li>
<a href="#">Login</a>
</li>
<li>
<i id="settings_icon" class="fa fa-cog" aria-hidden="true"></i>
</li>
</ul>
</div>
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" 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" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li>
<a id="nav_processes" href="#">Processes</a>
</li>
<li>
<a id="nav_reports" href="#">Reports</a>
</li>
<li>
<a id="nav_alerts" href="#">Alerts</a>
</li>
<li>
<a id="nav_scheduler" href="#">Scheduler</a>
</li>
<li>
<a id="nav_admin" href="#">Admin</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
<div class="container-fluid" id="hidden_container">
<div id="processes_subnav" style="display: none;">
<ul class="nav navbar-nav">
<li>
<a href="#">Details</a>
</li>
<li>
<a href="#">Create</a>
</li>
</ul>
</div>
<div id="reports_subnav" style="display: none;">
<ul class="nav navbar-nav">
<li>
<a href="#">Details</a>
</li>
<li>
<a href="#">Assistance</a>
</li>
</ul>
</div>
</div>
</nav>
<div>
</div>
<footer></footer>
</div>
CSS:
* {
font-family: 'Source Sans Pro', sans-serif;
}
.navbar-default .navbar-nav > li > a {
color: white;
}
.navbar-default {
background-color: black;
border-color: black;
}
.navbar-default .navbar-nav > li > a:focus,
.navbar-default .navbar-nav > li > a:hover {
color: white;
}
.navbar-default .navbar-nav > li > a {
outline: none;
}
#nav_login {
height: 10px;
font-size: 10px;
}
#settings_icon {
color: white;
font-size: 1.5em;
}
編輯:
對不起,也許我沒有解釋自己很好,但我想登錄是旁邊的設置圖標它最初是(在右上角)
所以登錄和設置應了一下位置比其他所有環節上? –
我很混淆你想達到的目標。嗯。也許創建一個img。我們都回答相同的輸出。 –
@SyamPillai確切! – laker001