Son of Suckerfish
URL: http://www.htmldog.com/articles/suckerfish/dropdowns/
Dropdown menus with pure HTML and CSS, with a JavaScript fallback for Internet Explorer 6. This version is more accessible, even lighter in weight (just 12 lines of JavaScript), have greater compatibility (they now work in Opera and Safari without a hack in sight) and can have multiple-levels.
Copy this code and paste it in your HTML
<!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" > <meta http-equiv = "Content-Type" content = "text/html; charset=iso-8859-1" / > #nav, #nav ul {
padding: 0;
margin: 0;
list-style: none;
line-height: 1;
}
#nav a {
display: block;
width: 10em;
}
#nav li {
float: left;
width: 10em;
}
#nav li ul {
position: absolute;
width: 10em;
left: -999em;
}
#nav li:hover ul, #nav li.sfhover ul {
left: auto;
}
<script type = "text/javascript" > 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) ;
<li ><a href = "#" title = "Course" > COURSE
</ a > <li ><a href = "#" title = "appetizers" > appetizers
</ a ></ li > <li ><a href = "#" title = "beverages" > beverages
</ a ></ li > <li ><a href = "#" title = "breads" > breads
</ a ></ li > <li ><a href = "#" title = "breakfast" > breakfast
</ a ></ li > <li ><a href = "#" title = "condiments" > condiments
</ a ></ li > <li ><a href = "#" title = "desserts" > desserts
</ a ></ li > <li ><a href = "#" title = "lunch/snacks" > lunch/snacks
</ a ></ li > <li ><a href = "#" title = "main dish" > main dish
</ a ></ li > <li ><a href = "#" title = "salads" > salads
</ a ></ li > <li ><a href = "#" title = "side dishes" > side dishes
</ a ></ li > <li ><a href = "#" title = "soups" > soups
</ a ></ li > <li ><a href = "#" title = "Ingredient" > INGREDIENT
</ a > <li ><a href = "#" title = "appetizers" > appetizers
</ a ></ li > <li ><a href = "#" title = "beverages" > beverages
</ a ></ li > <li ><a href = "#" title = "breads" > breads
</ a ></ li > <li ><a href = "#" title = "breakfast" > breakfast
</ a ></ li > <li ><a href = "#" title = "condiments" > condiments
</ a ></ li > <li ><a href = "#" title = "desserts" > desserts
</ a ></ li > <li ><a href = "#" title = "lunch/snacks" > lunch/snacks
</ a ></ li > <li ><a href = "#" title = "main dish" > main dish
</ a ></ li > <li ><a href = "#" title = "salads" > salads
</ a ></ li > <li ><a href = "#" title = "side dishes" > side dishes
</ a ></ li > <li ><a href = "#" title = "soups" > soups
</ a ></ li > <li ><a href = "#" title = "Cuisine" > CUISINE
</ a > <li ><a href = "#" title = "appetizers" > appetizers
</ a ></ li > <li ><a href = "#" title = "beverages" > beverages
</ a ></ li > <li ><a href = "#" title = "breads" > breads
</ a ></ li > <li ><a href = "#" title = "breakfast" > breakfast
</ a ></ li > <li ><a href = "#" title = "condiments" > condiments
</ a ></ li > <li ><a href = "#" title = "desserts" > desserts
</ a ></ li > <li ><a href = "#" title = "lunch/snacks" > lunch/snacks
</ a ></ li > <li ><a href = "#" title = "main dish" > main dish
</ a ></ li > <li ><a href = "#" title = "salads" > salads
</ a ></ li > <li ><a href = "#" title = "side dishes" > side dishes
</ a ></ li > <li ><a href = "#" title = "soups" > soups
</ a ></ li > <li ><a href = "#" title = "Diet" > DIET
</ a > <li ><a href = "#" title = "appetizers" > appetizers
</ a ></ li > <li ><a href = "#" title = "beverages" > beverages
</ a ></ li > <li ><a href = "#" title = "breads" > breads
</ a ></ li > <li ><a href = "#" title = "breakfast" > breakfast
</ a ></ li > <li ><a href = "#" title = "condiments" > condiments
</ a ></ li > <li ><a href = "#" title = "desserts" > desserts
</ a ></ li > <li ><a href = "#" title = "lunch/snacks" > lunch/snacks
</ a ></ li > <li ><a href = "#" title = "main dish" > main dish
</ a ></ li > <li ><a href = "#" title = "salads" > salads
</ a ></ li > <li ><a href = "#" title = "side dishes" > side dishes
</ a ></ li > <li ><a href = "#" title = "soups" > soups
</ a ></ li > <li ><a href = "#" title = "Occasion" > OCCASION
</ a > <li ><a href = "#" title = "appetizers" > appetizers
</ a ></ li > <li ><a href = "#" title = "beverages" > beverages
</ a ></ li > <li ><a href = "#" title = "breads" > breads
</ a ></ li > <li ><a href = "#" title = "breakfast" > breakfast
</ a ></ li > <li ><a href = "#" title = "condiments" > condiments
</ a ></ li > <li ><a href = "#" title = "desserts" > desserts
</ a ></ li > <li ><a href = "#" title = "lunch/snacks" > lunch/snacks
</ a ></ li > <li ><a href = "#" title = "main dish" > main dish
</ a ></ li > <li ><a href = "#" title = "salads" > salads
</ a ></ li > <li ><a href = "#" title = "side dishes" > side dishes
</ a ></ li > <li ><a href = "#" title = "soups" > soups
</ a ></ li > <li ><a href = "#" title = "Preperation" > PREPERATION
</ a > <li ><a href = "#" title = "appetizers" > appetizers
</ a ></ li > <li ><a href = "#" title = "beverages" > beverages
</ a ></ li > <li ><a href = "#" title = "breads" > breads
</ a ></ li > <li ><a href = "#" title = "breakfast" > breakfast
</ a ></ li > <li ><a href = "#" title = "condiments" > condiments
</ a ></ li > <li ><a href = "#" title = "desserts" > desserts
</ a ></ li > <li ><a href = "#" title = "lunch/snacks" > lunch/snacks
</ a ></ li > <li ><a href = "#" title = "main dish" > main dish
</ a ></ li > <li ><a href = "#" title = "salads" > salads
</ a ></ li > <li ><a href = "#" title = "side dishes" > side dishes
</ a ></ li > <li ><a href = "#" title = "soups" > soups
</ a ></ li >
Report this snippet