Skip to content

[css-text-4] Rethinking 'text-space-collapse' and 'text-space-trim' #448

Open
@SebastianZ

Description

@SebastianZ

As far as I understand, text-space-collapse is meant to control the white space processing inside an element while text-space-trim is used to control the white space processing around (the edges of) an element.

Furthermore, it looks like text-space-trim: trim-inner overlaps with text-space-collapse: discard, because text-space-collapse: discard discards all white space within an element and text-space-trim: trim-inner discards all white space at the beginning and end within an element.

With the above in mind and also in regard of their shorthand white-space, I think it would be better to:

  1. rename them to something like white-space-inner/white-space-inside/white-space-within and white-space-outer/white-space-outside/white-space-around (name bikeshedding welcome).
  2. change text-space-trim to only affect white space outside of the element and use the same values as text-space-collapse.

So the syntaxes for them would then look something like this:

white-space-inside: collapse | discard | preserve | preserve-breaks | preserve-spaces
white-space-around: collapse | discard | preserve | preserve-breaks | preserve-spaces |
    [
        [ collapse-before | discard-before | preserve-before | preserve-breaks-before | preserve-spaces-before ] ||
        [ collapse-after | discard-after | preserve-after | preserve-breaks-after | preserve-spaces-after ]
    ]

To avoid the long keywords and the complicated syntax on white-space-around a two-value syntax could be used instead, where the first value applies to the white space before the element and the second to the white space after the element, and if only one value is given, it applies to both. The syntax would then look like this:

white-space-around: [ collapse | discard | preserve | preserve-breaks | preserve-spaces ]{1,2}

Sebastian

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