Greetings All,
I putting a vertical dropdown menu on my site using CSS and an unordered list (<ul> & <li>) which works fine in IE but not in Firefox.
Here's the code:
And the menu:
Is there a setting I can add to make it work in both browsers?
Thanks,
Keith
I putting a vertical dropdown menu on my site using CSS and an unordered list (<ul> & <li>) which works fine in IE but not in Firefox.
Here's the code:
Code:
<style type="text/css">
body {
font-family: arial, helvetica, serif;
}
#nav, #nav ul { /* all lists */
padding: 0;
margin: 0;
list-style: none;
float : left;
width : 11em;
}
#nav li { /* all list items */
position : relative;
float : left;
line-height : 1.25em;
margin-bottom : -1px;
width: 11em;
}
#nav li ul { /* second-level lists */
position : absolute;
left: -999em;
margin-left : 12.00em; {/* second menu offset */
margin-top : -1.35em;
}
#nav li ul ul { /* third-and-above-level lists */
left: -999em;
}
#nav li a {
width: 11em;
w\idth : 12em; {/* menu width */
display : block;
color : white;
font-weight : bold;
text-decoration : none;
background-color : #0033ff;
border : 1px solid black;
padding : 0 0.5em;
}
#nav li a:hover {
color : white;
background-color : #0033cc;
}
#nav li:hover ul ul, #nav li:hover ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover
ul ul ul {
left: -999em;
}
#nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li.sfhover ul,
#nav li
li.sfhover ul, #nav li li li.sfhover ul { /* lists nested under hovered list items */
left: auto;
}
#content {
margin-left : 12em;
}
</style>
<script type="text/javascript"><!--//--><![CDATA[//><!--
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);
</script>
And the menu:
Code:
<ul id="nav">
<li><a href="#">Home</a>
</li>
<ul /dropdown>
<li><a href="#">Sub Item One</a></li>
<li><a href="#">Sub Item Two</a></li>
</ul>
<li><a href="#">Item One</a>
</li>
<ul /dropdown>
<li><a href="#">Sub Item One</a></li>
<li><a href="#">Sub Item Two</a></li>
</ul>
<li><a href="#">Item Two</a>
</li>
<ul /dropdown>
<li><a href="#">Sub Item One</a></li>
<li><a href="#">Sub Item Two</a></li>
</ul>
<li><a href="#">Item Three</a>
</li>
<ul /dropdown>
<li><a href="#">Sub Item One</a></li>
<li><a href="#">Sub Item Two</a></li>
</ul>
</ul>
Is there a setting I can add to make it work in both browsers?
Thanks,
Keith