Skip to content

Commit c1bbbf9

Browse files
Update stacking context example text (#43013)
* Update stacking context example text fixes #42299 Clarified the explanation of stacking contexts and added a reference to features that create a stacking context. * Update files/en-us/web/css/guides/positioned_layout/stacking_context/example_1/index.md Co-authored-by: Chris Mills <chrisdavidmills@gmail.com> --------- Co-authored-by: Chris Mills <chrisdavidmills@gmail.com>
1 parent f976130 commit c1bbbf9

File tree

1 file changed

+2
-2
lines changed
  • files/en-us/web/css/guides/positioned_layout/stacking_context/example_1

1 file changed

+2
-2
lines changed

files/en-us/web/css/guides/positioned_layout/stacking_context/example_1/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Then if DIV #4 is also assigned a positive z-index greater than DIV #2's z-index
2222

2323
![Stacking context example 1](understanding_zindex_05c.png)
2424

25-
In this last example you can see that DIV #2 and DIV #4 are not siblings, because they belong to different parents in the HTML elements' hierarchy. Even so, stacking of DIV #4 with respect of DIV #2 can be controlled through `z-index`. It happens that, since DIV #1 and DIV #3 are not assigned any z-index value, they do not create a stacking context. This means that all their content, including DIV #2 and DIV #4, belongs to the same root stacking context.
25+
In this last example you can see that DIV #2 and DIV #4 are not siblings, because they belong to different parents in the HTML elements' hierarchy. Even so, stacking of DIV #4 with respect of DIV #2 can be controlled through `z-index`. It happens that, since DIV #1 and DIV #3 are not assigned any `z-index` value, or any other [features that create a stacking context](/en-US/docs/Web/CSS/Guides/Positioned_layout/Stacking_context#features_creating_stacking_contexts), they do not create a stacking context. This means that all their content, including DIV #2 and DIV #4, belongs to the same root stacking context.
2626

2727
In terms of stacking contexts, DIV #1 and DIV #3 are assimilated into the root element, and the resulting hierarchy is the following:
2828

@@ -31,7 +31,7 @@ In terms of stacking contexts, DIV #1 and DIV #3 are assimilated into the root e
3131
- DIV #4 (`z-index`: 2)
3232

3333
> [!NOTE]
34-
> DIV #1 and DIV #3 are not translucent. It is important to remember that assigning an opacity less than 1 to a positioned element implicitly creates a stacking context, just like adding a `z-index` value. And this example shows what happens when a parent element does not create a stacking context.
34+
> DIV #1 and DIV #3 are not translucent. It is important to remember that assigning an opacity value of less than `1` to an element implicitly creates a stacking context, as does adding a `z-index` value to a positioned element. This example also shows what happens when a parent element doesn't create a stacking context.
3535
3636
## Example
3737

0 commit comments

Comments
 (0)