CodePen

HTML

            
              <nav>
  <ul class="top-nav">
    <li class="active"><a href="#">Home</a></li>
    <li><a href="#">About</a>
      <ul class="sub-nav">
        <li><a href="#">Item 1</a></li>
        <li><a href="#">Item 2</a></li>
      <li><a href="#">Item 3</a></li>
      <li><a href="#">Item 4</a></li>
    </ul>
  </li>
  <li><a href="#">Clients</a>
    <ul class="sub-nav">
      <li><a href="#">Item 1</a></li>
      <li><a href="#">Item 2</a></li>
      <li><a href="#">Item 3</a></li>
      <li><a href="#">Item 4</a></li>
    </ul>
  </li>
  <li><a href="#">Contact Us</a></li>
</ul>
</nav>
<div class="content">
  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>  
</div>
            
          
!

CSS

            
              * {
  box-sizing:border-box;
  
}

nav, .content {
  max-width:960px;
  margin: 0 auto;
}

nav {
  margin-top:20px;
}

.top-nav {
  text-align:center;
  font-size:0;
}

.top-nav li {
  display:inline-block;
  width:25%;
  background: #292929;  
  position:relative;
}

.top-nav > li:hover,
.sub-nav > li:hover {
  color:white;
}

.top-nav > li.active > a {
  color:green;
}

.top-nav > li a {
  text-decoration:none;
  font-size:24px;
  line-height:1.5em;
  text-align:center;
  display:block;
  color:lightgrey;
}


.top-nav > li a {
  border-left: 1px solid black;
  border-right: 1px solid #3c3c3c;
  border-bottom: 1px solid black;
  border-top: 1px solid #3c3c3c;
}


.top-nav > li > a:hover,
.sub-nav > li > a:hover {
  color:red;
}

.sub-nav {
  position:absolute;
  width:100%;
  visibility:hidden;
  
}

.top-nav li:hover .sub-nav {
  visibility:visible;
  
}

.sub-nav > li {
  display:block;
  width:100%;
  position:relative;
}

.sub-nav > li a {
  border-bottom: 1px solid black;
  border-top: 1px solid #3c3c3c;
}
.sub-nav > li:first-child {
    border-top: none;
}
.sub-nav > li:last-child {
   border-bottom: none;
}

.content {
  height:250px;
  background:lightgrey;
  padding:10px;
}
            
          
!

JavaScript

            
              // When the anchor is clicked, the class of 'active' is added removed from the current active list item and added to the list item containing the clicked anchor //

$(function() {
    $('li a').click(function(e) {
        e.preventDefault();
        var $this = $(this);
        $this.closest('ul').children('li').removeClass('active');
        $this.parent().addClass('active');
    });
});


            
          
!
999px
Loading ..................