[csswg-drafts] [css-overflow] How do empty blocks affect line-clamping by height? (#12663)

andreubotella has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-overflow] How do empty blocks affect line-clamping by height? ==
```html
<div style="line-clamp: auto; max-height: 2lh">
  <!-- Possible clamp point A -->
  <div>Line 1</div>
  <!-- Possible clamp point B -->
  <div>Line 2</div>
  <!-- Possible clamp point C -->
  <div></div> <!-- Takes up zero height -->
  <!-- Possible clamp point D -->
  <div>Line 3</div>
</div>
```

The way `line-clamp` is currently defined, the last possible clamp point that doesn't overflow would be chosen, and since the div between C and D takes up zero height, we'd clamp at clamp point D. By the rules of `block-ellipsis`, then this would mean that line 2 would _not_ be ellipsized, since there are more things other than absolutely positioned elements and end-of-elements between the line box and the clamp point. Should this be the case?

This is similar to the discussion about abspos in https://github.com/w3c/csswg-drafts/issues/10868#issuecomment-3206198816, with the difference that an abspos has no rendering differences whether the clamp point is before or after it, since abspos will render unless their containing block is completely after the clamp point (see #11379 and #11962). But this is not true for zero-height blocks:

- A zero-height block could have relative position and contain an abspos, meaning that the abspos will be shown or hidden depending on whether the clamp point is before or after the zero-height CB.
- A block could be explicitly set to have `height: 0` while having content that visibly overflows.

So, should empty / zero-height blocks be treated specially when choosing a clamp point, or when determining whether a line box should be ellipsized?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12663 using your GitHub account


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

Received on Wednesday, 27 August 2025 13:36:53 UTC