W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2019

Re: [csswg-drafts] [css-content] content: contents will not be compatible. (#4632)

From: Mike Bremford via GitHub <sysbot+gh@w3.org>
Date: Fri, 27 Dec 2019 12:36:35 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-569261332-1577450193-sysbot+gh@w3.org>
We got the `content: contents` value working last week, and it wasn't immediately obvious what it was useful for, even as we were implementing it. The best I came up with was when either the ::before or ::after pseudo-element need to act as a _content-replacement_ rather than a _content-list_, but you still need to generate content around the element itself.

The distinction between `content-replacement` and `content-list` remains important, as discussed in https://github.com/w3c/csswg-drafts/issues/2657

Here's a slightly contrived example of how the `contents` value might be useful, and so (in my opinion) worth keeping:

```html
<style>
a.external {
    content: none;
}
a.external::before {
    content: "(" contents ")";
}
a.external::after {
    content: url(https://upload.wikimedia.org/wikipedia/commons/2/25/External.svg);
    height: 1em;
}
</style>

See <a class="external" href="http://w3.org">w3.org</a> for detail
```
See (w3.org)![image](https://user-images.githubusercontent.com/989243/71516632-fa281d00-28a1-11ea-8cb7-03c9777c238e.png)


--

I also think removing `content: contents` would make your proposed [::contents](https://github.com/w3c/csswg-drafts/issues/2406) pseudo-element a bit less useful, @Loirooriol.

-- 
GitHub Notification of comment by faceless2
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4632#issuecomment-569261332 using your GitHub account
Received on Friday, 27 December 2019 12:36:36 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:57 UTC