Skip to content

Commit e161565

Browse files
committed
[css3-layout] Added 'position: grid' (and 'display: grid' as its
abbreviation) for switching between 'flow' and 'grid-area'.
1 parent 9f4e5d4 commit e161565

1 file changed

Lines changed: 70 additions & 52 deletions

File tree

css-template/Overview.src.html

Lines changed: 70 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,25 +1743,7 @@ <h3 id=slot-sizes>Calculating the size of the grid</h3>
17431743

17441744
<!--=================================================================-->
17451745

1746-
<h2 id=positioning>Putting content into a grid element</h2>
1747-
1748-
<p><em>This section until the next subsection is not normative.</em>
1749-
1750-
<p>Grids can be used in two different ways to position content. The
1751-
first way is to flow content into slots (either into explicit slots
1752-
identified by name, or the default slot “*”). Each slot is an
1753-
individual flow root (“establishes a block formatting context” in the
1754-
terminology of CSS level 2), very much like a table cell.
1755-
1756-
<p>The second way is to absolutely position elements using
1757-
four <em>grid lines</em> to specify the positions of the four margin
1758-
edges of the element. Like other positioned elements
1759-
[[!CSS21]], these elements can overlap each other and the 'z-index'
1760-
property applies to them.
1761-
1762-
<!--=================================================================-->
1763-
1764-
<h3 id=flow>Flowing content into slots: 'flow'</h3>
1746+
<h2 id=flow>Flowing content into slots: 'flow'</h2>
17651747

17661748
<p>The 'flow' property adds an element to a slot.
17671749

@@ -2156,19 +2138,76 @@ <h3 id=flow>Flowing content into slots: 'flow'</h3>
21562138

21572139
<!--=================================================================-->
21582140

