使用引导程序不会出现下拉菜单

时间:2015-05-26 12:23:58

标签: html css twitter-bootstrap twitter-bootstrap-3

我正在尝试使用bootstrap创建pulldown menu。 但由于某种原因,pulldown menu没有出现。 我不明白这个概念还是错字?

<div class="container">
<a href="index.php" title="Homepage">
<button type="button" class="btn btn-default sm active">
<span class="glyphicon glyphicon-home"> Home</button></a>

<a href="about.php" title="About">
<button type="button" class="btn btn-default sm">
  <span class="glyphicon glyphicon-briefcase"> About</button></a>
<div class="btn-group">
<button type="button" class="btn btn-default sm data-toggle="dropdown">   
   <span  class="glyphicon glyphicon-eye-open"> My Dropdown</button>
    <ul class="dropdown-menu" role="menu">
        <li><a href="drop1.php">Dropdown 1</a></li>
        <li><a href="droop2.php">Dropdown 2</a></li>
    </ul>
</div>
</div>

1 个答案:

答案 0 :(得分:1)

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<div class="container">
        <a href="index.php" title="Homepage">
            <button type="button" class="btn btn-default sm active">
            <span class="glyphicon glyphicon-home"> Home</button>
        </a>

        <a href="about.php" title="About"><button type="button" class="btn btn-default sm"><span class="glyphicon glyphicon-briefcase"> About</button></a>
        <div class="btn-group">
            <button type="button" class="btn btn-default sm" data-toggle="dropdown"><span  class="glyphicon glyphicon-eye-open"> My Dropdown</button>
            <ul class="dropdown-menu" role="menu">
                <li><a href="drop1.php">Dropdown 1</a></li>
                <li><a href="droop2.php">Dropdown 2</a></li>
            </ul>
        </div>
    </div>

您的代码 <button type="button" class="btn btn-default sm data-toggle="dropdown">

您错过了"

<强>正确 <button type="button" class="btn btn-default sm" data-toggle="dropdown">