- From: Richard Gibson via GitHub <sysbot+gh@w3.org>
- Date: Wed, 28 Nov 2018 21:39:22 +0000
- To: public-css-archive@w3.org
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