导航栏未显示在移动设备上

Navbar is not showing up on mobile

    <!-- Navbar -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        
        <div class="container-fluid">
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link active" aria-current="page" href="index.html">Home</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="`enter code here`">Resume</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="">Linkedin</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="">GitHub</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="">Email</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

这是 html 中用 BootStrap 制作的导航栏。但不知何故,它没有出现在手机上任何关于如何改变它的提示?我已经尝试了很多,我也查看了以前的问题,但没有任何帮助

如您在 Bootstrap 5 docs...

中所见

"Navbars can use .navbar-toggler, .navbar-collapse, and .navbar-expand{-sm|-md|-lg|-xl|-xxl} classes to determine when their content collapses behind a button"

您的代码缺少切换器...

<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
    <div class="container-fluid">
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav">
                <li class="nav-item">
                    <a class="nav-link active" aria-current="page" href="index.html">Home</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="`enter code here`">Resume</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="">Linkedin</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="">GitHub</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="">Email</a>
                </li>
            </ul>
        </div>
    </div>
</nav>

Demo


另请注意 data attributes have changed in Bootstrap 5