I have a navbar in which some of the navbar links always show, even in collapse mode. I am using Bootswatch's Paper theme: Bootswatch Paper Theme.
The content that continues to show is done by adding 'navbar'header' to a div and pulling it right, so the default styling is not applied to the links inside that.
I have applied some styles, but there are still a few issues.
I am not able to add anchor () tag to the links that always show (i.e. 'Show Link 1')
If I click on the Username dropdown and click and hold one of the menu links (i.e. Profile), then the color changes:
However, it should look similar to the default dropdown (on the left):
<div class="navbar-header navbar-right pull-right">
<ul class="nav pull-left">
<li class="navbar-text navbar-link pull-left navbar-always-show">Show Link 1</li>
<li class="navbar-text navbar-link pull-left navbar-always-show">Show Link 2</li>
<li class="dropdown pull-right">
<a href="#" data-toggle="dropdown" id="user-dropdown" class="dropdown-toggle">
User Name <span class="glyphicon glyphicon-user"></span>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li class="navbar-link">
<a href="/users/id" title="Profile">Profile</a>
</li>
<li>
<a href="/logout" title="Logout">Logout </a>
</li>
</ul>
</li>
</ul>
<button type="button" data-toggle="collapse" data-target=".navbar-collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
Here is a JSFiddle: JSFiddle
Is there a way to add to/modify the variable file so the default styling can be applied regardless of which Bootswatch theme is used, and/or even default Bootstrap theme?
If I am understanding your issues correctly:
Try to add the anchor tag before the <li>
<a href="#"><li class="navbar-text navbar-link pull-left
navbar-always-show">Show Link 1</li></a>
There are two things that you can do:
You can either add an extra class to ul
in the html and then add style to override the default css, or just override the default style for nav.
HTML
<ul class="nav pull-left nav-override">
CSS
.nav-override .open > a, .nav-override .open > a:hover, .nav-override .open > a:focus {
color: #ffffff!important;
background-color: #0c7cd5!important;
}
or
.nav .open > a, .nav .open > a:hover, .nav .open > a:focus {
color: #ffffff!important;
background-color: #0c7cd5!important;
}