Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

style nav-pills in navbar

I am not sure if correct but using bootstrap nav-pills in a navbar does not work as the nav takes priority in the bootstrap.css. If correct then are we not suppose to use these nav styles in the navbar ?

Line 4094 .nav-pills > .active > a, .nav-pills > .active > a:hover, .nav-pills > .active > a:focus { color: #ffffff; background-color: #0088cc; }

line 4623

 .navbar .nav > .active > a,
    .navbar .nav > .active > a:hover,
    .navbar .nav > .active > a:focus {
      color: #555555;
      text-decoration: none;
      background-color: #e5e5e5;
      -webkit-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
         -moz-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
              box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
    }
like image 719
user1614384 Avatar asked Feb 25 '13 13:02

user1614384


People also ask

How will you create a tabbed pills and vertical pills navigation menu in Bootstrap?

To make the tabs toggleable, add the data-toggle="tab" attribute to each link. Then add a . tab-pane class with a unique ID for every tab and wrap them inside a <div> element with class . tab-content .

What are navigation pills?

Pills are quasi-navigation components which can highly improve website clarity and increase user experience. Note: Read the API tab to find all available options and advanced customization.

How do I align navbar items to the right in Bootstrap 4?

ml-auto class in Bootstrap can be used to align navbar items to the right. The . ml-auto class automatically aligns elements to the right.


1 Answers

You can use it in following way :
Jsfiddle with navbar and navpills

 .navbar .nav-pills >li >a {
    color: #005580;
 }
   .navbar .nav-pills > li > a:hover {
      background-color: #0088cc;
 }
 .navbar .nav-pills .active > a {
    background-color:#ccc;
    color:#0088cc;
}

<div class="navbar">
<div class="navbar-inner">
<a data-toggle="collapse" data-target=".nav-collapse" class="btn btn-navbar">
  <i class="icon-bar"></i>
  </a>

    <a class="brand" href="">New Icon Menu</a>

    <div class="nav-collapse">
        <ul class="nav nav-pills pull-right">
            <li><a href=""><i class="icon-home icon-2x"></i> Home<br></a>
            </li>
            <li><a href=""><i class=" icon-pencil icon-2x"></i>About Us</a>
            </li>
            <li><a href=""><i class=" icon-briefcase icon-2x"></i>Portfolio</a>
            </li>
            <li><a href=""><i class=" icon-envelope icon-2x"></i>Contact Us</a>
            </li>
        </ul>
         </div>
       </div>
     </div>
like image 187
Shail Avatar answered Sep 20 '22 02:09

Shail