Skip to content

Commit 8bf345a

Browse files
committed
[css-grid] Define how grid items are sized. Rejigger the organization of the section.
1 parent 1f7b339 commit 8bf345a

2 files changed

Lines changed: 41 additions & 27 deletions

File tree

css-grid/Overview.bs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Former editor: Phil Cupp, Microsoft Corporation, pcupp@microsoft.com
1919
!Issues list: <a href="https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&amp;component=Grid+Layout&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED">In Bugzilla</a>
2020
Abstract: This CSS module defines a two-dimensional grid-based layout system, optimized for user interface design. In the grid layout model, the children of a grid container can be positioned into arbitrary slots in a flexible or fixed predefined layout grid.
2121
Ignored Terms: containing block, <positive-integer>, <ident>, auto, grid-*-start, grid-*-end, flex factor, flex factors, block formatting context, grid-auto-position
22-
Link Defaults: css21 (property) margin, css-align-3 (dfn) alignment container/alignment subject
22+
Link Defaults: css21 (property) margin, css-align-3 (dfn) alignment container/alignment subject/box alignment properties, css-align-3 (value) stretch/baseline, css-position-3 (property) left
2323
At Risk: the ''grid-template-rows/subgrid'' value of 'grid-template-columns' and 'grid-template-rows', and its component parts individually
2424
</pre>
2525

@@ -613,15 +613,6 @@ Grid Items</h2>
613613
<a href="http://www.w3.org/TR/CSS21/text.html#white-space-prop">white space</a>
614614
is not rendered, as if it were ''display:none''.
615615

616-
A <a>grid item</a> establishes a new formatting context for its contents.
617-
The type of this formatting context is determined by its 'display' value, as usual.
618-
The computed 'display' of a <a>grid item</a>
619-
is determined by applying the table in
620-
<a href="http://www.w3.org/TR/CSS2/visuren.html#dis-pos-flo">CSS 2.1 Chapter 9.7</a>.
621-
However, grid items are grid-level boxes, not block-level boxes:
622-
they participate in their container's <a>grid formatting context</a>,
623-
not in a block formatting context.
624-
625616
<div class="example">
626617
Examples of grid items:
627618
<pre>
@@ -648,7 +639,7 @@ Grid Items</h2>
648639

649640
Some values of 'display' trigger the generation of anonymous boxes.
650641
For example, a misparented ''table-cell'' child is fixed up
651-
by <a href="http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes">generating anonymous ''table'' and ''table-row'' elements</a> around it. [[!CSS21]]
642+
by <a href="http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes">generating anonymous <css>table</css> and <css>table-row</css> elements</a> around it. [[!CSS21]]
652643
This fixup must occur <em>before</em> a <a>grid container</a>’s children are promoted to <a>grid items</a>.
653644
For example, given two contiguous child elements with ''display:table-cell'',
654645
an anonymous table wrapper box around them becomes the <a>grid item</a>.
@@ -657,6 +648,21 @@ Grid Items</h2>
657648
Future display types may generate anonymous containers (e.g. ruby) or otherwise mangle the box tree (e.g. run-ins).
658649
It is intended that grid item determination run after these operations.
659650

