简体   繁体   English

页面上的Bootstrap词缀和不透明度

[英]Bootstrap Affix and Opacity on Page

I'm working on a site that has a very demanding color pallette. 我正在一个对调色板要求很高的网站上工作。 Some of the page content requires a background-color that need opacity 0.8. 页面的某些内容需要不透明度为0.8的背景色。

My navigation bar uses Bootstrap's affix top, so it is present during scrolling. 我的导航栏使用Bootstrap的词缀顶部,因此在滚动过程中会出现。 I have assigned the nav bar background-color white, so it is always readable. 我为导航栏指定了背景色白色,因此它始终可读。

Any content that doesn't have an opacity looks perfect. 没有不透明性的任何内容看起来都很完美。 The nav-bar's background-color goes over the content that needs to be hidden. 导航栏的背景颜色遍历需要隐藏的内容。

The content with opacity 0.8 causes a problem. 不透明度为0.8的内容会引起问题。 It goes on top of the entire nav bar, and the only way to see the nav bar is due to the opacity. 它位于整个导航栏的顶部,查看导航栏的唯一方法是不透明度。

Imagine two pieces of paper, and you slide one over the other. 想象两张纸,然后一张滑到另一张上。 Without opacity, the nav bar page goes on top. 没有不透明性,导航栏页面位于顶部。 When opacity is set, the nav bar page goes underneath. 设置不透明度后,导航栏页面将位于下方。

Any ideas how I can fix this? 有什么想法我可以解决这个问题吗?

Here's simplified code of what I'm doing. 这是我正在做的简化代码。

CSS: CSS:

body {
    background-color: white;
    position: relative;
}

div.nav-bar {
    background-color: white;
}

div.normal-content {
    background-color: gray;
}

div.special-content {
    background-color: red;
    opacity: 0.8;
}

HTML: HTML:

<div data-spy="affix" data-offset-top="200" class="row nav-bar">
...
</div>

...


<div class="normal-content">
...
</div>
<div class="special-content">
...
</div>

Hmmm.

After working on other parts of my design, I'm no longer seeing this problem in my test browsers. 在完成设计的其他部分后,我在测试浏览器中不再看到此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM