Horizontal CSS menus help
Posted: 16 October 2008 06:44 PM   [ Ignore ]
Newbie
Rank
Total Posts:  8
Joined  2008-10-03

Hi,

Following is the css for my horizontal menu,but when i am increasing the text the red hovering is not complete,......plzz help regarding this issue.

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<head>
<title>Horizontal Drop Down Menus</title>
<meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859-1” />
<!—//—><![CDATA[/><!—

sfHover = function() {
  var sfEls = document.getElementById(“nav”).getElementsByTagName(“LI”);
  for (var i=0; i<sfEls.length; i++) {
      sfEls.onmouseover=function() {
        this.className+=” over”;
      }
      sfEls.onmouseout=function() {
        this.className=this.className.replace(new RegExp(” over\\b”), “”);
      }
  }
}
if (window.attachEvent) window.attachEvent(“onload”, sfHover);

//—><!]]>
<style type=“text/css”>
body {
  font: normal 11px verdana;
  }

ul {
  margin: 0;
  padding: 0;
  list-style: none;

  }

ul li {
  position: relative;
  float: left;
  width:auto;
  background:#a9a9a9;
 
}
 
li ul {
  position: absolute;
  left: 0; /* Set 1px less than menu width */
  top: auto;
  display: none;
  }
li ul ul{
  position: absolute;
  left:100%; /* Set 1px less than menu width */
  top: -.1em;
  display: none;
  }

  ul li a first-child
  {
  width:177px;
  }

/* Styles for Menu Items */
ul li a {
  display: block;
  text-decoration: none;
  color: #777;
  background: #fff; /* IE6 Bug */
  padding: 5px; 
  white-space:nowrap;
  min-width:100px;
  max-width:40ex;
  }
/* commented backslash mac hiding hack \*/
* html ul li a {height:1%}
/* end hack */

/* this sets all hovered lists to red */
li:hover a, li.over a,
li:hover li:hover a, li.over li.over a,
li:hover li:hover li:hover a, li.over li.over li.over a,
li:hover li a:hover, li.over li a:hover,
li:hover li:hover li:hover a:hover, li.over li li a:hover,
li:hover li:hover li:hover li:hover a:hover, li.over li.over li.over li.over a:hover
{
  color: #fff;
  background-color: red;
}

/* set dropdown to default */
li:hover li a, li.over li a,
li:hover li:hover li a, li.over li.over li a,
li:hover li:hover li:hover li a, li.over li.over li.over li a
{
  color: #777;
  background-color: #fff;
}
li ul li a { padding: 2px 5px; } /* Sub Menu Styles */
ul li:hover ul ul, ul li:hover ul ul ul, ul li.over ul ul, ul li.over ul ul ul {
display:none;
}

ul li:hover ul,ul li li:hover ul,ul li li li:hover ul, ul li.over ul, ul li li.over ul,ul li li li.over ul {
  display: block;
  background:#f1f1f1;
  border: 1px solid #a9a9a9;
}

</style>
</head>
<body>
<ul id=“nav”>
  <li>genericHome</li>
 
  <li>genericHome2
  <ul>

    <li>subitema
    <ul>
      <li>test 1</li>
      <li>test 2</li>
      <li>test 3</li></ul>
  </li>
    <li>subitemb<ul>
   
      <li>test 4</li>
      <li>test 5fddfdgfdgddfgfdgfdgfdgfdg</li>
      </ul>
    </li>
   
  </ul>
  </li>
<li>genericHome3
<ul>
<li>aubitema1</li>
</ul>
</li>
</ul>
</body>
</html>

Profile
 
 
Posted: 27 October 2008 03:17 PM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  2
Joined  2008-10-27

This doesn’t work correctly in FF3. Rather than troubleshooting this, it would probably be a better idea to use the suckerfish menus (scroll to bottom for examples) for whatever you might be doing—it looks like you’re trying to recreate exactly what they are anyway…unless you’re just a glutton for punishment. ;)

Profile