- From: Andreu Botella via GitHub <sysbot+gh@w3.org>
- Date: Thu, 13 Jun 2024 08:42:11 +0000
- To: public-css-archive@w3.org
andreubotella has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-overflow-4] How do `-webkit-line-clamp` and `line-clamp` interact when both are specified? == In the current spec text for css-overflow-4, which only describes `continue: discard`, both `line-clamp` and the legacy `-webkit-line-clamp` property are shorthands for other properties, including `max-lines`. This means that if both are specified on some element, whichever wins in the cascade will be applied. However, this leads to unexpected results. Consider the following: ```css display: block; line-clamp: 3; -webkit-line-clamp: 4; ``` Since `line-clamp` and `-webkit-line-clamp` are shorthands for the same set of properties, `-webkit-line-clamp` will win. This means that `max-lines` will have a specified value of `4`, but also that `continue` will have a specified value of `-webkit-discard` – which will cause the `continue` property (and by extension, `max-lines`) to not take effect, because `display` is not set to `-webkit-box`. My current implementation of `continue: collapse` in Blink (see #7708) implements both `line-clamp` and `-webkit-line-clamp` as longhands which don't alias. If both are present (and not specified to `none`) on some box, `line-clamp` wins. AFAIU this behavior wouldn't be possible to specify while making `(-webkit-)line-clamp` shorthands, unless we make a separate `-webkit-max-lines` property. If we want to keep the shorthands, while making the code above actually work, my understanding is that `-webkit-line-clamp` would have to be specified such that it sets the longhands if `display: -webkit-box` and `-webkit-box-orient: vertical` are set, and to not be a shorthand for anything otherwise. cc @frivoal Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10439 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 13 June 2024 08:42:12 UTC