Bootstrap 4 - Navbar不会崩溃

时间:2018-02-11 17:50:55

标签: html responsive-design bootstrap-4 navbar

我不知道为什么它不起作用。我甚至尝试从bootstrap网站上的示例中复制并粘贴按钮和div标签。我认为它与社交媒体图标部分有关。我把它们变成了注释行,但没有奏效。你看到我的错了吗?

很抱歉,如果这是重复。我找到了同名的问题,但他们没有帮助。

...谢谢



<!doctype html>
<html lang="tr">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

    <title>This is a page</title>
</head>
<body>

    <nav class="navbar navbar-expand bg-faded" style="background-color: #233042;">
        <div class="container">

            <img class="navbar-brand" width="130" src="http://via.placeholder.com/200x50">
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#menu">
                <i class="fas fa-bars"></i>
            </button>
            
            <div class="collapse navbar-collapse" id="menu">
                <ul class="navbar-nav mx-auto">
                    <li class="nav-item">
                        <a class="nav-link text-light" href="#">Anasayfa</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-light" href="#">Ürünlerimiz</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-light" href="#">Hizmetlerimiz</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-light" href="#">Hakkımızda</a>
                    </li>
                </ul>
            </div>

            <ul class="navbar-nav justify-content-end">
                <li class="nav-item">
                    <a class="nav-link text-light" href="#" target="_blank"><i class="fab fa-twitter fa-lg"></i></a>
                </li>
                <li class="nav-item">
                    <a class=" nav-link text-light" href="#" target="_blank"><i class="fab fa-facebook-f fa-lg"></i></a>
                </li>
                <li class="nav-item">
                    <a class=" nav-link text-light" href="#" target="_blank"><i class="fab fa-instagram fa-lg"></i></a>
                </li>
            </ul>

        </div>
    </nav>

    <!-- Optional JavaScript -->
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
    <script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
</body>
</html>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

您正在使用班级navbar-expand,这意味着它永远不会崩溃。只需将其更改为navbar-expand-sm,它就会在小屏幕上崩溃。

查看docs了解详情。