白色 bootstrap 导航栏在段落上变为透明
White bootstrap navbar turning transparent over paragraph
我一直在研究一种导航,一旦滚动到 header 就会获得不透明度并缩小徽标 - 很好,除了当导航栏在白色背景上覆盖一个段落时,它会变成透明并造成视觉混乱。我猜这可能是使用 rgba 的问题?我想保持不透明,如果有任何建议如何做到这一点,我将不胜感激。
这不是透明度问题。是分层问题。将此添加到您的 css 文件:
#header {
z-index: 90;
}
CSS 中的 z-index 属性 控制重叠元素的垂直堆叠顺序。此 属性 没有固定值,但您可以使用更高的值将元素堆叠在其他元素的顶部。关注 css 也可以。
#header {
z-index: 9;
}
Actually reason was div and tags overlapping the header you added the z-index property in the **#myNav.affix** there should add **postion:relative** property then remove the **z-index** and **postion:relative** form the <p> tag and bootsrap classes also like col-md-5, because these classes having **postion-realtive** for your reqiurement these are not needed so remove it .am checked itz works fine hope itz works you too .(Y)Try It
我一直在研究一种导航,一旦滚动到 header 就会获得不透明度并缩小徽标 - 很好,除了当导航栏在白色背景上覆盖一个段落时,它会变成透明并造成视觉混乱。我猜这可能是使用 rgba 的问题?我想保持不透明,如果有任何建议如何做到这一点,我将不胜感激。
这不是透明度问题。是分层问题。将此添加到您的 css 文件:
#header {
z-index: 90;
}
CSS 中的 z-index 属性 控制重叠元素的垂直堆叠顺序。此 属性 没有固定值,但您可以使用更高的值将元素堆叠在其他元素的顶部。关注 css 也可以。
#header {
z-index: 9;
}
Actually reason was div and tags overlapping the header you added the z-index property in the **#myNav.affix** there should add **postion:relative** property then remove the **z-index** and **postion:relative** form the <p> tag and bootsrap classes also like col-md-5, because these classes having **postion-realtive** for your reqiurement these are not needed so remove it .am checked itz works fine hope itz works you too .(Y)Try It