Re: [csswg-drafts] [css-overflow] What counts as "immediately preceding" for `block-ellipsis`? (#10868)

We had resolved that if the last thing that fits in the height is not a line, the ellipsis shouldn't be drawn on that line. But I don't think block-level abspos should count as "a thing" there.

Consider the following example.

```css
.clamp-by-lines {
  line-clamp: 2;
}
.clamp-by-height {
  line-clamp: auto;
  max-height: 2lh;
}
.abspos {
  position: absolute;
  top: 0;
  width: 50px;
  height: 50px;
  background-color: purple;
}
```
```html
<div class="clamp-by-lines">
  <p>Line 1</p>
  <p>Line 2</p>
  <div class="abspos"></div>
  <p>Line 3</p>
</div>
```

With `.clamp-by-lines`, the clamp point happens right after line 2, so that line gets the ellipsis; and the `.abspos` is after the clamp point but it still shows up because of #11379. However, if we instead set the `.clamp-by-height` class, the clamp point would be after the `.abspos` (since it takes up zero height in-flow), and therefore that would be "the last thing before the clamp point", meaning that line 2 would *not* have the ellipsis.

I think this behavior is unintuitive, and therefore we should either clamp after the last thing other than a block-level abspos that fits in the height, or to ignore immediately following block-level abspos when determining whether a line has the ellipsis (which should have the exact same behavior). But if we instead wrap the abspos in a relative div (which would still be zero-size), that would count as the last thing, and no line would have an ellipsis.

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


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

Received on Friday, 20 June 2025 11:35:16 UTC