Skip to content

[css-text-4 / css-overflow-4] Interaction of text-wrap: balance and (-webkit-)line-clamp #9310

Closed
@jfkthame

Description

@jfkthame

It would be good to clarify how text-wrap: balance interacts with line-clamp.

Specifically, when both balancing and clamping are requested, in which order do these effects operate? Does the block first have its lines wrapped using the balance algorithm, and then clamping applied to the resulting lines (without affecting how they wrap), or is clamping applied first and then balancing applied only to the lines up to the clamp limit?

Or in simpler terms, is it expected that (-webkit-)line-clamp may change the line-breaks used in a block?

It seems most intuitive to me that line-clamp applies after the line-breaks for a block have been determined, as it is defined in terms of lines. But the test at https://wpt.live/css/css-text/white-space/text-wrap-balance-line-clamp-001.html appears to assume that text-wrap: balance will be applied only to the lines up to the -webkit-line-clamp limit.

This codepen has an example where this effect is visible. In current Chrome Canary, varying the line-clamp limit results in changes to the line-breaking throughout the paragraph. Is this the expected/desired behavior, or should it be considered a bug?

Depending on the answer to this, the text-wrap-balance-line-clamp-001.html test may need revision.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions