[Webkit-unassigned] [Bug 15562] getComputedStyle returns "auto" for zIndex property even after it has been set
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sat Aug 20 18:20:43 PDT 2011
https://bugs.webkit.org/show_bug.cgi?id=15562
--- Comment #14 from Michael Yagudaev <michaelyagudaev at gmail.com> 2011-08-20 18:20:43 PST ---
Posted a short article on how to get the z-index cross browsers, which also includes a jsfiddle example you can play around with:
http://www.yagudaev.com/programming/javascript/20-getting-reliable-z-index-cross-browser
(In reply to comment #13)
> Ok I believe I figured out the reason for this bug.
>
> If you read the css3 specification for z-index (http://www.w3.org/TR/CSS2/visuren.html#z-index) it says that the default value for a z-index is auto. Now, if an element is not applied with a position type that is non-static (i.e. position is relative, absolute or fixed), static is default for position so the z-index will have no effect on the element. So it seems webkit does not bother calculating this z-index and just returns the default, which is auto.
>
> The work around to fix this therefore is
> [selector]
> {
> position: relative;
> }
>
> If you want to get the value of the container then use:
> [selector]
> {
> position: relative;
> z-index: inherit;
> }
>
> The above is really useful when implementing loading spinners for your content (e.g. a spinner that appears on top of a dialog, simply get the z-index and increment by one).
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list