I try to make the "login section" stay on the right corner even when the toggle is expanded. I have try to float the section but it did not work.
Here is my code:
<nav class="navbar navbar-expand-lg bg-dark navbar-dark fixed-top">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#mymenu">
<span class="sr-only">toggle navigation</span>
<span class="navbar-toggler-icon"></span>
</button>
<a href="#" class="navbar-brand">App</a>
</div>
<div class="collapse navbar-collapse" id="mymenu">
<!-- nav body -->
<ul class="nav navbar-nav mr-auto">
<li class="active nav-item"><a class="nav-link" href="index.html">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#">Item 1</a></li>
<li class="nav-item"><a class="nav-link" href="#">Item 2</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle"
data-toggle="dropdown" role="button"
href="#">Item 3
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Item 3.1</a></li>
<li><a class="dropdown-item" href="#">Item 3.2</a></li>
<li><a class="dropdown-item" href="#">Item 3.3</a></li>
</ul>
</li>
</ul>
<!-------------------Search---------------------->
<form class="form-inline my-2 my-lg-0 position-relative">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-light my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
<!--------------------User---------------------->
<div class="ml-lg-5">
<a class="navbar-brand" href="#">Log In</a>
</div>
</div>
</nav>
Thanks for considering my request.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…