Skip to content

Commit b846615

Browse files
author
Loirooriol
authored
Interaction with [css-content]
1 parent 06a2840 commit b846615

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,45 @@ A child element [inherits](https://www.w3.org/TR/css-cascade-4/#inheriting) [inh
110110
111111
> **Issue:**
112112
> What should happen with non-inherited properties? Same as for [`::first-line`](https://www.w3.org/TR/css-pseudo-4/#first-line-pseudo) ([issue 1097](https://github.com/w3c/csswg-drafts/issues/1097))
113+
114+
## Interaction with the [CSS Generated Content Module](https://drafts.csswg.org/css-content/)
115+
116+
As a [tree-abiding pseudo-element](https://www.w3.org/TR/css-pseudo-4/#treelike), the [`content`](https://drafts.csswg.org/css-content/#content-property) property applies to `::contents`.
117+
118+
- [`normal`](https://drafts.csswg.org/css-content/#valdef-content-normal)
119+
120+
For elements and `::contents` pseudo-elements, this computes to [`contents`](https://drafts.csswg.org/css-content/#valdef-content-contents).
121+
122+
For [`::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, this computes to [`none`](https://drafts.csswg.org/css-content/#valdef-content-none).
123+
124+
- [`none`](https://drafts.csswg.org/css-content/#valdef-content-none)
125+
126+
On elements, this inhibits the `::contents` pseudo-element (together with the actual contents of the element) from being rendered as a child of this element, as if the pseudo-element had [`display: none`](https://www.w3.org/TR/css-display-3/#valdef-display-none).
127+
128+
On `::contents` pseudo-elements, this inhibits the actual children of the originating element from being rendered as children of this pseudo-element, as if the element was empty.
129+
130+
On other pseudo-elements, this inhibits the creation of the pseudo-element as if it had [`display: none`](https://www.w3.org/TR/css-display-3/#valdef-display-none).
131+
132+
- [`<content-replacement>`](https://drafts.csswg.org/css-content/#typedef-content-content-replacement)
133+
134+
Makes the element or pseudo-element a replaced element, filled with the specified `<image>`. Its normal contents are suppressed and do not generate boxes, as if they were [`display: none`](https://www.w3.org/TR/css-display-3/#valdef-display-none).
135+
136+
> **Note:** Replaced elements do not have [`::before`](https://www.w3.org/TR/css-pseudo-4/#selectordef-before), [`::after`](https://www.w3.org/TR/css-pseudo-4/#selectordef-after) or `::contents` pseudo-elements; the content property replaces their entire contents.
137+
138+
- [`<content-list>`](https://drafts.csswg.org/css-content/#typedef-content-content-list)
139+
140+
On elements, this replaces the `::contents` pseudo-element with one or more anonymous inline boxes corresponding to the specified values, in the order specified. The `::contents` pseudo-element (together with the actual contents of the element) is suppressed and does not generate boxes, as if it had [`display: none`](https://www.w3.org/TR/css-display-3/#valdef-display-none).
141+
142+
On pseudo-elements, this replaces the pseudo-elements contents with one or more anonymous inline boxes corresponding to the specified values, in the order specified. Its normal contents are suppressed and do not generate boxes, as if they had [`display: none`](https://www.w3.org/TR/css-display-3/#valdef-display-none).
143+
144+
- [`contents`](https://drafts.csswg.org/css-content/#valdef-content-contents)
145+
146+
On elements, this allows the creation of the `::contents` pseudo-element. It is useless to include [`contents`](https://drafts.csswg.org/css-content/#valdef-content-contents) twice in a single `content` property, because the second occurrence simply has no effect, as there can only be a single `:contents` pseudo-element.
147+
148+
On pseudo-elements, this makes the contents of the pseudo-element be the actual contents of the originating element. It is useless to include `contents` more than once in a single `content` property or use [`contents`](https://drafts.csswg.org/css-content/#valdef-content-contents) in multiple pseudo-elements, because only the first occurrence has an effect, as there the actual contents of the originating element cannot be duplicated. It is also useless to use `contents` in multiple pseudo-elements.
149+
150+
When used in multiple pseudo-elements, the first occurrence is searched in the following order:
151+
152+
1. In the `::contents` pseudo-element, but only if [`contents`](https://drafts.csswg.org/css-content/#valdef-content-contents) is used on the originating element.
153+
2. In the [`::before`](https://www.w3.org/TR/css-pseudo-4/#selectordef-before) pseudo-element
154+
3. In the [`::after`](https://www.w3.org/TR/css-pseudo-4/#selectordef-after) pseudo-element

0 commit comments

Comments
 (0)