css - dropdown menus stacking onto one another -


i need in displaying drop-down sub-menus correctly in website possible.

the sub-menus in drop-down menu stacking on 1 another.

i want sub-menus displayed vertically.

how fix this?

here code :

div#nav_menu-2{    	float: left!important;  }    div.menu-secondary-container{    	display: block;      background-color: #f3e6ff;  	background-size: cover;  	margin: 0px;  	padding: 0px;  	overflow: visible;  	position: static;  }    div#nav_menu-2 ul{      top: 0px;      margin: 0px;  }    div#nav_menu-2 ul li{     	list-style-type: none;  	/*position: relative;*/  	display: inline-block;  }    div#nav_menu-2 ul li a{    	display: block;  	padding: 14px 16px;  	text-align: center;  	line-height: 30px;  	text-decoration: none;  	font-size: 12pt;  	font-weight: bold;  	color: purple;  	text-transform: uppercase;  }    div#nav_menu-2 ul li a:hover{  	background-color: lightgray;  }    div#nav_menu-2 ul li a:active{  	background-color: hotpink;  }    div#nav_menu-2 ul li a:link{  	color: darkpurple;  }    div#nav_menu-2 ul li a:visited{  	color: lightpurple;  }    .active{  	background-color: dimgray;  }    div#nav_menu-2 ul li li{    	display:none;    	clear: both;    	overflow: auto;    	white-space: nowrap;  }    div#nav_menu-2 ul li:hover ul li{  	display: block;      position:absolute;       }    div#nav_menu-2 ul li li a{  	background-color: lightgray;  	padding: 14px 16px;  	min-width: 160px;  	display: block;  	text-align: center;  }
<div id="nav_menu-2" class="header-widget widget_nav_menu header-widget-1 header-widget-num-1">  <div class="menu-secondary-container">    <ul id="menu-secondary" class="menu">      <li id="menu-item-115" class="menu-item menu-item-     type-post_type menu-item-object-page menu-item-has-children menu-item-115">        <a href="http://localhost/careerdishanepal/services/">services</a>        <ul class="sub-menu">  	    <li id="menu-item-126" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-126">            <a href="http://localhost/careerdishanepal/background/">background</a></li>  	<li id="menu-item-129" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-129">        <a href="http://localhost/careerdishanepal/market-survey-reports/">market survey reports</a></li>  	<li id="menu-item-131" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-131">        <a href="http://localhost/careerdishanepal/behind-the-scene/">behind scene</a></li>  </ul>  </li>    <li id="menu-item-116" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-116">      <a href="http://localhost/careerdishanepal/about-us/">about us</a>  <ul class="sub-menu">  	<li id="menu-item-128" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-128">        <a href="http://localhost/careerdishanepal/goals-and-objectives/">goals , objectives</a></li>  	<li id="menu-item-130" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-130">        <a href="http://localhost/careerdishanepal/social-need-assessment-study/">social need assessment study</a></li>  </ul>  </li>  <li id="menu-item-117" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-117">    <a href="http://localhost/careerdishanepal/contact/">contact</a></li>  </ul>    </div>  </div>

you made mistake of hiding submenu <li> instead of submenu <ul>. other that, code working.

here fiddle: https://jsfiddle.net/rkwcty1u/

you notice on :hover shows <ul> instead of multiple <li>. submenu <ul> positioned absolute, parent <li> being position relative contains properly.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -