4
I am using Bootstrap on my site and I am making a bar with navbar.
The menu consists of a Brand, 3 "li" items, a search bar and a link.
How could I do so when using on smaller screens or even when resizing the browser, the search bar would not enter this "Collapse"?
Current code:
<nav class="navbar navbar-default navbar-fixed-top">
<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="#">Minha Empresa</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Item 3</a></li>
</ul>
<input type="text" id="OmniSearch" class="form-control" placeholder="Buscar..." />
<ul class="nav navbar-nav navbar-right">
<li><a href="#" class="navbar-link">Entrar / Cadastro</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
Reduced menu:
My doubt is how to make the search bar stay visible in "collapsed mode"?
Is there any anti-collapse class in Bootstrap?
Thank you.
You want to put her next to My Company when you’re at Ollapse ?
– Gabriel Rodrigues
something like this ? https://jsfiddle.net/filadown/uus86wxb/
– Gabriel Rodrigues
Maybe it is more practical to make 2 menus: one for desktop and another for mobile. Then use rules
@media
to hide them according to screen size.– Virtua Creative
That’s right @Gabrielrodrigues, thank you very much. I will study this code and I will implement it there. Thank you very much.
– Junior Zancan
@Juniorzancan since this is what you need I added the comment as an answer so that other people can know the possible solution
– Gabriel Rodrigues