- From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
- Date: Tue, 06 Mar 2018 18:29:21 +0000
- To: public-css-archive@w3.org
Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-pseudo] Add a ::contents pseudo-element == Some years ago I proposed a [`::contents` pseudo-element](https://lists.w3.org/Archives/Public/www-style/2015Oct/0105.html). I have been refining the details in https://github.com/Loirooriol/css-contents, and yesterday someone proposed [the same idea](https://lists.w3.org/Archives/Public/www-style/2018Mar/0010.html), 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. ![image](https://user-images.githubusercontent.com/7477678/37049091-133f53e8-2170-11e8-9805-4ba01af37d6a.png) 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. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2406 using your GitHub account
Received on Tuesday, 6 March 2018 18:29:24 UTC