Skip to content

[css-conditional-5] How to resolve cq* values against a container size resolved at used value time? #14384

Open

Description

@cdoublev

For example:

<div id=container style="container-type: inline-size; width: min-content;">
  <div id=element style="height: 10cqw">height?</div>
</div>
<script>
  getComputedStyle(element).height; // ?
</script>

<length> in height must compute to an absolute value, but min-content resolves at used value time. Should the computed/used height resolve to 0px?

https://drafts.csswg.org/css-conditional-5/#container-lengths

Activity

  1. bfgeek commented on Aug 24, 2026

    @bfgeek

    Height also resolves at used value time, and should just return the used value? (I'm not sure I understand your concern).
    https://drafts.csswg.org/cssom-1/#resolved-values

  2. emilio commented on Aug 24, 2026

    @emilio
    Collaborator

    Container queries need to interleave layout and styling, thus width: min-content is a definite width by the time you get to resolving 10cqw in #element. So the height of #element is just a pixel value.

  3. cdoublev commented on Aug 25, 2026

    @cdoublev
    CollaboratorAuthor

    Height also resolves at used value time, and should just return the used value? (I'm not sure I understand your concern).

    Correct. I should have used font-size: 10cqw instead of height: 10cqw, because the resolved value of font-size must be its computed value, which must be an absolute <length>.

    My concern was that the spec says that cq* values "are evaluated based on the computed values of the query container". And the computed value of min-content for width is "as specified".

    Container queries need to interleave layout and styling

    Thanks for this clarification.

    thus width: min-content is a definite width by the time you get to resolving 10cqw in #element. So the height of #element is just a pixel value.

    To be clear, in Chrome 151 and Firefox ESR 140, the resolved height is 0px in my example. So I assume you are saying that the height of #element is expected to be that pixel value computed between style and layout.

    I also assume it might be worth clarifying this in the spec, and so I am leaving this issue open.

  4. emilio commented on Aug 25, 2026

    @emilio
    Collaborator

    My concern was that the spec says that cq* values "are evaluated based on the computed values of the query container". And the computed value of min-content for width is "as specified".

    This should be "based on the used values" probably.

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