allaboutsubha

How ro create menu bar

Sep 18th, 2025
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 3.20 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <title>Menu Bar design</title>
  5.         <link rel="stylesheet" href="style.css">
  6. <style>
  7. *{
  8.     padding: 0;
  9.     margin: 0;
  10. }
  11. a{
  12.     text-decoration: none;
  13. }
  14. body{
  15.     font-family:'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  16.     background-color: #f4f4f4;
  17.     padding: 30px;
  18. }
  19. h1{
  20.     text-align: center;
  21.     color: #333;
  22. }
  23. .navbar{
  24.     overflow: hidden;
  25.     background-color: #333;
  26.    
  27. }
  28. .navbar a{
  29.     float: left;
  30.     font-size: 16px;
  31.     color: #ffffff;
  32.     text-align: left;
  33.     padding: 14px 20px;
  34.     text-decoration: none;
  35. }
  36. .dropdown{
  37.     float: left;
  38.     overflow: hidden;
  39. }
  40. .dropdown .dropbtn{
  41.     font-size: 16px;
  42.     color: #ffffff;
  43.     border: none;
  44.     outline: none;
  45.     padding: 14px 20px;
  46.     background-color: transparent;
  47.     cursor: pointer;
  48.     font-weight: bold;
  49. }
  50. .dropdown-content{
  51.     display: none;
  52.     position: absolute;
  53.     background-color: #f9f9f9;
  54.     min-width: 212px;
  55.     z-index: 1;
  56. }
  57. .dropdown-content a{
  58.     float: none;
  59.     color: #ffffff;
  60.     padding: 12px 16px;
  61.     text-decoration: none;
  62.     display: block;
  63.     text-align: left;
  64.     background-color: #0a5f02;
  65. }
  66. .navbar a:hover, .dropdown:hover .dropbtn{
  67.     background: #1c8704;
  68. }
  69. .dropdown-content a:hover{
  70.      background: #1c8704;
  71. }
  72. .dropdown:hover .dropdown-content{
  73.     display: block;
  74. }
  75. </style>
  76.     </head>
  77.     <body>
  78.         <h1 class="mut">Menu Bar design</h1>
  79.  
  80.         <div class="navbar">
  81.             <a href="#">Home</a>
  82.             <a href="#">About Us</a>
  83.             <a href="#">Contact Us</a>
  84.  
  85.             <div class="dropdown">
  86.                 <button class="dropbtn">About Us Dropdown &#11163;</button>
  87.                
  88.                 <div class="dropdown-content">
  89.                     <a href="#">Director</a>
  90.                     <a href="#">Precident</a>
  91.                     <a href="#">Mission</a>
  92.                     <a href="#">Vision</a>
  93.                     <a href="#">Committee</a>
  94.                 </div>
  95.             </div>
  96.  
  97.             <div class="dropdown">
  98.                 <button class="dropbtn">Gallery &#11163;</button>
  99.                 <div class="dropdown-content">
  100.                     <a href="#">Photo Gallery</a>
  101.                     <a href="#">Video Gallery</a>
  102.                 </div>
  103.             </div>
  104.         </div>
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.        
  138.        
  139.             <style>
  140.                 .red-box{
  141.                     width: 150px;
  142.                     height: 150px;
  143.                     background-color: red;
  144.                     margin-top: 15px;
  145.                     z-index: 2;
  146.                     position: relative;
  147.                 }
  148.                 .green-box{
  149.                     width: 150px;
  150.                     height: 150px;
  151.                     background-color: green;
  152.                     margin-top: 15px;
  153.                     top: -150px;
  154.                     left: 20px;
  155.                     position: relative;
  156.                     z-index: 1;
  157.                 }
  158.             </style>
  159.  
  160.             <div class="red-box"></div>
  161.             <div class="green-box"></div>
  162.  
  163.  
  164.     </body>
  165. </html>
  166.  
  167.  
Advertisement
Add Comment
Please, Sign In to add comment