绝对定位叠加忽略 z-index
我有以下模板,我正在尝试使用它,我冒昧地为每个 div 添加不同的颜色背景以进行调试,基本上我有三个具有不同背景的 div,并且这些背景需要在中心发光。为此,我尝试设置一个不透明度为 10% 的绝对定位容器。但是它会覆盖所有内容并忽略 z-index。
我知道我错过了一些简单的东西,但我已经关注这个太久了。
http://fwuse.com/n/ 没有发光,颜色不是用于调试的设计。 http://fwuse.com/n/glow.html 添加了 Glow 容器,仅保留菜单出来,其他一切都被隐藏了。 http://fwuse.com/n/glow-opacity.html 不透明的发光容器,请注意没有任何链接可以单击。
I have the following template that I am trying to get working, I have taken the liberty to add different color backgrounds to each div for debugging, basically I have three divs that are different backgrounds and these backgrounds need to have a glow in the center. To do this I tried setting an absolutely positioned container with 10% opacity. However it overlays everything and ignores z-index.
I know I am missing something simple, but I have been looking at this for too long.
http://fwuse.com/n/ No glow, the colors are not the design they are their for debugging.
http://fwuse.com/n/glow.html Glow container added, only the menu sticks out, everything else is hidden.
http://fwuse.com/n/glow-opacity.html Glow container with opacity, notice none of the links can be clicked.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
为什么不直接使用 CSS 来实现发光效果呢?
演示:http://jsfiddle.net/AlienWebguy/49d5g/
Why not just use CSS for your glow?
Demo: http://jsfiddle.net/AlienWebguy/49d5g/
如果您可以使内容 div 没有背景颜色(背景:透明?)并具有 z-index 3,并且底层的“10% 不透明度”div 具有 z-index 2,那么它将起作用。我不确定background:transparent是否是CSS中的一个属性;)
If you can make the content div not have a background color(background:transparent ?) and have z-index 3, and the underlying "10% opacity" div have z-index 2, it will work. I am not sure if background:transparent is a property in CSS however ;)
#content-bg
的 z-index 低于覆盖整个页面的辉光,因此消耗了内容的所有点击。将#content-bg
的 z-index 更改为 3 似乎可以将其置于足够靠前的位置,以便可以单击,同时不会影响发光效果。#content-bg
has a lower z-index than the glow which is covering the whole page, therefore consuming all the clicks for the content. Changing the z-index for#content-bg
to 3 seemed to bring it to the front enough to be clicked while not affecting the glow effect.我修复了它,我必须设置 #pagecontainer z-index 并将背景 div 设置为 z-index:auto。我将页眉设置为 z-index: 501,内容设置为 z-index: 502,页脚设置为 z-index: 503,#glow 设置为 z-index: 1。
尽管这很令人困惑,但它有效,知道为什么吗?
http://fwuse.com/no/
I fixed it, I had to set the #pagecontainer z-index and set the background divs to z-index:auto. I set header to z-index: 501, content to z-index: 502 and footer to z-index 503, #glow was set to z-index: 1.
As confusing as this is, it works, any idea why?
http://fwuse.com/no/