is there a way to disable the responsive navBar in bootstrap 4? I don't want the dropdown as in the mobile version it's still possible to see the 2 links next to the brand. As a plus, I'd like to know if it's possible to put the links to the right in the bar. Pull-xs-right doesn't seem to work correctly.
My current code looks like this:
<nav class="navbar navbar-fixed-top navbar-toggleable-sm navbar-light bg-faded">
<a href="/" class="navbar-brand">PIM</a>
<ul class="nav navbar-nav pull-xs-right">
<li class="nav-item"><Link class="nav-link" to="/login">Login</Link></li>
<li class="nav-item"><Link class="nav-link" to="/signup">Sign up</Link></li>
</ul>
</nav>
Thanks very much in advance.
The simplest way is using the
navbar-toggleable-xl
navbar-expand
class (now in Bootstrap 4) so that the menu is non-mobile (horizontal) at all widths..Demo: Bootstrap 4 Disable Responsive Navbar
You can also use the
flexbox
utilities to prevent the vertical navbar on smaller screens. Theflex-nowrap flex-row
allow the navbar to remain horizontal at all widths...How it works:
navbar-expand
-- always horizontal, non collapsingnavbar-expand-xl
-- collapses into mobile < 1200pxnavbar-expand-lg
-- collapses into mobile < 992pxnavbar-expand-md
-- collapses into mobile < 768pxnavbar-expand-sm
-- collapses into mobile < 576pxno
navbar-expand
-- always mobile,collapsed (default)http://www.codeply.com/go/z9VJTOBuaS
I'd suggest using just a nav, but if you need the styling of the navbar you can get around it by adding the helper classes and removing some to get it to function as you want. This should display the link items on mobile without the toggle button dropdown functionality.
<nav class="navbar navbar-fixed-top navbar-toggleable-sm navbar-light bg-faded"> <a href="/" class="navbar-brand">PIM</a> <div id="navbarNav" class="navbar-collapse"> <ul class="navbar-nav"> <li class="nav-item"> <Link class="nav-link" to="/login"> Login </Link> </li> <li class="nav-item"> <Link class="nav-link" to="/signup"> Sign up </Link> </li> </ul> </div> </nav>
JSFIDDLE for reference.