Re: [csswg-drafts] [css-content] Implementations and spec disagree regarding content: url on elements (#2889)

Ugh, I've just spotted this issue and it's resolution a year ago - I'm annoyed with myself that I missed it.

This comment:

> The current status is that all implementations create a replaced element when `content: <image>` is applied to a normal element, and create an inline replaced child when `content: <image>` is applied to ::before

Is not correct, and I noted these differences back in 2018 on https://github.com/w3c/csswg-drafts/issues/2657.

BFO Publisher, Prince, PDF Reactor, Antenna House Publisher and Typeset.sh all create a replaced element when `content: <image>` is specifed on `::before`, and have done so for a long time.

As I noted in the other issue, there are good reasons to do this as it's the only way you can size the image (`width` and `height` will have no effect if the content is inline). For that reason it should be even more important to do it this way on `::marker`

A self-contained testcase based on Emilio's original (also at https://jsbin.com/xivageqava/edit?html,output):

```html
<!doctype html>
<style>
.image::before {
  content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAnElEQVR42u3RAQ0AAAgDoNvc5lrDOahApTPhjBIiBCFCECIEIUIQIkSIEIQIQYgQhAhBiBCEIEQIQoQgRAhChCAEIUIQIgQhQhAiBCEIEYIQIQgRghAhCEGIEIQIQYgQhAhBCEKEIEQIQoQgRAhCECIEIUIQIgQhQhCCECEIEYIQIQgRghCECEGIEIQIQYgQhAgRIgQhQhAiBCHfLeh6lgEhei4lAAAAAElFTkSuQmCC);
  border: 2px solid blue;
  height: 10px;
}
</style>
<div class="image"></div>
<p>
The green square should be 10px and fully contained in the blue box if it is replaced-content,
or 100px and overflow the blue box if it is replaced-inline.
</p>
```


-- 
GitHub Notification of comment by faceless2
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2889#issuecomment-2755065739 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 26 March 2025 16:43:06 UTC