Bootstrap 在引导程序3.3.4中,折叠的导航栏覆盖了其后面的内容

7jmck4yq  于 2022-12-07  发布在  Bootstrap
关注(0)|答案(1)|浏览(154)

我使用的是Bootstrap 3.3.4。我需要导航栏中链接的背景(在断点处折叠后)保持50%的透明,这样就不会覆盖其后面的内容。现在,当我点击“菜单”时,一个带有垂直堆叠链接的大块会出现,并覆盖其后面的任何内容。

6pp0gazn

6pp0gazn1#

当bootstrap达到768像素时,导航栏会折叠,并在导航栏右侧显示一个图标,允许下拉菜单垂直显示。现在,要将下拉菜单更改为不透明,并看到50%透明的背景,可以将以下代码添加到custom.css中。

@media(max-width:768px) {
    .navbar-inverse {
        background-color: transparent;
    }
    .navbar-collapse {
        background-color: { your choice of color };
        opacity:0.5;
    }
}

...或者,如果您只想看到文本后面的背景,而不想看到其他内容,请将代码应用于custom.css,如下所示...

@media(max-width:768px) {
    .navbar-inverse {
        background-color: transparent;
    }
    .navbar-collapse {
        opacity:0.5;
    }
}

相关问题