<html>
  <body>
    <div class="nav-container">
      <ul class="nav-items">
        <!-- Navigation -->
        <li class="nav-item"><a href="#">Home</a></li>
        <li class="nav-item"><a href="#">About</a></li>
        <li class="nav-item"><a href="#">Contact</a></li>
        <!-- Dropdown menu -->
        <li class="nav-item nav-item-dropdown">
          <a class="dropdown-trigger" href="#">Settings</a>
          <ul class="dropdown-menu">
            <li class="dropdown-menu-item">
              <a href="#">Dropdown Item 1</a>
            </li>
            <li class="dropdown-menu-item">
              <a href="#">Dropdown Item 2</a>
            </li>
            <li class="dropdown-menu-item">
              <a href="#">Dropdown Item 3</a>
            </li>
          </ul>
        </li>
      </ul>
    </div>
  </body>
</html>
//Setting up the pen
html,
body {
  background-color: #363642;
  color: #2D2D36;
  padding: 4rem;
}

.nav-container {
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 2px 0 rgba(153,153,153,0.35);
  padding: 1em;
  border: 1px solid #eee;
  display: block;
  max-width: 400px;
  margin: 0 auto;
  text-align: center;
}

ul,
li {
  list-style: none;
  -webkit-padding-start: 0;
}

a {
  text-decoration: none;
  color: #ED3E44;
}

//Navigation menu
.nav-item {
  padding: 1em;
  display: inline;
}

//Dropdown menu
.nav-item-dropdown {
  position: relative;
  
  &:hover > .dropdown-menu {
    display: block;
    opacity: 1;
  }
}

.dropdown-trigger {
  position: relative;
  
  &:focus + .dropdown-menu {
    display: block;
    opacity: 1;
  }
  
  &::after {
    content: "›";
    position: absolute;
    color: #ED3E44;
    font-size: 24px;
    font-weight: bold;
    transform: rotate(90deg);
    top: -5px;
    right: -15px;
  }
}

.dropdown-menu {
  background-color: #ED3E44;
  display: inline-block;
  text-align: right;
  position: absolute;
  top: 2.5rem;
  right: -10px;
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease; 
  width: 160px;

  a {
    color: #fff;
  }
}

.dropdown-menu-item {
  cursor: pointer;
  padding: 1em;
  text-align: center;
  
  &:hover {
    background-color: darken(#ED3E44, 5%);
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.