make my navigation menu responsive in css - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Nav Bar

Description

make my navigation menu responsive in css

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.nav<!--  ww  w .ja va  2s  . c o m-->
 {
   position:fixed;
   background:white;
   top:0;
   left:0;
   right:0;
   height:81px;
}

.nav>ul
 {
   margin:0  auto;
   max-width:1101px;
}

.nav ul li
 {
   margin-top:3em;
   float:left;
   text-transform:uppercase;
   list-style-type:none;
   font-family:Arial, "Helvetica Neue", Helvetica, sans-serif;
   font-size:14.3334px;
   font-style:normal;
   font-weight:401;
   margin-left:3px;
}

.nav li ul
 {
   background:pink;
   position:absolute;
   display:none;
   top:51px;
}

.nav li>ul li
 {
   position:relative;
   right:42px;
   margin:9px 0;
   width:341px;
}

.nav li:hover ul
 {
   display:block;
   height:auto;
   width:341px;
}

.logo
 {
   vertical-align:middle;
   margin-bottom:0.76em;
   float:left;
   width:149px;
   height:57px;
}

#searchbar {
   font-family:Arial, "Helvetica Neue", Helvetica, sans-serif;
   font-size:15.6668px;
   font-style:normal;
   padding:7px;
   font-weight:401;
   margin-left:51px;
   color:Chartreuse;
   width:221px;
   height:21px;
}

a
 {
   text-decoration:none;
}

.nav a:link {
   color:yellow;
   background-color:blue;
   padding:10px 14px;
}

.nav a:visited {
   color:pink;
}

.nav a:hover {
   color:OrangeRed;
   background-color:grey;
}

.nav li a:active {
   color:BlueViolet;
   background-color:Chartreuse;
}
</style> 
 </head> 
 <body> 
  <div class="nav"> 
   <ul> 
    <img class="logo" src="https://www.java2s.com/style/demo/Safari.png"> 
    <li> <a href>Lorem</a> </li> 
    <li> <a href>Lorem ipsu</a> 
     <ul> 
      <li> <a href="#">Lorem i</a> </li> 
      <li> <a href="#">Lorem ipsum dolor s</a> </li> 
      <li> <a href="#">Lorem ipsum dolor sit amet, c</a> </li> 
     </ul> </li> 
    <li> <a href>Lorem ips</a> 
     <ul> 
      <li> <a href="#">Lorem ipsum dolor</a> </li> 
      <li> <a href="#">Lorem ipsu</a> </li> 
      <li> <a href="#">Lorem ipsum do</a> </li> 
     </ul> </li> 
    <li> <a href>Lorem ipsu</a> </li> 
    <li> <a href>Lorem </a> </li> 
    <li> <a href>Lorem ipsum</a> </li> 
    <li> <input id="searchbar" type="text" name="search" placeholder="Search"> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials