Get Nav Bar with dropdown menu to Stretch 100% - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

Get Nav Bar with dropdown menu to Stretch 100%

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <style>
body {<!--   w w  w  . jav a  2s .c  om-->
   margin:0px;
   padding:0px;
}

header {
   height:106px;
   background-color:Chartreuse;
   text-align:center;
}

header img {
   display:inline-block;
   margin:0 auto;
}

nav {
   width:100%;
   background-color:yellow;
}

nav ul {
   padding:0;
   list-style:none;
   position:relative;
   display:block;
   font-size:0;
}

nav ul li {
   list-style:none;
   background-color:blue;
   border-bottom:solid pink;
   display:inline-block
}

nav ul li a {
   display:block;
   padding:16px 11px;
   color:OrangeRed;
   font-size:16px;
   text-decoration:none;
   font-family:'Bree Serif', 'serif';
}

li a:hover {
   background-color:grey;
   text-decoration:none;
}

nav ul ul {
   display:none;
   position:absolute;
   top:51px;
}

nav ul li:hover>ul {
   display:list-item;
}

nav ul ul li {
   width:171px;
   float:none;
   position:relative;
   border-bottom:none;
   display:block;
}
</style> 
 </head> 
 <body> 
  <header> 
   <a href="index.html"> <img src="https://www.java2s.com/style/demo/Safari.png"> </a> 
  </header> 
  <nav> 
   <ul> 
    <li> <a href="#">Lore</a> </li> 
    <li> <a href="#">Lorem</a> 
     <!-- First Tier Drop Down --> 
     <ul> 
      <li> <a href="#">Lorem i</a> </li> 
      <li> <a href="#">Lorem ip</a> </li> 
     </ul> </li> 
    <li> <a href="#">Lorem ipsum </a> 
     <!-- First Tier Drop Down --> 
     <ul> 
      <li> <a href="#">Lorem ipsum</a> </li> 
      <li> <a href="#">Lorem ips</a> </li> 
      <li> <a href="#">Lorem ipsum dolor</a> 
       <!-- Second Tier Drop Down --> </li> 
     </ul> </li> 
    <li> <a href="#">Lorem ipsu</a> </li> 
    <li> <a href="#">Lorem </a> </li> 
    <li> <a href="#">Lorem i</a> </li> 
   </ul> 
  </nav>  
 </body>
</html>

Related Tutorials