Does Z-index inherit parent index z or not?

I have two absolute divs. One element in div A will display div B (on click + javascript code). I want to have a higher Zindex on B than on A. (I want B above A) -

This element has its own zindex (lower than div A zindex). I do not know how zindex was inherited by children from parents, but it does not seem to be so.

Question...? How can I get a "computed" zindex for my "element"

+4
source share
3 answers

No, it is not inherited. You can see it in the MDN article .

, z-index z- . auto z-index .

,

<div id="a">
    <div id="b"></div>
</div>
<div id="c"></div>

#a, #b, #c { position: absolute; top: 0 }
#a { z-index: 1; }
#b { z-index: 1000000; }
#c { z-index: 2; }

#c #b, #b z-index.

, z-index , z-index z-.

Z-

+11

:

divs

w3.org spec

(: ;, : : ;).

, , . . ; . . , z . . . . . ( ), "z-index", "auto". .

, , z- div

window.getComputedStyle(element)
+1

You can use a client-side debugger like Firefox Firebug to check for computed styles: enter image description here

0
source

Source: https://habr.com/ru/post/1538468/


All Articles