GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [css-sizing] Does indefinite `stretch` behave as automatic size or as initial value? · Issue #11006 · w3c/csswg-drafts

[css-sizing] Does indefinite stretch behave as automatic size or as initial value? #11006

New issue
Copy link
New issue
Copy link
Closed
Closed
[css-sizing] Does indefinite stretch behave as automatic size or as initial value?#11006
Copy link
Labels
Closed Accepted by CSSWG ResolutionChanges backed by a CSSWG resolution.Changes backed by a CSSWG resolution.css-sizing-3Current WorkCurrent Work

Description

@Loirooriol
Loirooriol
opened on Oct 5, 2024
Issue body actions

First, consider

<!DOCTYPE html>
<div style="min-height: max-content; height: 0; width: 200px; border: solid">lorem ipsum</div>
Spec, Blink Gecko, WebKit

@bfgeek told me that Blink had to deal with some breakage when they adopted this behavior, but that it's the correct thing to do. But what about stretch?

<!DOCTYPE html>
<div style="min-height: -moz-available; min-height: -webkit-fill-available; min-height: stretch; 
            height: 0; width: 200px; border: solid">lorem ipsum</div>
Spec Gecko, Blink WebKit

(WebKit seems to stretch elements with an indefinite height that contain some -webkit-fill-available, so it's always definite)

From https://drafts.csswg.org/css-sizing-4/#stretch-fit-sizing

Formally, its behavior is the same as specifying an automatic size together with a self-alignment property value of stretch

But here Blink is not implementing this, not sure if due to an oversight.

And then the situation is that browsers are implementing stretch, but nobody follows the spec here. It may be too late for *-content, but I would like to have an agreement for stretch before it ships. So Agenda+.

Reacted by Yisi

Activity

Next
  1. Loirooriol
    added
    css-sizing-4
    Agenda+
    on Oct 5, 2024
  2. Loirooriol commented on Oct 5, 2024

    @Loirooriol
    Loirooriol
    on Oct 5, 2024
    ContributorAuthor
    More actions

    For Servo following the spec seems a bit simpler than aligning with Blink, so I guess I will go with that for now.

  3. bfgeek commented on Oct 8, 2024

    @bfgeek
    bfgeek
    on Oct 8, 2024
    More actions

    Formally, its behavior is the same as specifying an automatic size together with a self-alignment property value of stretch

    So I think this was intended just to be applicable to main sizes, (e.g. not min/max-sizes).

    IMO this should be consistent with min-height: 100%, e.g. if a percentage is indefinite it behaves as zero for min-height, and Infinity for max-height.

    (e.g. The Blink/Gecko behaviour).

    For example it'd be pretty weird if:

    <!DOCTYPE html>
    <div style="max-height: stretch; height: 200px; width: 200px; border: solid">lorem ipsum</div>
    

    got clamped by the intrinsic size (when stretch is an extrinsic constraint).

    cc/ @tabatkins

  4. Loirooriol commented on Oct 9, 2024

    @Loirooriol
    Loirooriol
    on Oct 9, 2024
    ContributorAuthor
    More actions

    I'm not convinced we should treat it like a percentage. For example, with a min/max-content of 100px, fit-content is basically clamp(100px, stretch, 100px), and in Blink max-height: fit-content behaves as 100px but max-height: clamp(100px, 100%, 100px) behaves as none. And doing this like Blink seems more annoying to implement in Servo.

    So I think we should either:

    • Keep the spec as-is, or
    • Treat both fit-content and stretch as containing a cyclic percentage.
      More specifically, treat fit-content as fit-content(100%) and stretch as 100%, so:
      • For preferred and max properties they both behave as the initial value (with some special behavior for replaced elements)
      • For min properties see [css-sizing] Nobody follows the spec about cyclic percentages in min sizing properties #10969
  5. bfgeek commented on Oct 9, 2024

    @bfgeek
    bfgeek
    on Oct 9, 2024
    More actions

    I'm not convinced we should treat it like a percentage. For example, with a min/max-content of 100px, fit-content is basically clamp(100px, stretch, 100px)

    This isn't correct - we recently did a change to follow Firefox in this regard. See: #10721
    When the stretch is indefinite - min-size: fit-content resolves to min-size: min-content, and max-size: fit-content to max-size: max-content respectively.

    And doing this like Blink seems more annoying to implement in Servo.

    I'm curious why this is difficult in Servo? This might result in difficulty when attempting to implement calc-size() for example.

    I'm pretty convinced that we should just be consistent with 100% here, (again see the max-height:stretch example above, it'd be super weird if we coerce an explicitly extrinsic constraint to be intrinsic).

  6. Loirooriol commented on Oct 17, 2024

    @Loirooriol
    Loirooriol
    on Oct 17, 2024
    ContributorAuthor
    More actions

    we recently did a change to follow Firefox in this regard. See: #10721

    Not sure if that is the best behavior, I have commented there.

    I'm curious why this is difficult in Servo?

    I misunderstood what you were doing for fit-content, I thought it was trickier. Resolving keywords in different ways depending on the property and having a potentially indefinite stretch size during layout still adds some complexity. But not a big deal I guess.

    it'd be super weird if we coerce an explicitly extrinsic constraint to be intrinsic

    Maybe a bit weird indeed.

  7. Loirooriol commented on Oct 17, 2024

    @Loirooriol
    Loirooriol
    on Oct 17, 2024
    ContributorAuthor
    More actions

    It's worth noting that there is a difference among major browsers:

    • Gecko treats an indefinite min-height: stretch as the initial auto
    • Blink and WebKit treat it as 0px
    <!DOCTYPE html>
    <div style="display: flex; flex-direction: column; border: solid cyan; min-height: 100px; width: 200px;">
      <div style="min-height: -moz-available; min-height: -webkit-fill-available; min-height: stretch;
                  flex-basis: 0; border: solid">lorem ipsum</div>
    </div>
    Gecko Blink, WebKit

    Interestingly, they all treat min-height: 0% as 0px.

  8. bfgeek commented on Oct 17, 2024

    @bfgeek
    bfgeek
    on Oct 17, 2024
    More actions

    I wouldn't read too much into the block direction behaviour with FF (support was lacking last time I checked).

  9. dholbert commented on Oct 17, 2024

    @dholbert
    dholbert
    on Oct 17, 2024
    Member
    More actions

    Indeed, the FF behavior is just because I haven't implemented stretch behavior in the block axis yet (keep getting distracted by other tasks, but made a little local progress this week, hope to be done soonish).

  10. Loirooriol commented on Oct 18, 2024

    @Loirooriol
    Loirooriol
    on Oct 18, 2024
    ContributorAuthor
    More actions

    Sure, but if the spec changes, we need to decide whether min-height: stretch should behave as auto or as 0px or whatever 100% would do (the spec says that 100% should behave as 0px, but browsers don't follow the spec in general).

  11. davidsgrogan commented on Dec 9, 2024

    @davidsgrogan
    davidsgrogan
    on Dec 9, 2024
    Member
    More actions

    Formally, its behavior is the same as specifying an automatic size together with a self-alignment property value of stretch

    So I think this was intended just to be applicable to main sizes, (e.g. not min/max-sizes).

    IMO this should be consistent with min-height: 100%, e.g. if a percentage is indefinite it behaves as zero for min-height, and Infinity for max-height.

    (e.g. The Blink/Gecko behaviour).

    For example it'd be pretty weird if:

    <!DOCTYPE html>
    <div style="max-height: stretch; height: 200px; width: 200px; border: solid">lorem ipsum</div>
    

    got clamped by the intrinsic size (when stretch is an extrinsic constraint).

    cc/ @tabatkins

    I talked to @tabatkins about this a few weeks ago. He confirmed that the spec editors intended the Blink/Gecko behavior (min-size:stretch resolves to 0 and max-size:stretch resolves to infinity when available size is indefinite) and that it was indeed on the editors to better define the spec around min/max sizes behaving as auto, which should hopefully clear up the confusion here.

  12. astearns
    moved this to FTF agenda items in CSSWG January 2025 meetingon Jan 22, 2025
  13. astearns
    added this to CSSWG January 2025 meetingon Jan 22, 2025
  14. astearns
    moved this from FTF agenda items to Regular agenda items in CSSWG January 2025 meetingon Jan 22, 2025
  15. 21 remaining items

  16. gecko-dev-updater
    added a commit that references this issue on Mar 1, 2025

    Bug 1950067 [wpt PR 50899] - layout: Ignore indefinite `stretch` on m…

    941da6a
  17. jamienicol
    added a commit that references this issue on Mar 5, 2025

    Bug 1950067 [wpt PR 50899] - layout: Ignore indefinite `stretch` on m…

    2690952
  18. chromium-wpt-export-bot
    added a commit that references this issue on Mar 17, 2025

    [layout] Fix fit-content on min/max inline-sizes for contributions.

    9155fed
  19. aarongable
    added a commit that references this issue on Mar 17, 2025

    [layout] Fix fit-content on min/max inline-sizes for contributions.

    e8db6a7
  20. chromium-wpt-export-bot
    added 2 commits that reference this issue on Mar 17, 2025

    [layout] Fix fit-content on min/max inline-sizes for contributions.

    bff651f

    [layout] Fix fit-content on min/max inline-sizes for contributions.

    bd81ee4
  21. moz-v2v-gh
    added a commit that references this issue on Mar 18, 2025

    Bug 1954553 [wpt PR 51392] - [layout] Fix fit-content on min/max inli…

    c13d18c
  22. glandium
    added a commit that references this issue on Apr 1, 2025

    Bug 1950067 [wpt PR 50899] - layout: Ignore indefinite `stretch` on m…

    2850b07
  23. jwidar
    added a commit that references this issue on Sep 16, 2025

    Bug 1954553 [wpt PR 51392] - [layout] Fix fit-content on min/max inli…

    8786152
  24. tabatkins
    added
    css-sizing-3Current WorkCurrent Work
    and removed
    css-sizing-4
    on Sep 1, 2026
  25. fantasai
    added a commit that references this issue on Sep 1, 2026

    [css-sizing-3] Clarify indefinite stretch sizing #11006

    f918418
  26. fantasai
    added
    Closed Accepted by CSSWG ResolutionChanges backed by a CSSWG resolution.Changes backed by a CSSWG resolution.
    and removed
    Needs Edits
    on Sep 1, 2026
  27. fantasai
    closed this as completedon Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Closed Accepted by CSSWG ResolutionChanges backed by a CSSWG resolution.Changes backed by a CSSWG resolution.css-sizing-3Current WorkCurrent Work

    Type

    No type

    Projects

    • CSSWG January 2025 meeting
      Status
      Friday morning
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402520 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.