html代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bootstrap导航条鼠标悬停下拉菜单</title>
<link id="bootstrap_221" rel="stylesheet" type="text/css" class="library" href="/js/sandbox/bootstrap-2.2.1/css/bootstrap.min.css">
<script id="jquery_172" type="text/javascript" class="library" src="/js/sandbox/jquery/jquery-1.7.2.min.js"></script>
<script id="bootstrap_221" type="text/javascript" class="library" src="/js/sandbox/bootstrap-2.2.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container"> <div class="navbar">
<div class="navbar-inner">
<ul class="nav">
<li class="dropdown"> <a href="#menu3">Menu3</a>
<ul class="dropdown-menu">
<li><a href="#menu7">Menu7</a></li>
<li><a href="#menu8">Menu8</a></li>
</ul>
</li>
<li><a href="#">Menu4</a></li>
<li><a href="#">Menu5</a></li>
<li><a href="#">Menu6</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
css:
.navbar .nav > li .dropdown-menu {
margin:;
}
.navbar .nav > li:hover .dropdown-menu {
display: block;
}
效果:
参考:http://runjs.cn/detail/k4ahmcgc