tic0

menu-dropdown

Aug 1st, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.35 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. ul {
  6.     list-style-type: none;
  7.     margin: 0;
  8.     padding: 0;
  9.     overflow: hidden;
  10.     background-color: #333;
  11. }
  12.  
  13. li {
  14.     float: left;
  15. }
  16.  
  17. li a, .dropbtn {
  18.     display: inline-block;
  19.     color: white;
  20.     text-align: center;
  21.     padding: 14px 16px;
  22.     text-decoration: none;
  23. }
  24.  
  25. li a:hover, .dropdown:hover .dropbtn {
  26.     background-color: red;
  27. }
  28.  
  29. li.dropdown {
  30.     display: inline-block;
  31. }
  32.  
  33. .dropdown-content {
  34.     display: none;
  35.     position: absolute;
  36.     background-color: #f9f9f9;
  37.     min-width: 160px;
  38.     box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  39. }
  40.  
  41. .dropdown-content a {
  42.     color: black;
  43.     padding: 12px 16px;
  44.     text-decoration: none;
  45.     display: block;
  46.     text-align: left;
  47. }
  48.  
  49. .dropdown-content a:hover {background-color: #f1f1f1}
  50.  
  51. .dropdown:hover .dropdown-content {
  52.     display: block;
  53. }
  54. </style>
  55. </head>
  56. <body>
  57.  
  58. <ul>
  59.   <li><a class="active" href="#home">Home</a></li>
  60.   <li><a href="#news">News</a></li>
  61.   <li class="dropdown">
  62.     <a href="#" class="dropbtn">Dropdown</a>
  63.     <div class="dropdown-content">
  64.       <a href="#">Link 1</a>
  65.       <a href="#">Link 2</a>
  66.       <a href="#">Link 3</a>
  67.     </div>
  68.   </li>
  69. </ul>
  70.  
  71. <h3>Dropdown Menu inside a Navigation Bar</h3>
  72. <p>Hover over the "Dropdown" link to see the dropdown menu.</p>
  73.  
  74. </body>
  75. </html>
Advertisement
Add Comment
Please, Sign In to add comment