1.下拉菜单里面必须是<li> <a> ... </a></li>的形式,否则a标签里面的字体会没有样式;
2.<span class="caret"></span>为下拉箭头的样式
下拉菜单和导航栏的html代码如下:
<html>
<head>
<title>下拉菜单和导航栏练习</title>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
<link href="bootstrap-3.3.7-dist\css\bootstrap.min.css" rel="stylesheet">
<script src="bootstrap-3.3.7-dist\js\bootstrap.js" > </script>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="container">
<ul class="nav nav-tabs">
<li class="dropdown">
<a href="#" data-toggle="dropdown"> Home<span class="caret"></span> </a>
<ul class = "dropdown-menu" >
<li><a href="#"> action1 </a></li>
<li><a href="#"> action2 </a></li>
<li><a href="#"> action3 </a></li>
</ul>
</li>
<li><a href="#"> Profile </a></li>
<li><a href="#"> Message </a></li>
</ul>
......................
</div>
</body>
</html>