I'm using twitter bootstrap on my site and when I collapse the window partially, this happens! If I collapse the window further, then the desired button appears and the links disappear.
Q) Why is this happening? I want the nav links to collapse at this window width, leaving the button. Nav code below:
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<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="/" style="font-size: 24px;">My brand name</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li class="<%= GetCssClassNavItemHome() %>"><a href="/">Home</a></li>
<li class="<%= GetCssClassNavItem("/about") %>"><a href="/about">About</a></li>
<li class="<%= GetCssClassNavItem("/services") %>"><a href="/services">Services</a></li>
<li class="<%= GetCssClassNavItem("/project") %>"><a href="/projects">Projects</a></li>
<li class="<%= GetCssClassNavItem("/prices") %>"><a href="/prices">Prices</a></li>
<li class="<%= GetCssClassNavItem("/blog") %>"><a href="/blog">Blog</a></li>
<li class="<%= GetCssClassNavItem("/contact") %>"><a href="/contact">Contact</a></li>
</ul>
<ul class="nav navbar-nav navbar-right nav-pills">
<li>
<a target="_blank" href="http://www.linkedin.com/">
<i class="fa fa-linkedin fa-2x"></i>
</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
The problem is the padding applied in the class .container
- 15px both left and right. If you reduce the padding, the problem goes away.
If you add another class to the div.container
- in this example, say lesspadding
:
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container lesspadding">
etc.
and then apply different padding to the new class, like so:
.lesspadding {
padding-left: 10px;
padding-right: 2px;
}