我有一个嵌套的CSS菜单,我无法得到子菜单.
我把A列表中的代码分开了.该网站上的示例工作得非常好,但由于我的页面上有2个CSS导航菜单,因此我必须将我的HTML元素放在不同的CSS类中.
这是我的代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">
ul#lvl1 {
margin:0;
padding:0;
list-style:none;
width:150px; /* Width of Menu Items */
border-bottom:1px solid #ccc;
}
li.lvl1 {position:relative}
ul.lvl2 {
position: absolute;
left: 149px; /* Set 1px less than menu width */
top: 0;
display: none;
}
/* Styles for Menu Items */
li.lvl1 > a {
display: block;
text-decoration: none;
color: #777;
background: #fff; /* IE6 Bug */
padding: 5px;
border: …Run Code Online (Sandbox Code Playgroud)