Some years ago I proposed a ::contents pseudo-element. I have been refining the details in https://github.com/Loirooriol/css-contents, and yesterday someone proposed the same idea, so I decided to file this issue.
To summarize, elements generate a ::before pseudo-elements at the beginning of their contents, and an ::after one at the end. This proposal wraps the contents inside a new ::contents pseudo-element.

In some way this is the opposite of display: contents: it allows you to insert a box between an element and its children, without needing to change the HTML in non-semantic ways.
You can see all the details and examples in https://github.com/Loirooriol/css-contents, but the behavior is:
::contents has display: contents by default, via a rule in the UA origin. This can be overridden so that it does generate boxes.
::contents can be styled with arbitrary properties.
::contents has no effect in replaced elements.
::contents inherits from its originating element.
- Elements and text nodes inherit inheritable properties from the
::contents originated by the parent element. For non-inherited properties, inheritance is directly from the parent element (to avoid breaking the inherit keyword).
- Alternatively, inheritance could be from
::contents for all properties, and assign all: inherit to ::contents in UA origin.
- This pseudo-element does not affect selectors.
Some years ago I proposed a
::contentspseudo-element. I have been refining the details in https://github.com/Loirooriol/css-contents, and yesterday someone proposed the same idea, so I decided to file this issue.To summarize, elements generate a
::beforepseudo-elements at the beginning of their contents, and an::afterone at the end. This proposal wraps the contents inside a new::contentspseudo-element.In some way this is the opposite of
display: contents: it allows you to insert a box between an element and its children, without needing to change the HTML in non-semantic ways.You can see all the details and examples in https://github.com/Loirooriol/css-contents, but the behavior is:
::contentshasdisplay: contentsby default, via a rule in the UA origin. This can be overridden so that it does generate boxes.::contentscan be styled with arbitrary properties.::contentshas no effect in replaced elements.::contentsinherits from its originating element.::contentsoriginated by the parent element. For non-inherited properties, inheritance is directly from the parent element (to avoid breaking theinheritkeyword).::contentsfor all properties, and assignall: inheritto::contentsin UA origin.