I. Static pages
<! Doctype HTML> <HTML lang = "en"> Index.html
* {Margin: 0; padding: 0 ;}# nav {Background: # Eee; width: 600px; Height: 40px; margin: 0 auto ;} ul {list-style-type: none;} ul Li {float: Left; line-Height: 40px; text-align: center; position: relative;} A {height: 40px; display: block; text-Decoration: none; color: #000; padding: 0 10px; /* set the Left and Right padding instead of the width of a to make a adaptive width */} A: hover {color: # FFF; Background-color: #666 ;} ul Li ul Li {float: none; Background-color: # Eee; margin-top: 2px;} ul Li ul {position: absolute; /* absolute positioning by Level 1 menu */left: 0; top: 40px ;}Main.css 2. html/CSS implementation
Ul Li ul {display: none;/* First hide the level-2 menu */} ul Li: hover ul {display: block; /* When the mouse goes through the level-1 menu, the level-2 menu is displayed */}Style.css
Iii. jquery implementation 4. js implementation
Drop-down menu