651+
A <a>grid item</a> establishes a new formatting context for its contents.
652+
The type of this formatting context is determined by its 'display' value, as usual.
653+
The computed 'display' of a <a>grid item</a>
654+
is determined by applying the table in
655+
<a href="http://www.w3.org/TR/CSS2/visuren.html#dis-pos-flo">CSS 2.1 Chapter 9.7</a>.
656+
However, grid items are grid-level boxes, not block-level boxes:
657+
they participate in their container's <a>grid formatting context</a>,
658+
not in a block formatting context.
659+
660+
A <a>grid item</a> is sized within the containing block defined by its <a>grid area</a>
661+
similarly to an equivalent block-level box in an equivalently-sized containing block,
662+
except that ''margin/auto'' margins and the <a>box alignment properties</a>
663+
have special effects. (See [[#alignment]].)
664+
665+
660666
<!--
661667
<h3 id="position-grid">
662668
Non-children Grid Items</h3>

css-grid/Overview.html

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ <h3 class="heading settled" data-level="1.3" id="source-independence"><span clas
12341234
<img alt="Image: An arrangement suitable for portrait orientation." src="images/game-portrait.png">
12351235

12361236

1237-
<figcaption>An arrangement suitable for <span class="css">portrait</span> orientation.</figcaption>
1237+
<figcaption>An arrangement suitable for <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-page-3/#valdef-page-size-portrait">portrait</a> orientation.</figcaption>
12381238

12391239

12401240
</figure>
@@ -1244,7 +1244,7 @@ <h3 class="heading settled" data-level="1.3" id="source-independence"><span clas
12441244
<img alt="Image: An arrangement suitable for landscape orientation." src="images/game-landscape.png">
12451245

12461246

1247-
<figcaption>An arrangement suitable for <span class="css">landscape</span> orientation.</figcaption>
1247+
<figcaption>An arrangement suitable for <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-page-3/#valdef-page-size-landscape">landscape</a> orientation.</figcaption>
12481248

12491249

12501250
</figure>
@@ -1714,16 +1714,6 @@ <h2 class="heading settled" data-level="4" id="grid-items"><span class="secno">4
17141714
<a href="http://www.w3.org/TR/CSS21/text.html#white-space-prop">white space</a>
17151715
is not rendered, as if it were <span class="css">display:none</span>.</p>
17161716

1717-
1718-
<p>A <a data-link-type="dfn" href="#grid-item">grid item</a> establishes a new formatting context for its contents.
1719-
The type of this formatting context is determined by its <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css2/visuren.html#propdef-display">display</a> value, as usual.
1720-
The computed <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css2/visuren.html#propdef-display">display</a> of a <a data-link-type="dfn" href="#grid-item">grid item</a>
1721-
is determined by applying the table in
1722-
<a href="http://www.w3.org/TR/CSS2/visuren.html#dis-pos-flo">CSS 2.1 Chapter 9.7</a>.
1723-
However, grid items are grid-level boxes, not block-level boxes:
1724-
they participate in their container’s <a data-link-type="dfn" href="#grid-formatting-context">grid formatting context</a>,
1725-
not in a block formatting context.</p>
1726-
17271717

17281718
<div class="example">
17291719
Examples of grid items:
@@ -1753,7 +1743,7 @@ <h2 class="heading settled" data-level="4" id="grid-items"><span class="secno">4
17531743

17541744

17551745
<p>Some values of <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css2/visuren.html#propdef-display">display</a> trigger the generation of anonymous boxes.
1756-
For example, a misparented <span class="css">table-cell</span> child is fixed up
1746+
For example, a misparented <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-display-3/#valdef-display-outside-table-cell">table-cell</a> child is fixed up
17571747
by <a href="http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes">generating anonymous <span class="css">table</span> and <span class="css">table-row</span> elements</a> around it. <a data-biblio-type="normative" data-link-type="biblio" href="#biblio-css21" title="CSS21">[CSS21]</a>
17581748
This fixup must occur <em>before</em> a <a data-link-type="dfn" href="#grid-container">grid container</a>’s children are promoted to <a data-link-type="dfn" href="#grid-item">grid items</a>.
17591749
For example, given two contiguous child elements with <span class="css">display:table-cell</span>,
@@ -1764,9 +1754,27 @@ <h2 class="heading settled" data-level="4" id="grid-items"><span class="secno">4
17641754
Future display types may generate anonymous containers (e.g. ruby) or otherwise mangle the box tree (e.g. run-ins).
17651755
It is intended that grid item determination run after these operations.
17661756

1757+
</p>
1758+
<p>A <a data-link-type="dfn" href="#grid-item">grid item</a> establishes a new formatting context for its contents.
1759+
The type of this formatting context is determined by its <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css2/visuren.html#propdef-display">display</a> value, as usual.
1760+
The computed <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css2/visuren.html#propdef-display">display</a> of a <a data-link-type="dfn" href="#grid-item">grid item</a>
1761+
is determined by applying the table in
1762+
<a href="http://www.w3.org/TR/CSS2/visuren.html#dis-pos-flo">CSS 2.1 Chapter 9.7</a>.
1763+
However, grid items are grid-level boxes, not block-level boxes:
1764+
they participate in their container’s <a data-link-type="dfn" href="#grid-formatting-context">grid formatting context</a>,
1765+
not in a block formatting context.</p>
1766+
1767+
1768+
<p>A <a data-link-type="dfn" href="#grid-item">grid item</a> is sized within the containing block defined by its <a data-link-type="dfn" href="#grid-area">grid area</a>
1769+
similarly to an equivalent block-level box in an equivalently-sized containing block,
1770+
except that <span class="css" data-link-for="margin">auto</span> margins and the <a data-link-type="dfn" href="http://dev.w3.org/csswg/css-align-3/#box-alignment-properties">box alignment properties</a>
1771+
have special effects. (See <a data-section="" href="#alignment">§9
1772+
Alignment</a>.)</p>
1773+
1774+
1775+
17671776

17681777

1769-
</p>
17701778
<h3 class="heading settled" data-level="4.1" id="visibility-collapse"><span class="secno">4.1. </span><span class="content">
17711779
Collapsed Grid Items: the <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css2/visufx.html#propdef-visibility">visibility</a> property</span><a class="self-link" href="#visibility-collapse"></a></h3>
17721780

@@ -4388,7 +4396,7 @@ <h2 class="heading settled" data-level="9" id="alignment"><span class="secno">9.
43884396

43894397
<p>By default,
43904398
<a data-link-type="dfn" href="#grid-item">grid items</a> stretch to fill their <a data-link-type="dfn" href="#grid-area">grid area</a>.
4391-
However, if <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-align-3/#propdef-justify-self">justify-self</a> or <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-align-3/#propdef-align-self">align-self</a> compute to a value other than <span class="css">stretch</span>
4399+
However, if <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-align-3/#propdef-justify-self">justify-self</a> or <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-align-3/#propdef-align-self">align-self</a> compute to a value other than <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-align-3/#valdef-content-distribution-stretch">stretch</a>
43924400
or margins are <a class="css" data-link-for="margin" data-link-type="value">auto</a>,
43934401
<a data-link-type="dfn" href="#grid-item">grid items</a> will auto-size to fit their contents.</p>
43944402

@@ -4537,7 +4545,7 @@ <h3 class="heading settled" data-level="9.5" id="grid-baselines"><span class="se
45374545

45384546

45394547
<p>A <a data-link-type="dfn" href="#grid-item">grid item</a> <dfn data-dfn-type="dfn" data-export="" id="baseline-participation">participates in baseline alignment<a class="self-link" href="#baseline-participation"></a></dfn> in a particular dimension
4540-
if its value for <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-align-3/#propdef-align-self">align-self</a> or <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-align-3/#propdef-justify-self">justify-self</a>, as appropriate, is <span class="css">baseline</span>
4548+
if its value for <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-align-3/#propdef-align-self">align-self</a> or <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-align-3/#propdef-justify-self">justify-self</a>, as appropriate, is <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-align-3/#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-baseline">baseline</a>
45414549
and its inline axis is parallel to that dimension.</p>
45424550

45434551

0 commit comments

Comments
 (0)