Bootstrap汉堡菜单自定义

时间:2017-01-14 19:42:27

标签: twitter-bootstrap nav

我正在使用引导程序构建响应式汉堡包下拉菜单,并且我在点击菜单时会出现问题。我希望菜单显示在徽标下方,但它显示在右侧(并在同一行上)。

这是我的代码screenshot

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>DeepRoot Productions</title>
        <link rel="stylesheet" href="css/bootstrap.min.css">
        <link rel="stylesheet" href="css/main.css">
        <link rel="stylesheet" href="css/style.css">
    </head>

    <body>
    <!--Navbar-->
            <nav class="navbar navbar-default navbar-fixed-top">
                <div class="container">
                <!--Logo-->
                    <div class="navbar-brand logo">
                        <p>DeepRoot Productions</p>
                    </div>
                <!--Hamburger Menu-->
                <button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <!--Full-Width Navbar-->
                    <div class="collapse navbar-collapse navHeaderCollapse">
                        <ul class="nav navbar-nav navbar-right">
                            <li><a class="right-space" href="#">Home</a></li>
                            <li><a class="right-space" href="#">Portfolio</a></li>
                            <li><a class="right-space" href="#">About</a></li>
                            <li><a href="#">Contact</a></li>
                        </ul>
                    </div>
                </div>
            </nav>

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
    </body>
</html>

1 个答案:

答案 0 :(得分:0)

您需要添加包裹.navbar-header的{​​{1}}类和汉堡包按钮,如下所示:

.navbar-brand

这是一个小提琴演示Fiddle