Bootstrap 5导航栏切换未显示在固定顶部

axr492tv  于 2022-12-16  发布在  Bootstrap
关注(0)|答案(1)|浏览(199)

我使用的是固定在顶部的Bootstrap 5导航栏,在调整浏览器大小时没有显示切换。当我移除固定顶部时,我可以看到切换。我错过了什么?

<nav class="navbar navbar-expand-lg fixed-top">
    <div class="container-fluid">
        <a class="navbar-brand" href="#">Name</a>
        <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 ml-auto">
                <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>

放回原处

navbar-dark bg-dark

将带回切换时,调整页面大小。我觉得这是如此简单,我是如此接近。

xggvc2p6

xggvc2p61#

我想通了。
我变了

<nav class="navbar navbar-expand-lg fixed-top">

<nav class="navbar navbar-expand-lg navbar-dark bg-transparent fixed-top">

添加navbar-dark bg-transparent使切换恢复。

相关问题