可折叠的导航栏无法正常工作

时间:2017-03-13 15:33:31

标签: html css twitter-bootstrap

我正在尝试使用bootstrap设计网页。但是我的导航栏没有崩溃。

span框的所有内容都应该在创建的按钮内。但是它们出现在标题本身上。

可能是什么问题?

My output window

以下是代码:

<html lang="en">
    <head>

        <meta charset="utf.8">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

        <!-- Optional theme -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
    </head>
    <body>


        <!--navbar    navbar-inverse:black bar   -->
        <nav class="navbar navbar-inverse navbar-fixed-top" id="mynavbar">
            <div class="container">

                <div class="navbar-header">
                    <!--button     data toogle set to collapse for enabling size variations ex.mobile-->
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">

                        <!--span box    list of items inside the button-->
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>

                    </button>

                    <a href="" class="navbar-brand">Sample</a>
                </div><!--Header-->
                <div class="collapse navbar-collapse" id="navbar-collapse">
                    <ul class="nav navbar-nav">
                        <li><a href="#feedback">Feedback</a>
                        <li><a href="#gallery">Gallery</a>
                        <li><a href="#contact">Contact</a>
                    </ul>
                </div>
            </div><!--Container-->

        </nav>


        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
        <!-- Latest compiled and minified JavaScript -->
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

    </body>
</html>

1 个答案:

答案 0 :(得分:2)

它不是data-toogle,而是data-toggle

修正拼写错误:

data-toogle="collapse"