Hi, now a code to be easy make your css drop down menu.
Long time ago i'm finding a perfetc css menu drop down code.
I want a dropdown css menu easy to copy/paste, fast and no difficult configurations.
Just set width, color, bg and ready. Working in FF, IE6/7 an Opera.
Yesterday i post the final part that my code need (activating hover in IE6).
See the online example (and source code) of Ultimate Micox Menu Drop Down CSS - 4 levels.
The codes:
First, make your old UL e LI menu.
<ul>
<li>class='menu-hv'</li>
<li><a href='#'>2</a></li>
<li><a href='#'>3...</a>
<ul style='background-color: red; '>
<li>31</li>
<li><a href='#'>32</a></li>
<li>33</li>
</ul>
</li>
<li><a href='#'>4...</a>
<ul>
<li>41</li>
<li><a href='#'>42</a></li>
<li><a href='#'>43...</a>
<ul style='background-color: blue'>
<li>431</li>
<li><a href='#'>432...</a>
<ul style='background-color: gray'>
<li>4321</li>
<li><a href='#'>4322</a></li>
</ul>
</li>
</ul>
</li>
<li>44</li>
</ul>
</li>
</ul>
Second, put the class 'menu-hv' in your UL (or in parent div of UL) to activate horizontal-vertical menu. To vertical-vertical menu the class name is 'menu-vv'.
<ul class='menu-hv'>
Finally, put the code of Ultimate Micox Menu drop-down CSS (UMMDDCSS heheheh) in your CSS code or file. You can edit font, color, width, etc of menu itens in indicated place of my code.
/*
Menus drop-down horizontal-vertical (hv) e vertical-vertical (vv) 4 levels
by Micox - elmicoxcodes.blogspot.com - Ver. 2.0 - 20/02/08 - Creative Commons License
*/
.menu-hv, .menu-vv { position: relative; margin: 0; padding: 0; display: block; zoom: 1;}
.menu-hv * , .menu-vv * { margin: 0; padding: 0 ; list-style: none}
.menu-hv li , .menu-vv li { position: relative; line-height: 1.2em; vertical-align: top }
.menu-hv a , .menu-vv a { display: block; zoom: 1; line-height: 1.2em }
.menu-hv li ul, .menu-vv li ul { position: absolute; visibility: hidden }
.menu-hv li:hover ul, .menu-vv li:hover ul,
.menu-hv li.hover ul, .menu-vv li.hover ul { visibility: visible }
.menu-hv li:hover ul ul, .menu-vv li:hover ul ul,
.menu-hv li.hover ul ul, .menu-vv li.hover ul ul { visibility: hidden }
.menu-hv li li:hover ul, .menu-vv li li:hover ul,
.menu-hv li li.hover ul, .menu-vv li li.hover ul { visibility: visible }
.menu-hv li li:hover ul ul, .menu-vv li li:hover ul ul,
.menu-hv li li.hover ul ul, .menu-vv li li.hover ul ul { visibility: hidden }
.menu-hv li li li:hover ul, .menu-vv li li li:hover ul,
.menu-hv li li li.hover ul, .menu-vv li li li.hover ul { visibility: visible }
/* horizontal-vertical */
.menu-hv:after, .menu-hv.after { content: "."; line-height: 0px; clear: both; display: block; visibility: hidden}
.menu-hv li { float: left; }
.menu-hv li ul li { float: none; }
.menu-hv li ul li ul { position: absolute; left: 100%; top: 0; }
/* vertical-vertical */
.menu-vv { float: left; }
.menu-vv li ul { left: 100%; top: 0; }
/* ****************************************
Define width, color, bg, etc ABOVE or clear this line if will define in other place
*/
.menu-hv li { width: 100px; background-color: yellow }
.menu-vv li { width: 100px; background-color: yellow }
.menu-hv li a:hover { background-color: cyan }
.menu-vv li a:hover { background-color: cyan }
/* Micox Pseudo-class-css2 to IE (MXPC). Activate .hover and .first-child in IE 6
http://elmicox.blogspot.com/2008/03/ativando-hover-e-first-child-no-ie-6-um.html */
* html * { color: expression( (function(who){ if(!who.MXPC){
who.MXPC = '1';
if(who.nodeName != 'A'){
who.onmouseenter=function(){ who.className += ' hover'};
who.onmouseleave=function(){ who.className = who.className.replace(' hover','')}; }
(who==who.parentNode.firstChild) ? who.className += ' first-child' : '' ;
} } )(this) , 'auto') }
Ready! Comments please.