Edit This Code:
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../lib/w3.css">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
<body class="w3-container">

<h2>Navigation Bar with Dropdown</h2>
<p>Add a dropdown menu inside the navigation bar:</p>

<ul class="w3-navbar w3-card-2 w3-light-grey">
  <li><a href="tryit.asp-filename=tryw3css_dropdown_menu2.html#">Home</a></li>
  <li><a href="tryit.asp-filename=tryw3css_dropdown_menu2.html#">Link 1</a></li>
  <li class="w3-dropdown-hover">
    <a href="tryit.asp-filename=tryw3css_dropdown_menu2.html#">Dropdown <i class="fa fa-caret-down"></i></a>
    <div class="w3-dropdown-content w3-white w3-card-4">
      <a href="tryit.asp-filename=tryw3css_dropdown_menu2.html#">Link 1</a>
      <a href="tryit.asp-filename=tryw3css_dropdown_menu2.html#">Link 2</a>
      <a href="tryit.asp-filename=tryw3css_dropdown_menu2.html#">Link 3</a>
    </div>
  </li>
</ul>

<p>Tip: You will learn more about navigation bars in a later chapter.</p>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy