Skip to content Skip to sidebar Skip to footer

Add A Border At The Bottom Of The Menu On Hover And Active

I'm trying to get this: But don't get it (lol) and having this instead: Don't know where to adjust the thing. Do you have any idea ? When i tried to fix it with the height it in

Solution 1:

Try to add this code:

.navbar-default .navbar-nav > li > a {
  line-height: 140px; /* = height of #menu */
  padding-bottom: 0;
  padding-top: 0;
}

Check the result:

@import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');

.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
  color: black;
  box-shadow: inset 0px -6px 0px #000; 

}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
  color: black;
  box-shadow: inset 0px -6px 0px #000; 
}

#menu {
  height: 140px;
}
.navbar-default .navbar-nav > li > a {
  line-height: 140px; /* = height of #menu */
  padding-bottom: 0;
  padding-top: 0;
}
<header>
  <nav class="navbar navbar-default" id="menu">
    <div class="container-fluid">
      <div class="row">
        <div class="col-md-3 col-sm-3">
          <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="index.html">
              <img alt="Brand" src="img/logo.png" height="100px;">
            </a>
          </div>
        </div>
        <div class="col-md-9 col-sm-9">
          <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav ">
              <li class="active"><a href="#">Accueil <span class="sr-only">(current)</span></a></li>
              <li><a href="#">Page 1</a></li>
              <li><a href="#">Page 2</a></li>
              <li><a href="#">Contact</a></li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </nav>
</header>

Post a Comment for "Add A Border At The Bottom Of The Menu On Hover And Active"