Skip to content

Commit ecd3b2e

Browse files
author
Loirooriol
authored
Clarifications
Clarifying actual contents generate boxes inside ::contents, ::marker is not included by ::contents, display:none on ::contents does not affect other pseudo-elements.
1 parent e31af5f commit ecd3b2e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# CSS ::contents pseudo-element proposal
22

3-
All non-replaced elements have a `::contents` pseudo-element, which wraps all the contents inside the element, not including contents generated by [`::before`](https://www.w3.org/TR/css-pseudo-4/#selectordef-before) and [`::after`](https://www.w3.org/TR/css-pseudo-4/#selectordef-after).
3+
All non-replaced elements have a `::contents` pseudo-element, which wraps all the contents inside the element, not including [`::marker`](https://drafts.csswg.org/css-pseudo-4/#marker-pseudo) nor the contents generated by [`::before`](https://www.w3.org/TR/css-pseudo-4/#selectordef-before) and [`::after`](https://www.w3.org/TR/css-pseudo-4/#selectordef-after), if any.
44

55
`::contents` pseudo-elements must act as if they were assigned [`display: contents`](https://www.w3.org/TR/css-display-3/#valdef-display-contents) via a rule in the UA origin. Therefore, they do not generate any boxes and are treated as if they had been replaced with their children. This must be possible to override via [`display`](https://www.w3.org/TR/css-display-3/#the-display-properties), so they do generate boxes if desired.
66

77
> **Note**
88
> This is consistent with [slots in a shadow tree](https://drafts.csswg.org/css-scoping/#slots-in-shadow-tree).
99
1010
A `::contents` pseudo-element can be styled exactly like any normal document-sourced element in the document tree.
11-
When its [`display`](https://www.w3.org/TR/css-display-3/#the-display-properties) property does not compute to [`contents`](https://www.w3.org/TR/css-display-3/#valdef-display-contents) nor [`none`](https://www.w3.org/TR/css-display-3/#valdef-display-none), the pseudo-element generates boxes as if it was an immediate children of its originating element. When its [`display`](https://www.w3.org/TR/css-display-3/#the-display-properties) property computes to [`none`](https://www.w3.org/TR/css-display-3/#valdef-display-none), the pseudo-element and the contents of the originating element generate no boxes.
11+
12+
When its [`display`](https://www.w3.org/TR/css-display-3/#the-display-properties) property does not compute to [`contents`](https://www.w3.org/TR/css-display-3/#valdef-display-contents) nor [`none`](https://www.w3.org/TR/css-display-3/#valdef-display-none), the pseudo-element generates boxes as if it was an immediate child of its originating element, and the actual contents of the originating element generate boxes as if they were immediate children of the pseudo-element.
13+
14+
When its [`display`](https://www.w3.org/TR/css-display-3/#the-display-properties) property computes to [`none`](https://www.w3.org/TR/css-display-3/#valdef-display-none), the pseudo-element and the actual contents of the originating element generate no boxes. [`::marker`](https://drafts.csswg.org/css-pseudo-4/#marker-pseudo), [`::before`](https://www.w3.org/TR/css-pseudo-4/#selectordef-before) and [`::after`](https://www.w3.org/TR/css-pseudo-4/#selectordef-after) pseudo-elements generate boxes as ausual, according to their [`display`](https://www.w3.org/TR/css-display-3/#the-display-properties) and [`content`](https://drafts.csswg.org/css-content-3/#content-property) properties.
1215

1316
> **Example**
1417
>

0 commit comments

Comments
 (0)