Re: [csswg-drafts] [css-overflow-4] Should block-ellipsis clip ::before/::after text? (#11253)

Another very common use case is that we usually want to display the ellipsis only when the text inside a Chinese book title exceeds the length. I think this also applies to other punctuation marks that appear in pairs.

```html
data:text/html;charset=UTF-8,<!DOCTYPE html>
<style>
    h2::before {
      content: "《";
    }
    h2::after {
        content: "》";
    }
    h2 {
        white-space: nowrap;
        overflow: hidden;
        width: 12em;
        text-overflow: ellipsis;
        text-overflow: "...》";
    }
</style>
<h2>编写可维护的JavaScript</h2>
```

Currently, we can do this with `text-overflow: “...” ` to achieve this effect indirectly, but this will lead to inaccurate width calculation. The fundamental solution is to exclude the clip `::before/after`.

Firefox:

![Image](https://github.com/user-attachments/assets/643f774b-7c0f-419a-9f9b-80d9cb5641d9)


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


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

Received on Tuesday, 22 April 2025 14:55:14 UTC