Re: [csswg-drafts] [css-text-decor] Feature request - add a property text-decoration-length that modifies the length of the underline (#4557)

@jfkthame wrote:

> > I'd say, percentages should rather refer to the width of each fragment of the decoration box. By that, each line's decoration would be trimmed by the same percentage.
> 
> Given a decorated `<span>` that's split across a line break, with a short fragment on one line and a longer one on the other -- and perhaps the widths changing as the content is edited -- this seems like it'd be a bit odd. Would we really want the adjustments to vary per fragment depending how line breaks happen to fall?

That use case calls for the second option I gave.

The use case I had in mind for the _first_ option, though, was a decorated headline split across multiple lines. In that case, it is very plausible to split the decoration between the fragments, especially when you want to work with transitions.

> What about cases where the width of the box gets modified during layout by things like justification and tab-alignment -- would percentage-based decoration adjustments be affected, or should they be based on an intrinsic width prior to such adjustments?

I'd definitely say that such adjustments should be taken into account when calculating with percentages.

@dbaron wrote:

> Should the behavior at breaks be controlled by [`box-decoration-break`](https://drafts.csswg.org/css-break/#break-decoration)? That is, with `box-decoration-break: clone` you would end up with the length modification at both ends of every fragment, whereas with `box-decoration-break: slice` you would end up with the length modification only at the start of the first fragment and the end of the last fragment.

I like the idea of re-using that property to cover those to use cases. _But_, as @litherum wrote, there might be some downsides to it we should definitely discuss. And bidi text fragments should clearly be handled the same as non-bidi fragments, in this case.

@litherum wrote:

> I'm also not sure about the `<length>` part of `<length-percentage>`. Authors don't know how wide their text is going to when it finally gets rendered (because they don't know things like which font will be used, whether the user has boosted text sizes, etc.), so it seems like there is no `<length>` value they could use that would be right.

Take my use case with the headline from above. For stylistic reasons it's reasonable to clip the decoration at a fixed size at each fragment. Of course, this would cause very short fragments to not have a decoration at all.
For such cases, we might want to introduce a minimal decoration width. Though that probably goes beyond the initial use case and could be discussed separately.

Sebastian

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


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

Received on Wednesday, 6 July 2022 21:22:42 UTC