The code is as follows:
<HTML><Head><styletype= "Text/css">. Menu{width:130px;Border:1px solid #ccc;Border-bottom:None;}. Menu ul{List-style:None;margin:0px;padding:0px;background:#F4F4F4;}. Menu ul Li{padding:0px 8px;Height:26px;Border-bottom:1px solid #ccc;Line-height:26px;position:relative;}a{text-decoration:None;Color:#333333;}. Menu ul li:hover{background:#E6E6E6;}. Menu UL Li ul{Display:None;position:Absolute; Left:130px;Top:-1px;width:130px;Border:1px solid #ccc;Border-bottom:None;}. Menu UL Li:hover ul{Display:Block;}</style></Head><Body><Divclass= "Menu"><ul><Li><ahref="#">Home</a></Li><Li><ahref="#">Personal website</a> <ul> <Li><ahref="#">People's Republic of China</a></Li> <Li><ahref="#">Chinese proletariat</a></Li> </ul></Li><Li><ahref="#">Home</a> <ul> <Li><ahref="#">Home</a></Li> <Li><ahref="#">Home</a></Li> <Li><ahref="#">Home</a></Li> </ul></Li><Li><ahref="#">Home</a></Li><Li><ahref="#">Home</a></Li><Li><ahref="#">Home</a></Li><Li><ahref="#">Home</a></Li><Li><ahref="#">Home</a></Li></ul></Div></Body></HTML>
Key points to note:
- Use of derived selectors
- Avoid border border duplication
- Use of relative positioning and absolute positioning
Test results:
- Home
- Personal website
- People's Republic of China
- Chinese proletariat
- Home
- Home
- Home
- Home
- Home
- Home
Div+css vertical navigation menu and Level Two pop-up menu