2141+
<h2 id=absolute>Absolute positioning on top of a grid</h2>
2142+
2143+
<p><em>This section, until the next subsection, is not normative.</em>
2144+
2145+
<p>A new ''grid'' value of the 'position' property allows alements to
2146+
be taken out of their parent's flow (as with 'position: absolute' or
2147+
'position: fixed') while still using the grid lines for alignments and
2148+
also still contributing to the size of slots.
2149+
2150+
<p>For the special case that all children of a <em>grid element</em>
2151+
are to be positioned in this way (which is expected to be common when
2152+
HTML and CSS are used to create <abbr title="Graphical User
2153+
Interfaces">GUIs</abbr>), a new ''grid'' value for 'display' provides
2154+
an abbreviation.
2155+
2156+
<p>
2157+
2158+
<!--=================================================================-->
2159+
2160+
<h3>Taking elements out of the flow with 'position: grid' or 'display: grid'</h3>
2161+
2162+
<table class=propdef-extra>
2163+
<tbody>
2164+
<tr><th>Name: <td><dfn>position</dfn>
2165+
<tr><th><a href="#values" >Value</a>: <td>grid
2166+
</table>
2167+
2168+
<table class=propdef-extra>
2169+
<tbody>
2170+
<tr><th>Name: <td><dfn>display</dfn>
2171+
<tr><th><a href="#values" >Value</a>: <td>grid
2172+
</table>
2173+
2174+
<p>Setting 'position: grid' on an element that has a <em>grid
2175+
ancestor</em> causes the element to be taken out of the flow of its
2176+
parent and positioned with 'grid-area'. It also sets the computed
2177+
value of 'displa' to 'block'. If the element does not have a grid
2178+
ancestor, 'position: grid' is treated as if it were 'position: static'
2179+
and 'display' is not affected.
2180+
2181+
<p>Setting 'display: grid' on an element has the same effect as
2182+
setting 'display: block'. In addition, when the element is a <em>grid
2183+
element,</em> it sets the computed value of 'position' on its children
2184+
to ''grid''.
2185+
2186+
<div class=example>
2187+
<p>For example, the following two style sheets are equivalent:
2188+
<pre>
2189+
DIV {grid: "a b c"; display: block}
2190+
DIV > * {position: grid}
2191+
</pre>
2192+
2193+
<p>and
2194+
<pre>
2195+
DIV {grid: "a b c"; display: grid}
2196+
</pre>
2197+
</div>
2198+
21592199
<h3>Stacking elements on top of a grid: 'grid-area' and 'grid-auto'</h3>
21602200

21612201
<table class=propdef>
21622202
<tbody>
21632203
<tr><th>Name: <td><dfn>grid-area</dfn>
2164-
<tr><th><a href="#values" >Value</a>: <td>none | auto |
2204+
<tr><th><a href="#values" >Value</a>: <td>auto |
21652205
<var>&lt;identifier&gt;</var> | <var>&lt;string&gt;</var> | [
21662206
<var>&lt;integer&gt;</var> | same | next ]{2} [
21672207
<var>&lt;integer&gt;</var>{2} ]?
21682208
<tr><th>Initial: <td>none
21692209
<tr><th>Applies to: <td>elements that have a <span>grid
2170-
ancestor</span> and whose 'position' is equal to 'static' or
2171-
'relative'
2210+
ancestor</span> and whose 'position' is equal to 'grid'
21722211
<tr><th>Inherited: <td>no
21732212
<tr><th>Animatable: <td>no
21742213
<tr><th>Percentages: <td>N/A
@@ -2184,8 +2223,7 @@ <h3>Stacking elements on top of a grid: 'grid-area' and 'grid-auto'</h3>
21842223
<tr><th><a href="#values" >Value</a>: <td>none | rows | columns
21852224
<tr><th>Initial: <td>none
21862225
<tr><th>Applies to: <td>elements that have a <span>grid
2187-
ancestor</span> and whose 'position' is equal to 'static' or
2188-
'relative'
2226+
ancestor</span> and whose 'position' is equal to 'grid'
21892227
<tr><th>Inherited: <td>yes
21902228
<tr><th>Animatable: <td>no
21912229
<tr><th>Percentages: <td>N/A
@@ -2196,18 +2234,6 @@ <h3>Stacking elements on top of a grid: 'grid-area' and 'grid-auto'</h3>
21962234
</table>
21972235

21982236
<div class=issue>
2199-
<p>In [[CSS3-GRID-LAYOUT]] (version of April 2013) there is no
2200-
'grid-area: none' but 'grid-area' only applies when 'position' is set
2201-
to 'grid' (a new keyword).
2202-
2203-
<p>There was also discussion (at the June 2013 ftf) to set a property
2204-
on the grid element itself to enable positioning of descendants. When
2205-
set (e.g., 'grid-mode: absolute'), all children are placed by means of
2206-
their 'grid-area' property, when not set ('grid-mode: normal'),
2207-
'grid-area' is ignored. That would preclude mixing flowing and
2208-
positioned descendants (except, perhaps, if it is an inherited
2209-
property and descendants can override it).
2210-
22112237
<p>At the Aug 2012 ftf, Florian suggested a property 'collision: auto
22122238
| collide | avoid' to switch between overlapping and not overlapping.
22132239
(It would avoid collisions for absolutely positioned elements as
@@ -2224,19 +2250,13 @@ <h3>Stacking elements on top of a grid: 'grid-area' and 'grid-auto'</h3>
22242250
'grid-area' may be easier to learn.
22252251
</div>
22262252

2227-
<p>The 'grid-area' property can take an element out of the flow and
2228-
position it relative to a grid. Unless the value of 'grid-area' is
2229-
''none'', the 'z-index' property applies and determines the
2230-
stacking level. If the element has no <span>grid ancestor,</span> the
2231-
element is positioned as if the value were ''none''. The values have
2232-
the following meanings:
2253+
<p>The 'grid-area' property positions an element relative to a grid.
2254+
If the property applies, the 'z-index' property determines the
2255+
stacking level.
22332256

2234-
<dl>
2235-
<dt>none
2236-
<dd>
2237-
<p>The element is positioned according to its 'flow'
2238-
property.
2257+
<p>The values have the following meanings:
22392258

2259+
<dl>
22402260
<dt><var>&lt;identifier&gt;</var>
22412261
<dt><var>&lt;string&gt;</var>
22422262
<dd>
@@ -2249,11 +2269,9 @@ <h3>Stacking elements on top of a grid: 'grid-area' and 'grid-auto'</h3>
22492269
''default'', ''same'', or ''next''. This is to avoid ambiguity with
22502270
the keywords of the same name.
22512271

2252-
<p>If the name refers to a non-existent slot, the value is interpreted
2253-
as if it were ''none''.
2254-
2255-
<p class=issue>See the <a href="#non-existent-slot">issue about
2256-
non-existent slot names</a> under 'flow' for other possibilities.
2272+
<p>If the name refers to a non-existent slot, <span
2273+
class=issue>[define (see the <a href="#non-existent-slot">issue about
2274+
non-existent slot names</a> under 'flow' for possibilities).</span>
22572275
<dt>
22582276

22592277
<dt>auto

0 commit comments

Comments
 (0)