Skip to content

[css-sizing] Production for values common to max/min/preferred widths and heights #13478

Closed

Description

@Crissov

Could css-sizing-3 please introduce something like <box-length> or <box-dimension> = <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()>?

With that production, <'width'>, <'height'>, <'min-width'>, <'min-height'> could be simplified to auto | <box-dimension>, whereas <'max-width'>, <'max-height'> could become none | <box-dimension>. This would make the difference more noticeable.

css-sizing-4 can then add stretch | fit-content | contain to it.

css-logical refers to <'width'> and <'min-width'> and <'max-width'>. Although this is the future-safe way, it feels a bit weird that the height properties also use a width value.

css-flexbox could either keep its content | <'width'> value syntax for the flex-basis property, or switch to auto | content | <box-dimension>.

There may be other places affected.

Activity

  1. fantasai commented on Sep 3, 2026

    @fantasai
    Collaborator

    Done! Thanks for the suggestion, @Crissov, this is much better. We named it <box-size>. Leaving the issue open to track edits for css-flexbox and css-multicol.

  2. Crissov commented on Sep 3, 2026

    @Crissov
    ContributorAuthor

    Fair – I think I did not suggest <box-size> because I believe the new size property should be have been called box-size and it would then be confusing to also have <'box-size'>.

  3. fantasai commented on Sep 3, 2026

    @fantasai
    Collaborator

    Oh, that got named to size already, see #820.

  4. cdoublev commented on Sep 4, 2026

    @cdoublev
    Collaborator

    The ec88f45 rewrite appears to have many problems. Below are the property value definitions (ignoring those from CSS Logical) before/after, with expanded <box-size> and concatenated New values.

    block-size, inline-size, min-block-size, min-inline-size

    - auto | <length-percentage [0,∞]> | contain | min-content | max-content | stretch | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>
    + auto | <length-percentage> | contain | min-content | max-content | stretch | fit-content | fit-content() | calc-size()

    height, width, min-height, min-width

    - auto | <length-percentage [0,∞]> | contain | min-content | max-content | stretch | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>
    + auto | <length-percentage> | contain | contain | min-content | max-content | stretch | fit-content | fit-content() | fit-content(<length-percentage [0,∞]>) | calc-size() | <anchor-size()>

    column-width

    - auto | <length [0,∞]> | min-content | max-content | fit-content(<length-percentage>)
    + auto | <length [0,∞]> | <length-percentage> | contain | min-content | max-content | stretch | fit-content | fit-content() | calc-size()

    max-block-size, max-inline-size

    - none | <length-percentage [0,∞]> | contain | min-content | max-content | stretch | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>
    + none | <length-percentage> | contain | min-content | max-content | stretch | fit-content | fit-content() | calc-size()

    max-height, max-wifth

    - none | <length-percentage [0,∞]> | contain | min-content | max-content | stretch | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>
    + none | <length-percentage> | contain | contain | min-content | max-content | stretch | fit-content | fit-content() | fit-content(<length-percentage [0,∞]>) | calc-size()

    Note that calc-size() in the RHS of a production represents a function taking no argument.

  5. cdoublev commented on Sep 30, 2026

    @cdoublev
    Collaborator

    Re-opening because a few problems remain (1-4).

    The logical sizing properties were imported from CSS Logical 1 to CSS Sizing 3 by f2234ba, (1) but the initial value of min-block-size and max-block-size min-inline-size changed from 0 to auto along the way.

    Originally, column-width was defined in CSS Multi-Column Layout with auto | <length [0,∞]>, and CSS Sizing extended it with some sizing keywords.

    Then ec88f45 extended it with <box-size>, which produces these sizing keywords and other values like <length-percentage [0,∞]> (2) but how to interpret <percentage> for column-width is not defined. (3) I suspect that contain and <calc-size()> may also not be expected as new values for column-width.

    Since <length-percentage [0,∞]> overlapped with <length [0,∞]>, 20e4b18 was intended to replace these New values with a complete Value definition: auto | <box-size>. However, (4) it did not imported the other property table definition fields from CSS Logical. This forces w3c/webref users to manually merge definitions from the two specifications.

    For (4), I was going to propose these changes until I ran into (2):

     New Column Sizing Values: the stretch, min-content, max-content, and fit-content values
    
    +This specification adds the ability to use the <box-size> production in the 'column-width' property.
    
     <pre class="propdef partial">
     Name: column-width
     Value: auto | <<box-size>>
    +Initial: auto
    +Applies to: <a>block containers</a> except <a>table wrapper boxes</a>
    +Inherited: no
    +Percentages: ?
     Computed value: as specified, with <<length-percentage>> values computed
     Animation type: by computed value type
     </pre>

    Perhaps the best solution would be to revert using <box-size> to define column-width?

    cc @tidoust

  6. fantasai commented on Oct 8, 2026

    @fantasai
    Collaborator

    The logical sizing properties were imported from CSS Logical 1 to CSS Sizing 3 by f2234ba, (1) but the initial value of min-block-size and max-block-size changed from 0 to auto along the way.

    This is correct. The initial value is supposed to match between properties that map to each other. (CSS Logical was written before we changed the initial value, so it matched when it was written.)

  7. fantasai commented on Oct 8, 2026

    @fantasai
    Collaborator

    Opened #14574 for the column-width issue.

    @cdoublev Is there anything else that needs addressing here?

  8. cdoublev commented on Oct 8, 2026

    @cdoublev
    Collaborator

    Nope, thank you.

  9. Loirooriol commented on Oct 8, 2026

    @Loirooriol
    Contributor

    max-block-size changed from 0 to auto

    Presumably that's a typo for min-inline-size, because max sizing properties don't even accept auto. So if something says it's the initial value, it's wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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