Hi I have a problem with an CSS opacity line breaking intended output.
Z-index on red div is 1, the blue has 206.
Now, remove from CSS (or change to 1.0).#menu {opacity: 0.8;}
Working as intended.
Can someone explain this?
Or more importantly how I make my darker div on top, while having a semi transparent div?
I’m not a CSS expert so it is quite possibly a user error.
Your problem is with an unexpected stacking context being established by
#menu.To quote MDN:
This is the reason your div is behaving unexpectedly when you apply an opacity < 1 to it.
#menunow establishes a separate stacking context, and the z-index of its descendant#statushas no meaning outside of this context. To correct this problem, apply the z-index to#menuitself.