Re: [csswg-drafts] [css-sizing] Suggestion: A limit-width that plays the role of a max-width but has higher priority than min-width and width, even if of lower (!) value (#3347)

The draft of Values and Units Level 4 introduces math functions
<https://drafts.csswg.org/css-values-4/#calc-notation> that provide this
capability:

<div style="min-width: min(800px, 100%); max-width: 100%"> Free content
allowed to define its width </div>

On Tue, Nov 27, 2018 at 7:15 AM Matthias Truxa <notifications@github.com>
wrote:

> Scenario:
>
> <div style="min-width: 800px; max-width: 100%"> Free content allowed to
> define its width </div>
>
> What happens is that the DIV is always at least 800px wide, due to the way
> the width is calculated (see below).
>
> What I cannot express in CSS is what I want: The container shall be less
> than 800px if the 100% is less than 800px. I do NOT want to assign a
> max-width nor a width, since I want the content to define that.
>
> Afaik it is not possible to achieve this without scripting, which
> constitutes a need to introduce a new limit-width (and limit-height
> likewise).
>
> The following algorithm describes how the two properties influence the
> used value of the 'width' property:
>
>    - The tentative used width is calculated (without 'min-width' and
>    'max-width') following the rules under "Calculating widths and margins"
>    above.
>    - If the tentative used width is greater than 'max-width', the rules
>    above are applied again, but this time using the computed value of
>    'max-width' as the computed value for 'width'.
>    - If the resulting width is smaller than 'min-width', the rules above
>    are applied again, but this time using the value of 'min-width' as the
>    computed value for 'width'.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/w3c/csswg-drafts/issues/3347>, or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABJN4PII5Y4n500uDseZchjeIv2rpKpzks5uzSzEgaJpZM4Y1XZ->
> .
>


-- 
GitHub Notification of comment by gibson042
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3347#issuecomment-442614415 using your GitHub account

Received on Wednesday, 28 November 2018 21:39:23 UTC