这是我创建的垂直导航栏的代码,我还需要在此处添加一件事,那就是鼠标悬停时的弹出菜单。我尝试了很多东西,但没有奏效。这是我的 CSS 代码
.navbar{
list-style-type: none;
margin: 0;
padding: 10px;
width: 280px; /* width of menu */
}
.navbar li{
border-bottom: 1px solid white; /* white border beneath each menu item */
}
.navbar li a{
background: #333 url(media/sexypanelright.gif) no-repeat right top; /*color of menu by default*/
font: bold 13px "Lucida Grande", "Trebuchet MS", Verdana;
display: block;
color: white;
width: auto;
padding: 5px 0; /* Vertical (top/bottom) padding for each menu link */
text-indent: 8px;
text-decoration: none;
border-bottom: 1px solid black; /*bottom border of menu link. Should be equal or darker to link's bgcolor*/
}
.navbar li a:visited, .navbar li a:active{
color: white;
}
.navbar li a:hover{
background-color: black; /*color of menu onMouseover*/
color: white;
border-bottom: 1px solid black; /*bottom border of menu link during hover. Should be equal or darker to link's hover's bgcolor*/
}
html部分就是这个
<ul class="navbar">
<li><a href="#">» Computers</a>
</li>
<li><a href="#" >» Networking Solutions</a></li>
<li><a href="#/">» Security Solutions</a></li>
<li><a href="#">» Office Automations</a></li>
<li><a href="#">» Gadgets</a></li>
<li><a href="#">» Projectors and Display Screens</a></li>
<li><a href="#">» Peripherals and Components</a></li>
<li><a href="#">» Softwares</a></li>
<li class="lastitem"><a href="#">» Customized Solutions</a></li>
</ul>
我想要的是,当用户将鼠标悬停在此列表中的任何项目上时,会出现一个带有菜单的弹出菜单。先感谢您。