Centering a logo in a dropdown menu - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

Centering a logo in a dropdown menu

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  va2s  .  co  m-->
   border:2px solid Chartreuse;
   border-width:2px 0;
   list-style:none;
   margin:0;
   padding:0;
   text-align:center;
}

#nav li {
   position:relative;
   display:inline;
}

#nav a {
   display:inline-block;
   padding:11px;
}

#nav ul {
   top:21px;
   position:absolute;
   left:-10000px;
   margin:0;
   padding:0;
   text-align:left;
}

#nav ul li {
   display:block;
}

#nav li:hover ul {
   left:0;
}

#nav li:hover a {
   text-decoration:underline;
   background:yellow;
}

#nav li:hover ul a {
   text-decoration:none;
   background:none;
}

#nav li:hover ul a:hover {
   text-decoration:underline;
   background:blue;
}

#nav ul a {
   white-space:nowrap;
   display:block;
   border-bottom:2px solid pink;
}

a {
   color:OrangeRed;
   text-decoration:none;
   font-weight:bold;
}

a:hover {
   text-decoration:underline;
   background:grey;
}
</style> 
 </head> 
 <body> 
  <ul id="nav"> 
   <li> <a href="link1.html">Lorem ip</a> </li> 
   <li> <a href="#">Lorem ip</a> 
    <ul> 
     <li> <a href="link1.html">Lore</a> </li> 
     <li> <a href="link1.html">Lore</a> </li> 
    </ul> </li> 
   <li class="double-line"> <a href="index.php"> <img style="vertical-align:middle" src="https://www.java2s.com/style/demo/Safari.png" alt="logo"> </a> </li> 
   <li> <a href="link4.html">Lorem ipsu</a> </li> 
   <li> <a href="link5.html">Lore</a> </li> 
  </ul>  
 </body>
</html>

Related Tutorials