twitter bootstrap - How to get nav-form on same line on mobile view -
i have navbar here looks way want on desktop.
http://www.bootply.com/it7srdkvia
however, on mobile, don't want search box on different line. want displays on same line. want search box appear right of calcs brand name.
how both navbar-brand , navbar-form both on same line in mobile view?
you're on right track need position css.
*i adjusted dropdown use class navbar-right
see docs.
see working example.
.navbar-custom .formsearch { width: 300px; float: left; padding-top: 8px; left: -65px; } @media (max-width: 767px) { .navbar-custom .formsearch { padding-left: 5px; width: 50%; left: -85px; } }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <nav class="navbar navbar-inverse navbar-custom" id="navbar"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#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 href="#" class="navbar-brand goto-home-page">calcs</a> <form class="formsearch" role="search"> <input type="text" class="form-control" placeholder="search calculator" id="txtcalcsearcher"> </form> </div> <!-- collect nav links, forms, , other content toggling --> <div class="collapse navbar-collapse" id="navbar-collapse-1"> <ul class="nav navbar-nav navbar-right"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">username <span class="caret"></span></a> <ul class="dropdown-menu"> <li> <a href="#" id="import">import</a> </li> <li> <a href="#" id="btnlogout">sign out</a> </li> </ul> </li> </ul> </div> </div> </nav>
Comments
Post a Comment