Forum Moderators: not2easy

Message Too Old, No Replies

fluid width dropdown menu

         

vinzzz

5:05 pm on Oct 4, 2004 (gmt 0)

10+ Year Member



Great, my first topic(start).

I was wondering how to create a menu with a variable width...


<html><head><title>test</title>
<style type="text/css">
ul {
padding: 0;
margin: 0;
list-style: none;
}

ul li {
position: relative;
float: left;
background: gray;
text-indent: 10px;
padding-right: 10px;
height:30px;
font-size: 15px;
line-height:30px;
}

ul ul {
display: none;
position: fixed;
top: 30px;
left: 0;
background: silver;
float: left;
border: 1px solid red;
} * html ul ul { position: absolute; }

li ul li {
padding:0;
background: silver;
display: block;
float: left;
clear:left;
}

ul li>ul {
top: auto;
left: auto;
}

ul li:hover ul, ul li.over ul {
display: block;
}

li:hover, li.over {
background: #FF9C00;
}

</style>
<script type="text/javascript"><!--//--><![CDATA[//><!--
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
window.onload=startList;

//--><!]]></script>
</head>

<body>

<ul id="nav">
<li>menu item 1
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ul>
</li>
<li>menu item 2
<ul>
<li class="sub">menu item 4, 5 en 6</li>
<li>menu item 5</li>
<li>menu item 6</li>
<li>menu item 7</li>
</ul>
</li>
<li>menu item 4</li>
<li>menu item 5</li>
</ul>

</body>
</html>


this is the code i have so far, just simple...IE does the thing how i WANT it, but seriously: i DONT code for IE :) my question? how to get proper code for FF...

The submenu has to expand or contract to the largest/smallest item within...

DrDoc

6:35 pm on Oct 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The submenu has to expand or contract to the largest/smallest item within...

It does... for me :)

vinzzz

8:33 pm on Oct 5, 2004 (gmt 0)

10+ Year Member



it does, but does it work? when you hover it, it hides...

vinzzz

9:12 pm on Oct 6, 2004 (gmt 0)

10+ Year Member



sorry to kick, but doesnt anyone have the answer? i actually begin to think it isnt possible css-only?

vinzzz

7:20 pm on Oct 11, 2004 (gmt 0)

10+ Year Member



srry to kick again, if no-one reacts this time, this topic can be closed. Does anyone know if this is possible?