create a dropdown menu on the left of parent - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

create a dropdown menu on the left of parent

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">
.stato {<!--  w  w  w  .j a  v  a 2 s .  c  o m-->
   display:none;
   transition:all ease .4s;
}

.dropdown:hover .stato {
   display:block;
   position:absolute;
   left:151px;
   top:93px;
}

a {
   color:Chartreuse;
}

body {
   color:yellow;
   background:blue;
}

.block {
   background-color:pink;
   border:2px solid OrangeRed;
   border-radius:0 11px 11px 0;
   font-size:2.46em;
   margin-left:6px;
   padding:16px 21px;
   width:151px;
   position:relative;
}

h2 {
   font-size:2.72em;
   line-height:2.3;
   margin:0 0 11px;
   padding-bottom:9px;
   padding-left:16px;
   font-weight:inherit;
}

#block-system-main-menu {
   padding-bottom:0;
   padding-left:0;
   padding-right:0;
}

.block .content {
   font-size:0.95em;
   line-height:2.5;
}

.content {
   margin-top:11px;
}

.clearfix::after {
   clear:both;
   content:".";
   display:block;
   height:0;
   visibility:hidden;
}

.block ul {
   margin:0;
   padding:0 0 0.26em 0;
}

ul.menu {
   border:0 none;
   list-style:outside none none;
   text-align:left;
}

ul li.leaf {
   letter-spacing:0.3em;
   align-items:center;
   background:grey;
   border-top:2px solid BlueViolet;
   display:flex;
   font-size:16px;
   list-style-type:none;
   padding-bottom:9px;
   padding-top:9px;
   padding-left:16px;
}

.sotto {
   letter-spacing:0.3em;
   align-items:center;
   background:Chartreuse;
   border-top:2px solid yellow;
   display:flex;
   font-size:16px;
   list-style-type:none;
   padding-bottom:9px;
   padding-top:9px;
   padding-left:16px;
   padding-right:16px;
}

li:hover.leaf {
   background:blue;
}
</style> 
 </head> 
 <body> 
  <div class="block block-system block-menu" id="block-system-main-menu"> 
   <h2>Lore</h2> 
   <div class="content"> 
    <ul class="menu clearfix"> 
     <li class="first leaf"> <a title="" href="#">Lore</a> </li> 
     <li class="leaf dropdown"> <a href="#">Lorem </a> 
      <ul class="stato"> 
       <li class="sotto"> <a href="#">Lore</a> </li> 
       <li class="sotto"> <a href="#">Lorem i</a> </li> 
      </ul> </li> 
     <li class="leaf"> <a title="" href="#">Lorem i</a> </li> 
     <li class="last leaf"> <a href="#">Lore</a> </li> 
    </ul> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials