Skip to content

Commit 2a9ace5

Browse files
committed
Added some text about default slots and some issues.
1 parent 5f2497a commit 2a9ace5

1 file changed

Lines changed: 174 additions & 16 deletions

File tree

css3-layout/new.src.html

Lines changed: 174 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,11 @@ <h3 id="placement">
702702
<p>This module replaces and extends the <var class="replaceme">SUMMARIZE HERE</var>
703703
features defined in [[!CSS21]] sections <var class="replaceme">W.X and Y.Z</var>.
704704

705+
706+
<p>See [[!CSS3PAGE]] for the definition of <a
707+
href="http://www.w3.org/TR/css3-multicol/#multi-column-element"
708+
><dfn>multi-column element.</dfn></a>
709+
705710
<h3 id="values">
706711
Values</h3>
707712

@@ -844,7 +849,10 @@ <h2 id=display>
844849

845850
<p>An element is a <dfn>grid element</dfn> (i.e., it defines a grid
846851
for its descendants) if its 'display' value is ''grid'' or ''inline-grid''.
847-
852+
853+
<p>The <dfn>grid ancestor</dfn> of an element is the nearest
854+
ancestor that is a grid element.
855+
848856
<table class="propdef">
849857
<tr>
850858
<th>Name:
@@ -868,10 +876,19 @@ <h2 id=display>
868876
</dl>
869877

870878
<div class="issue">
871-
<p> Should grid elements be created automatically without using 'display'?
872-
This makes it easier to create a grid element, but could create some confusing
873-
dynamics, e.g. what happens if someone later in the cascade sets ''display: table''
874-
or ''display: flex''?
879+
<p>Should grid elements be created automatically without using
880+
'display'? On the one hand, this (a) is not consistent with how flex
881+
boxes are created and (b) could create some confusing dynamics
882+
(e.g., setting ''display: table'' or 'display: flexbox' removes any
883+
grid, but setting 'display: table-cell' or 'display: list-item'
884+
keeps the grid); but (1) requires only one instead of two properties
885+
to create a grid element, (2) allows other block container elements
886+
(such as table cells, table captions, list items, flex
887+
items&hellip;) to contain a grid, without extra keywords for
888+
'display' ('table-cell-grid', 'list-item-grid'&hellip;), and (3) is
889+
consistent with how <a
890+
href="http://www.w3.org/TR/css3-multicol/#multi-column-element"
891+
>multicolumn elements</a> are created.
875892

876893
<p>Proposed text:
877894

@@ -900,6 +917,7 @@ <h2 id=display>
900917
<p class=issue>Use 'fr' unit (as in css3-grid-align) instead of '*' (as
901918
in css3-layout).
902919

920+
903921
<h3 id="grid-lines-tracks">
904922
Grid Lines and Tracks</h3>
905923

@@ -949,7 +967,7 @@ <h3 id="grid-templates">
949967

950968
<p>The 'grid-template' property implicitly assigns a grid to an element
951969
and defines named slots in the grid. It can also designate a slot as the
952-
default slot, for unpositioned content.
970+
<em>default slot,</em> for unpositioned content.
953971

954972
<table class=propdef>
955973
<tr>
@@ -986,7 +1004,7 @@ <h3 id="grid-templates">
9861004
<td><abbr title="follows order of property value definition">per
9871005
grammar</abbr>
9881006
</table>
989-
1007+
9901008
<p>Each string consist of one or more asterisks (“*”), letters,
9911009
periods (“.”), spaces and tabs. Each string represents one row in the
9921010
template, each symbol other than a space or tab represents one
@@ -998,7 +1016,7 @@ <h3 id="grid-templates">
9981016
<dt>&lt;letter&gt;
9991017
<dd>Named slot for content
10001018
<dt>''*'' (asterisk)
1001-
<dd>Default slot for content.
1019+
<dd>Default slot for content (explained below).
10021020
<dt>. (period)
10031021
<dd>Blank space.
10041022
</dl>
@@ -1022,11 +1040,27 @@ <h3 id="grid-templates">
10221040
<p>Each slot (letter or “*”) acts as a block element for its
10231041
contents.
10241042

1043+
<p>If the value is ''none'', then no explicit slots are defined. If
1044+
the element is a <em>grid element,</em> then the element instead has
1045+
an <dfn>implicit template</dfn> consisting of a single, anonymous
1046+
slot. I.e., for a grid element with <var>N</var> columns and
1047+
<var>M</var> rows, the implicit template is equivalent to
1048+
<var>M</var> strings of <var>N</var> asterisks:
1049+
1050+
<pre>
1051+
"***&hellip;***"
1052+
"***&hellip;***"
1053+
&#8942;
1054+
"***&hellip;***"
1055+
</pre>
1056+
1057+
<p class=note>Note that an element is a grid element in this case if
1058+
'grid-columns' and 'grid-rows' are not both ''auto''.
1059+
10251060
<p class=issue>Are grid templates logically oriented (relative to
10261061
writing mode), or absolutely-oriented?
1027-
1028-
<p class=issue>What happens to unpositioned content if there is no
1029-
default slot? Ideally, it shouldn't disappear...
1062+
1063+
10301064

10311065
<h3 id=grid-column-sizes>
10321066
Specifying the widths of columns: 'grid-columns'</h3>
@@ -1200,6 +1234,53 @@ <h3 id="grid-row-sizes">
12001234
<p>The 'grid-rows' property specifies the sizes of the rows of a grid. It
12011235
takes the same values as 'grid-columns'.
12021236

1237+
<h3>Default slots</h3>
1238+
1239+
<p>Every <span>grid element</span> has a <dfn>default slot.</dfn> If
1240+
there is an asterisk (“*”) in the template, then that slot is the
1241+
default. If there is no asterisk, then the first letter in the
1242+
template defines the default slot.
1243+
1244+
<p class=example>For example, if the template is defined by
1245+
'grid-template: "..c" "abb" "abb"', then “c” is the default slot.
1246+
1247+
<p>If the grid has an <em>implicit template</em> (i.e.,
1248+
'grid-template' is ''none''), then the default slot is the single,
1249+
anonymous slot of that implicit template.
1250+
1251+
<p>All content of a grid element that is not inside another flow
1252+
(e.g., because it is inside a float, absolutely positioned, or
1253+
positioned in a different slot with '[grid-]position') is positioned
1254+
in the default flow.
1255+
1256+
<p>In particular, any text content of the grid element itself is
1257+
positioned in the default flow.
1258+
1259+
<div class=example>
1260+
<p>For example, in this document fragment
1261+
1262+
<pre>
1263+
&lt;DIV STYLE="grid-template: "ab*">
1264+
&lt;IMG STYLE="position: a" SRC="image.png" ALT="Foo">
1265+
This is an
1266+
&lt;EM STYLE="position: *">emphasized&lt;/EM>
1267+
&lt;EM STYLE="position: b">(note well!)&lt;/EM>
1268+
sentence.
1269+
&lt;
1270+
&lt;/DIV>
1271+
</pre>
1272+
1273+
<p>The three slots of the grid contain:
1274+
<dl>
1275+
<dt>Slot a <dd>The image
1276+
<dt>Slot b <dd>The text “(note well!)”
1277+
<dt>Default slot <dd>The text “This is an <em>emphasized</em>
1278+
sentence.”
1279+
</dl>
1280+
</div>
1281+
1282+
1283+
12031284
<h3 id="track-sizing">
12041285
Specifying the size of grid tracks</h3>
12051286

@@ -1330,7 +1411,7 @@ <h4 id="computed-values-grid-rows-and-columns">
13301411
<h3 id="slot-widths">
13311412
Calculating the widths of the slots</h3>
13321413

1333-
<p class=issue>If a slot vertical writing mode, then the values
1414+
<p class=issue>If a slot has a vertical writing mode, then the values
13341415
''max-content'' and ''min-content'' both stand for the <i>block dimension</i>
13351416
[[!CSS3-WRITING-MODES]] of the slot's content.
13361417

@@ -1339,10 +1420,9 @@ <h3 id="slot-widths">
13391420
<h3 id="slot-heights">
13401421
Computing the height of the slots</h3>
13411422

1342-
<p class=issue>If a slot has a horizontal writing mode, then
1343-
the values ''max-content'' and ''min-content'' both stand for
1344-
the <em>block dimension</em> [[!CSS3-WRITING-MODES]] of the slot's
1345-
content.
1423+
<p>If a slot has a horizontal writing mode, then the values
1424+
''max-content'' and ''min-content'' both stand for the <em>block
1425+
dimension</em> [[!CSS3-WRITING-MODES]] of the slot's content.
13461426

13471427
<p>[Solve set of constraints as in css3-layout]
13481428

@@ -1457,6 +1537,50 @@ <h3>
14571537
(&lt;identifier&gt;) or by creating an anonymous slot with the given
14581538
row and column coordinates.
14591539

1540+
<p class=issue>It is also possible to re-use 'position' instead of a
1541+
new 'grid-position' property. Advantages: (1) no new property to
1542+
learn, (2) no need to define whether/how 'position' works for elements
1543+
positioned in a grid. Disadvantages: can not set 'position: relative'
1544+
on an element positioned in a grid.
1545+
1546+
<p>Values have the following meaning:
1547+
1548+
<dl>
1549+
<dt>A letter <dd>&hellip;
1550+
1551+
<dt>'*' <dd>Positions the element in the default slot. <span
1552+
class=note>Note that the default slot may be implicit, i.e., every
1553+
<em>grid element</em> has a default slot, even if '*' does not
1554+
explicitly occur in the value of 'grid-template'</span>
1555+
1556+
<dt>&hellip; <dd>&hellip;
1557+
</dl>
1558+
1559+
1560+
1561+
<div class=issue>
1562+
<p>If the letter refers to a slot that doesn't exist in the element's
1563+
<em>grid ancestor</em> (or there is no grid ancestor) what is the
1564+
effect?
1565+
<ol>
1566+
<li>The element is not positioned (i.e., it is positioned in the
1567+
current flow).
1568+
1569+
<li>The letter is looked for in the grid ancestor's own grid
1570+
ancestor, etc., recursively. If no slot of that name is found in any
1571+
of them, then the element is not positioned.
1572+
1573+
<li>The element is positioned in the default slot (i.e., as if
1574+
'[grid-]position: *' had been specified); or not positioned at all,
1575+
in case there is no grid ancestor.
1576+
1577+
<li>The letter is looked for in the grid ancestor's own grid
1578+
ancestor, etc., recursively. If no slot of that name is found in any
1579+
of them, then the element is positioned in the default slot.
1580+
</ol>
1581+
</div>
1582+
1583+
14601584
<div class=issue>
14611585
<p>css3-grid-align allows to define a position either by saying how
14621586
many rows/columns it spans, or by saying at which row and column
@@ -1608,6 +1732,40 @@ <h3 id=coord-positioning>
16081732
<p>'grid-row' and 'grid-column' values that refer to an undefined
16091733
line or slot will compute to ''auto''.
16101734

1735+
1736+
<h3>Floating elements inside templates</h3>
1737+
1738+
<p>An element may be positioned inside a template (with
1739+
'[grid-]position') and be a floating element ('float' property) at
1740+
the same time. The following cases must be distinguished:
1741+
1742+
<dl>
1743+
<dt><a
1744+
href="http://www.w3.org/TR/2011/WD-css3-gcpm-20111129/#page-floats"
1745+
>Page floats</a>
1746+
<dd>
1747+
<p>For the purpose of page floats [[!CSS3PAGE]], the slot acts as a
1748+
page.
1749+
1750+
<p class=example>For example, if an element has 'float: top', it
1751+
floats to the top of the slot (or the top of the current column, if
1752+
it has a <span>multicolumn element</span> as ancestor that is nearer
1753+
than its <span>grid ancestor</span>).
1754+
1755+
1756+
the value of 'float' specifies that the element floats to the top or
1757+
bottom of the page (in a horizontal writing mode) or the left or
1758+
right of the page (in a vertical writing mode), the 'position'
1759+
property doesn't apply.
1760+
1761+
<dt>Other floats
1762+
<dd>
1763+
<p>In other cases, the element floats
1764+
normally within its containing block, which in this case is its slot
1765+
in the template (as defined <a href="#containing-block">above</a>).
1766+
</dl>
1767+
1768+
16111769
<h2 id=slot-pseudo>Styling named slots: the ''::slot()'' pseudo-element</h2>
16121770

16131771
<p>The slots of a <i>template element</i> can be individually

0 commit comments

Comments
 (0)