No replies
kidda media
Offline
newbie
Last seen: 8 years 32 weeks ago
Timezone: GMT-7
Joined: 2011-03-30
Posts: 1
Points: 2

Hi There

I am mid design of a site and am using a centred menu with dropdowns in css.

All is working fine but I just cant get the parent items active / hover state to remain on hover of the dropdown menus???

Driving me nuts as am sure is relatively simple but damned if i can sort

Code as follows

<div id="centeredmenu">
   <ul>
      <li class="active"><a href="#" class="active">Home</a>
 
      </li>
      <li><a href="#">Hotel</a>
         <ul>
            <li><a href="#">GUESTS COMMENTS</a></li>
            <li><a href="#">TYPES OF ROOMS</a></li>
            <li><a href="#">SPECIAL OFFERS</a></li>
         </ul>
 
      </li>
      <li><a href="#">RESTAURANT & BAR</a>
         <ul>
            <li><a href="#">MENUS & OPENING HOURS</a></li>
            <li><a href="#">THE RESTUARANT</a></li>
            <li><a href="#">THE BAR</a></li>
 
            <li><a href="#">CURRENT OFFERS</a></li>
         </ul>
      </li>
      <li><a href="#">WEDDINGS</a>
         <ul>
            <li><a href="#">WEDDING PACKAGES</a></li>
            <li><a href="#">BRIDE & GROOM COMMENTS</a></li>
 
         </ul>
      </li>
       <li><a href="#">BUSINESS</a>
         <ul>
            <li><a href="#">FACILITIES ON OFFER</a></li>
            <li><a href="#">PRIVATE BUSINESS LUNCHES</a></li>
            <li><a href="#">BUSINESS PACKAGE</a></li>
 
         </ul>
       <li><a href="#">Occasions</a>
                <ul>
            <li><a href="#">FUNERALS</a></li>
         </ul>
</li>
       <li><a href="#">NEWS & EVENTS</a></li>
 
       <li><a href="#">LOCAL AREA</a>
                <ul>
            <li><a href="#">LOCAL FILM LOCATIONS</a></li>
            <li><a href="#">LOCAL ATTRACTIONS</a></li>
            <li><a href="#">BUSINESS PACKAGE</a></li>
         </ul>
</li>
 
       <li><a href="#">OFFERS</a></li>
       <li><a href="#">CONTACT</a>
                <ul>
            <li><a href="#">CAREERS</a></li>
            <li><a href="#">REGISTER</a></li>
         </ul>
</li>
 
 </ul>
</div>

/* Main menu settings */
#centeredmenu {
   clear:both;
   float:left;
   margin:0;
   padding:0;
   width:100%;
   z-index:1000; /* This makes the dropdown menus appear above the page content below */
   position:relative;
}
 
/* Top menu items */
#centeredmenu ul {
   margin:0;
   padding:0;
   list-style:none;
   float:right;
   position:relative;
   right:50%;
}
#centeredmenu ul li {
   margin:0 0 0 1px;
   padding:0;
   float:left;
   position:relative;
   left:50%;
   top:1px;
}
#centeredmenu ul li a {
   display:block;
   margin:0 0 0 1px;
   padding:22px 8px 0 8px;
   color:#9ca2ad;
   text-decoration:none;
   text-transform:uppercase;
   font-size:12px;
   font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
 
}
 
#centeredmenu .active a,
#centeredmenu ul li a.active:hover {
	 background:url(../images/homemenuitem.jpg) no-repeat top center;
   color:#fafaf6;
   font-weight:bold;
}
 
#centeredmenu ul li a:hover {
   /*background:#36f;  Top menu items background colour */
   color:#fff;
	 background:url(../images/homemenuitem.jpg) no-repeat top center;
}
#centeredmenu ul li:hover a,
#centeredmenu ul li.hover a { /* This line is required for IE 6 and below */
   /*background:#36f;  Top menu items background colour */
   color:#fff;
 
}
 
/* Submenu items */
#centeredmenu ul ul {
   display:none; /* Sub menus are hiden by default */
   position:absolute;
   top:30px;
   left:0;
   right:auto; /*resets the right:50% on the parent ul */
   margin-top:8px;
   border-top:2px groove #fff;
   white-space:nowrap;
}
#centeredmenu ul ul li {
   left:auto;  /*resets the left:50% on the parent li */
   margin:0; /* Reset the 1px margin from the top menu */
   clear:left;
   width:100%;
   background: url(../images/submenu_bg.png) repeat;
 
}
#centeredmenu ul ul li a,
#centeredmenu ul li.active li a,
#centeredmenu ul li:hover ul li a,
#centeredmenu ul li.hover ul li a { /* This line is required for IE 6 and below */
   font-size:.9em;
   font-weight:normal; /* resets the bold set for the top level menu items */
   background: none ;
   color:#ccd1df;
   line-height:1.4em; /* overwrite line-height value from top menu */
   text-transform:none;
   padding:5px 40px 5px 5px;
}
#centeredmenu ul ul li a:hover,
#centeredmenu ul li.active ul li a:hover,
#centeredmenu ul li:hover ul li a:hover,
#centeredmenu ul li.hover ul li a:hover { /* This line is required for IE 6 and below */
/* Sub menu items background colour */
   color:#fff;
   text-transform:none;
   background:url(../images/homemenuitem.jpg) center right no-repeat;
}
 
/* Flip the last submenu so it stays within the page */
#centeredmenu ul ul.last {
   left:auto; /* reset left:0; value */
   right:0; /* Set right value instead */
}
 
/* Make the sub menus appear on hover */
#centeredmenu ul li:hover ul,
#centeredmenu ul li.hover ul { /* This line is required for IE 6 and below */
   display:block; /* Show the sub menus */
}

Any help MASSIVELY appreciated as am happy with the menu aside from this issue!!

Cheers in advance

Thanks

John