[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

parent menu background colour

hi folks i have a drop down menu done in css "i could really learn to hate them" any way this is the url
http://www.nuvaring.aa9/patientsitemap

my problem is when i move my mouse onto one of the sub menu items the main menu background colour reverts back to the on on mouse out action.

the css im using is below

.menu {height:25px;  z-index:100;padding-left:10px; background-color:#ffe383;  }
#nav
{
      font-size:75%;
      height:25px;
      line-height:25px;
      width:730px;
      float:left;
      list-style: none;
}
#nav {
      padding: 0;
      margin: 0;

}
#nav a {
      display: block;
      /*width: 140px;*/
      color:#000;
      text-decoration:none;
      /*width:11em;*/
}
#nav a:hover
{
      color:#FFF;
      background-color:#FBBB37;
}
#nav li {
      float: left;
      width: 9em;
      padding-left:3px;
      width:140px;
}
#nav li a:hover
{
      color:#FFF;
      background-color:#FBBB37;
}
#nav li ul {
      position: absolute;
      width:128px;
      left: -999em;
      background-color:#FBBB37;
}
#nav li ul li {
      padding:6px;
      line-height:15px;
      margin-left:0px;
      width:128px;
      background-color:#FBBB37
}
/*
#nav li ul li a,#nav li ul li a:howver
{
      width:140px;
}
*/
#nav li:hover ul {
      left: auto;

}
#nav li:hover ul, #nav li.sfhover ul {
      left: auto;
}

any help really really aprieciated
0
andrew67
Asked:
andrew67
  • 5
  • 4
2 Solutions
 
zkeownCommented:
Your link isn't working, but what you are experiencing is default behavior. If you want the parent to maintain the "mouseover" aka :hover style while you're browsing the submenu, you'll need some custom javascript to go along with your CSS.
0
 
andrew67Author Commented:
your right the link is the wrong one this one works
http://nrd.anytimeafter9.co.uk/patientsitemap

however your answer isnt really what i wanted to hear

0
 
zkeownCommented:
*shrug* It's still the right one :) :hover is very basic.  You need more functionality than it provides.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
andrew67Author Commented:
any more clues than that???
0
 
zkeownCommented:
Actually...

ul#nav li:hover
{

}

Put your a:hover stuff in that.
0
 
andrew67Author Commented:
i have a function to get the drop downs to work in ie6 any idea how i can get the top menu bg to stay coloured in ie6???
0
 
andrew67Author Commented:
sorry this is the function
sfHover = function() {
      var sfEls = document.getElementById("nav").getElementsByTagName("LI");
      for (var i=0; i<sfEls.length; i++) {
            sfEls[i].onmouseover=function() {
                  this.className+=" sfhover";
            }
            sfEls[i].onmouseout=function() {
                  this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
            }
      }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

0
 
zkeownCommented:
Afraid I can't see a way to do it.  The parent li would need an explicit ID first, otherwise you'd be setting all the parents at the same time.  But I can't think of a way to walk up the tree... maybe I'm just tired.  I hope someone else sees this that can help.
0
 
David S.Commented:
Try this:

#nav a,
#nav li:hover li a
 {
	display: block;
	color:#000;
	text-decoration:none;
}
 
#nav a:hover,
#nav li:hover a
{
	color:#FFF;
	background-color:#FBBB37;
}

Open in new window

0
 
andrew67Author Commented:
hi all sorry for the delay getting back, ive actually found a really good solution here

http://www.cssplay.co.uk/menus/dd_valid.html

just use a different menu simpler and one that works

thanks for all your help
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now