Reputation: 415
I am using the bootstrap3 navbar and I'm having this problem when I decrease the screen resolution:
You can see that because of the number of elements that the navbar has, when I decrease the screen resolution, the elements that are aligned to the right, are passed down.
I need to avoid that, that is, this:
should occur instead the problem I showed.
The navbar code:
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<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="#">Las Holass</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Hooola Holaaa!</a></li>
<li><a href="#">holahola</a></li>
<li><a href="#">Hooola hola!</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-hover" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Holita
<i class="glyphicon glyphicon-user white"></i>
</a>
<ul class="dropdown-menu">
<li><a id="login" href="#">Cerrar Sesión</a></li>
</ul>
</li>
<li><a href="#">Hooola Holas</a></li>
<li><a href="#">hoola holaaa</a></li>
</ul>
</div><!-- fin navbar-collapse -->
</div><!-- fin container-fluid -->
</nav>
Is there a way to define the width in pixels from which the toggle-navigation button will appear?
For example, between 0px and 890px.
Upvotes: 2
Views: 69
Reputation: 752
It's set up using media queries in the bootstrap.min.css file (or bootstrap.css file if you're not using the minified version).
if you look through the file, you'll see a lot of the nav stuff is wrapped in @media (min-width:768px){}
. I'd start with adjusting the pixels on the media query, or I'd take the nav stuff out of the media query and put it into my own stylesheet so I can adjust the media query accordingly and not affect anything else that may have been wrapped in the @media (min-width:768px){}
.
Upvotes: 0
Reputation: 996
change the navbar breakpoint from 1000px to the desired breakpoint, where you want navbar to collapse
@media (max-width: 991px) {
.navbar-header {
float: none;
}
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in{
display:block !important;
}
}
refernce https://stackoverflow.com/a/36289507/3615004
Upvotes: 0
Reputation: 2775
You can change this variable and make a custom version of Bootstrap for you, just go to the Bootstrap website. You need variable "@grid-float-breakpoint" at the "Grid system" section.
Upvotes: 1