Re: [css3-flexbox][css-ALL] Should z-index Just Work on flex items?

09.07.2012, 11:24, "fantasai" <fantasai.lists@inkedblade.net>:
> I think, and I suspect others agree, that the fact that z-index doesn't Just Work
> without 'position: relative' was a mistake in the design of CSS2. There's already
> a distinction between 'z-index: auto' and 'z-index: 0' that can easily distinguish
> a stacking context at the default level vs. a non-stacking-context at default level.
>
> The question I have is, going forward, do we want new CSS layout modes to let
> z-index do its job whenever it's non-'auto', without requiring 'position: relative'?
>
> (If so, we should start with making it work in flexbox.)
>
> ~fantasai

I tend to prefer to just enable `z-index` to work by default for all elements regardless of their `position`-property value.

But if backward compatibility will become a concern, it would probably be resolved by introducing a new inherited property like `z-index-scope` that would enable new behavior explicitly. The property could have two possible values: `positioned` (used by default) and `all` (turning on `z-index` to work regardless of element's `position`-property value).

So authors could turn on new behavior globally via just a simple rule at the top of stylesheet:

    :root {z-index-scope: all; }

Moreover, this solution would give us nice flexibility to choose exact behavior depending on situation and override it when needed.

Received on Monday, 9 July 2012 22:57:51 UTC