@@ -1527,11 +1527,11 @@ Track Sizes</h4>
1527
1527
1528
1528
<dt> <dfn><<flex [0,∞]>></dfn>
1529
1529
<dd>
1530
- A non-negative dimension with the unit ''fr'' specifying the track's <dfn dfn noexport>flex factor</dfn> .
1530
+ Specifies the track's <dfn dfn noexport>flex factor</dfn> .
1531
1531
Each <<flex>> -sized track takes a share of the remaining space in proportion to its <a>flex factor</a> .
1532
1532
For example, given a track listing of ''1fr 2fr'' ,
1533
1533
the tracks will take up ⅓ and ⅔ of the <a>leftover space</a> , respectively.
1534
- See [[#fr-unit ]] for more details.
1534
+ See [[#flexible-tracks ]] for more details.
1535
1535
1536
1536
Note: If the sum of the <a>flex factors</a> is less than 1,
1537
1537
they'll take up only a corresponding fraction of the <a>leftover space</a> ,
@@ -1835,22 +1835,19 @@ Interpolation/Combination of ''repeat()''</h5>
1835
1835
They otherwise combine <a lt=discrete>discretely</a> .
1836
1836
1837
1837
<!--
1838
- ████████ ████████ ██ ██ ██ ██ ████ ████████
1839
- ██ ██ ██ ██ ██ ███ ██ ██ ██
1840
- ██ ██ ██ ██ ██ ████ ██ ██ ██
1841
- ██████ ████████ ██ ██ ██ ██ ██ ██ ██
1842
- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
1843
- ██ ██ ██ ██ ██ ██ ███ ██ ██
1844
- ██ ██ ██ ███████ ██ ██ ████ ██
1838
+ ████████ ██ ████████ ██ ██ ████ ████████ ██ ████████
1839
+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
1840
+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
1841
+ ██████ ██ ██████ ███ ██ ████████ ██ ████ ██
1842
+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
1843
+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
1844
+ ██ ████████ ████████ ██ ██ ████ ████████ ████ ████ ██████ ██
1845
1845
-->
1846
1846
1847
- <h4 id='fr-unit '>
1848
- Flexible Lengths: the ''fr'' unit </h4>
1847
+ <h4 id='flexible-tracks '>
1848
+ Flexible Tracks </h4>
1849
1849
1850
- A <dfn export>flexible length</dfn> or <dfn><<flex>></dfn> is a dimension
1851
- with the <dfn value for="<flex>" lt="fr|fr unit">fr</dfn> unit,
1852
- which represents a fraction of the <a>leftover space</a> in the <a>grid container</a> .
1853
- Tracks sized with ''fr'' units are called <dfn>flexible tracks</dfn>
1850
+ Tracks sized using <<flex>> values are called <dfn>flexible tracks</dfn>
1854
1851
as they flex in response to <a>leftover space</a>
1855
1852
similar to how <a>flex items</a> with a zero base size fill space in a <a>flex container</a> .
1856
1853
@@ -1861,45 +1858,6 @@ Flexible Lengths: the ''fr'' unit</h4>
1861
1858
Each column or row's share of the <a>leftover space</a> can be computed as the column or row's
1862
1859
<code> <flex> * <leftover space> / <sum of all <a>flex factors</a> ></code> .
1863
1860
1864
- <details class=note>
1865
- <summary> <<flex>> values between 0fr and 1fr have a somewhat special behavior:
1866
- when the sum of the flex factors is less than 1,
1867
- they will take up less than 100% of the leftover space.</summary>
1868
-
1869
- A track’s <<flex>> value
1870
- is effectively a request for some proportion of the leftover space,
1871
- with ''1fr'' meaning “100% of the leftover space”;
1872
- then if the tracks in that axis are requesting more than 100% in total,
1873
- the requests are rebalanced to keep the same ratio but use up exactly 100% of it.
1874
- However, if the tracks request <em> less</em> than the full amount
1875
- (such as three tracks that are each ''.25fr'' )
1876
- then they'll each get exactly what they request
1877
- (25% of the leftover space to each,
1878
- with the final 25% left unfilled).
1879
- See [[#algo-flex-tracks]] for the exact details
1880
- of how leftover space is distributed.
1881
-
1882
- This pattern is required for continuous behavior as ''fr'' values approach zero
1883
- (which means the tracks wants <em> none</em> of the leftover space).
1884
- Without this, a ''1fr'' track would take all of the leftover space;
1885
- but so would a ''0.1fr'' track,
1886
- and a ''0.01fr'' track,
1887
- etc.,
1888
- until finally the value is small enough to underflow to zero
1889
- and the track suddenly takes up none of the leftover space.
1890
- With this behavior,
1891
- the track instead gradually takes less of the leftover space
1892
- as its flex factor shrinks below ''1fr'' ,
1893
- smoothly transitioning to taking none of the leftover space at zero.
1894
-
1895
- Unless this “partial fill” behavior is <em> specifically</em> what's desired,
1896
- authors should stick to values ≥ 1;
1897
- for example, using ''1fr'' and ''2fr'' is usually better
1898
- than using ''.33fr'' and ''.67fr'' ,
1899
- as they're more likely to behave as intended
1900
- if tracks are added or removed.
1901
- </details>
1902
-
1903
1861
When the available space is infinite
1904
1862
(which happens when the <a>grid container</a> ’s width or height is <a>indefinite</a> ),
1905
1863
flex-sized <a>grid tracks</a> are sized to their contents while retaining their respective proportions.
@@ -1910,10 +1868,6 @@ Flexible Lengths: the ''fr'' unit</h4>
1910
1868
The maximum of those is used as the resolved ''1fr'' length (the <dfn>flex fraction</dfn> ),
1911
1869
which is then multiplied by each <a>grid track</a> ’s <a>flex factor</a> to determine its final size.
1912
1870
1913
- Note: <<flex>> values are not <<length>> s
1914
- (nor are they compatible with <<length>> s, like some <<percentage>> values),
1915
- so they cannot be represented in or combined with other unit types in ''calc()'' expressions.
1916
-
1917
1871
<!--
1918
1872
██████ ███████ ██ ██ ████████ ██ ██ ████████ ████████ ████████
1919
1873
██ ██ ██ ██ ███ ███ ██ ██ ██ ██ ██ ██ ██ ██
@@ -4917,6 +4871,10 @@ Changes since the <a href="https://www.w3.org/TR/2020/CRD-css-grid-1-20201218/">
4917
4871
and grid track sizing.
4918
4872
See [[#layout-algorithm]] .
4919
4873
(<a href="https://github.com/w3c/csswg-drafts/issues/3418">Issue 3418</a> )
4874
+ <li id="change-2020-fr-unit">
4875
+ Moved the definition of <<flex>> to [[css-values-4#fractions]] ,
4876
+ as other specs also make use of it.
4877
+ (<a href="https://github.com/w3c/csswg-drafts/issues/8027">Issue 8027</a> )
4920
4878
</ul>
4921
4879
4922
4880
<h3 id="changes-202008">
0 commit comments