Skip to content

Inaccurate info in example on creating new stacking context #42293

@nneto

Description

@nneto

MDN URL

https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Positioned_layout/Stacking_context

What specific section or headline is this issue about?

Nested stacking contexts

What information was incorrect, unhelpful, or incomplete?

In this paragraph:

Every container element has an opacity of less than 1 and a position of either relative or absolute set. These property-value pairs create a stacking context when the element has z-index value other than auto.

The second sentence implies that "opacity of less than 1" and "position of either relative or absolute" both create a stacking context when z-index set to other value than auto. But opacity with less than 1 is enough on its own to create one. It doesn't create a context when z-index is set, it alone already creates one.

What did you expect to see?

Something more on the lines of: "Every container element has an opacity of less than 1 and a position of either relative or absolute set along with z-index value other than auto. Both the change in opacity and the position and z-index pair create stacking contexts."

Do you have any supporting links, references, or citations?

Stacking context - CSS | MDN

A stacking context is formed, anywhere in the document, by any element in the following scenarios:

[...]

Element with a position value absolute or relative and z-index value other than auto.

[...]

Element with an opacity value less than 1.

Do you have anything more you want to share?

This relates to #42296 and #42299.

MDN metadata

Page report details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Content:CSSCascading Style Sheets docsneeds triageTriage needed by staff and/or partners. Automatically applied when an issue is opened.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions