Skip to content

[css-align] Allowing fallback alignments without breaking shorthands #1002

Open
@fantasai

Description

@fantasai

When adding the place-* shorthands, we realized that specifying a fallback alignment for the content distribution keywords (space-around etc.) resulted in parsing ambiguities. We debating using a slash in the shorthand, but decided not to because it would make 2-axis alignment syntax inconsistent with similar syntax elsewhere in CSS, e.g. for scroll-snap-align or background-position.

An alternate idea is to use the slash to separate the fallback from the initial. Imho this also helps make it clearer that we're declaring a fallback alignment, since slashes are used to indicate alternates in general typographic usage.

Examples:

justify-content: space-around / center; /* space-around, fall back to center - both axes */
place-content: space-around / center; /* space-around both axes, fall back to center */
place-content: space-around start / center; /* space-around b-axis, start x-axis, fallback center */

(I think it's probably best to consider this for Level 4, leaving fallback keywords out for Level 3 so we can take Level 3 to CR asap.)

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