Skip to content

Commit dd3a124

Browse files
committed
[css-sizing] Add fit-content(<<length-percentage>>) per WG resolution.
1 parent 3580b61 commit dd3a124

2 files changed

Lines changed: 36 additions & 8 deletions

File tree

css-sizing-3/Overview.bs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ED: https://drafts.csswg.org/css-sizing
99
TR: https://www.w3.org/TR/css3-sizing/
1010
Editor: Tab Atkins, Google, http://xanthir.com/contact/
1111
Editor: Elika J. Etemad / fantasai, Invited Expert, http://fantasai.inkedblade.net/contact
12-
!Issue Tracking: <a href="https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&amp;component=Sizing&amp;resolution=---">W3C Bugzilla</a>
1312
Previous version: https://www.w3.org/TR/2016/WD-css-sizing-3-20160512/
1413
Abstract: This module extends the CSS sizing properties with keywords that represent content-based "intrinsic" sizes and context-based "extrinsic" sizes, allowing CSS to more easily describe boxes that fit their content or fit into a particular layout context.
1514
Ignored Terms: block-level box
@@ -246,7 +245,7 @@ New Keywords for 'width' and 'height'</h3>
246245

247246
<pre class=propdef partial>
248247
Name: width, min-width, max-width, height, min-height, max-height
249-
New values: fill | max-content | min-content | fit-content
248+
New values: fill | max-content | min-content | fit-content | fit-content(<<length-percentage>>)
250249
</pre>
251250

252251
<p>There are four types of automatically-determined sizes in CSS (which
@@ -272,7 +271,16 @@ New Keywords for 'width' and 'height'</h3>
272271
<dt><dfn>fit-content</dfn>
273272
<dd>
274273
Use the <a>fit-content inline size</a> or <a>fit-content block size</a>,
275-
as appropriate to the writing mode.
274+
as appropriate to the writing mode,
275+
i.e.
276+
<code>min(<a>max-content size</a>, max(<a>min-content size</a>, <a>fill-available size</a>))</code>
277+
278+
<dt><dfn>fit-content(<<length-percentage>>)</dfn>
279+
<dd>
280+
Use the fit-content formula
281+
with the <a>available size</a> replaced by the specified argument,
282+
i.e.
283+
<code>min(<a>max-content size</a>, max(<a>min-content size</a>, <<length-percentage>>))</code>
276284
</dl>
277285

278286
Issue: Is ''width/fill'' stable enough or should we defer to L4?
@@ -314,7 +322,7 @@ Column Sizing Keywords</h3>
314322

315323
<pre class="propdef partial">
316324
Name: column-width
317-
New values: fill | max-content | min-content | fit-content
325+
New values: fill | max-content | min-content | fit-content | fit-content(<<length-percentage>>)
318326
</pre>
319327

320328
<p>When used as values for 'column-width',
@@ -336,6 +344,12 @@ Column Sizing Keywords</h3>
336344
<dt><dfn>fit-content</dfn>
337345
<dd>Specifies the optimal column width as
338346
<code>min(<a>max-content inline size</a>, max(<a>min-content inline size</a>, <a>fill-available inline size</a>))</code>.
347+
348+
<dt><dfn>fit-content(<<length-percentage>>)</dfn>
349+
<dd>
350+
Specifies the optimal column width as
351+
<code>min(<a>max-content size</a>, max(<a>min-content size</a>, <<length-percentage>>))</code>
352+
339353
</dl>
340354

341355

css-sizing/Overview.bs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ED: https://drafts.csswg.org/css-sizing
99
TR: https://www.w3.org/TR/css-sizing/
1010
Editor: Tab Atkins, Google, http://xanthir.com/contact/
1111
Editor: Elika J. Etemad / fantasai, Invited Expert, http://fantasai.inkedblade.net/contact
12-
!Issue Tracking: <a href="https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&amp;component=Sizing&amp;resolution=---">W3C Bugzilla</a>
1312
Previous version: https://www.w3.org/TR/2012/WD-css3-sizing-20120927/
1413
Abstract: This module extends the CSS sizing properties with keywords that represent content-based "intrinsic" sizes and context-based "extrinsic" sizes, allowing CSS to more easily describe boxes that fit their content or fit into a particular layout context.
1514
Ignored Terms: block-level box
@@ -247,7 +246,7 @@ New Keywords for 'width' and 'height'</h3>
247246

248247
<pre class=propdef partial>
249248
Name: width, min-width, max-width, height, min-height, max-height
250-
New values: fill | max-content | min-content | fit-content
249+
New values: fill | max-content | min-content | fit-content | fit-content(<<length-percentage>>)
251250
</pre>
252251

253252
<p>There are four types of automatically-determined sizes in CSS (which
@@ -273,7 +272,16 @@ New Keywords for 'width' and 'height'</h3>
273272
<dt><dfn>fit-content</dfn>
274273
<dd>
275274
Use the <a>fit-content inline size</a> or <a>fit-content block size</a>,
276-
as appropriate to the writing mode.
275+
as appropriate to the writing mode,
276+
i.e.
277+
<code>min(<a>max-content size</a>, max(<a>min-content size</a>, <a>fill-available size</a>))</code>
278+
279+
<dt><dfn>fit-content(<<length-percentage>>)</dfn>
280+
<dd>
281+
Use the fit-content formula
282+
with the <a>available size</a> replaced by the specified argument,
283+
i.e.
284+
<code>min(<a>max-content size</a>, max(<a>min-content size</a>, <<length-percentage>>))</code>
277285
</dl>
278286

279287
Note: To size an element such that it avoids overlapping sibling floats,
@@ -311,7 +319,7 @@ Column Sizing Keywords</h3>
311319

312320
<pre class="propdef partial">
313321
Name: column-width
314-
New values: fill | max-content | min-content | fit-content
322+
New values: fill | max-content | min-content | fit-content | fit-content(<<length-percentage>>)
315323
</pre>
316324

317325
<p>When used as values for 'column-width',
@@ -333,6 +341,12 @@ Column Sizing Keywords</h3>
333341
<dt><dfn>fit-content</dfn>
334342
<dd>Specifies the optimal column width as
335343
<code>min(<a>max-content inline size</a>, max(<a>min-content inline size</a>, <a>fill-available inline size</a>))</code>.
344+
345+
<dt><dfn>fit-content(<<length-percentage>>)</dfn>
346+
<dd>
347+
Specifies the optimal column width as
348+
<code>min(<a>max-content size</a>, max(<a>min-content size</a>, <<length-percentage>>))</code>
349+
336350
</dl>
337351

338352

0 commit comments

Comments
 (0)