[csswg-drafts] [css-sizing] Suggestion: A limit-width that plays the role of a max-width but has higher priority than min-width (#3347)

frevds has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-sizing] Suggestion: A limit-width that plays the role of a max-width but has higher priority than min-width ==
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'.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3347 using your GitHub account

Received on Tuesday, 27 November 2018 12:14:59 UTC