Skip to content

Commit 19e5e80

Browse files
committed
[css-grid] Move the z-ordering section to Grid Items, to match placement of similar section in Flexbox.
1 parent 700c9a4 commit 19e5e80

2 files changed

Lines changed: 104 additions & 104 deletions

File tree

css-grid/Overview.bs

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,56 @@ Static Position of Grid Container Children</h3>
709709
the absolutely-positioned child has no effect on the size of the containing block
710710
or layout of its contents.
711711

712+
<h3 id='z-order'>
713+
Z-axis Ordering: the 'z-index' property</h3>
714+
715+
<a>Grid items</a> can overlap when they are positioned into intersecting <a>grid areas</a>,
716+
or even when positioned in non-intersecting areas because of negative margins or positioning.
717+
The painting order of <a>grid items</a> is exactly the same as inline blocks [CSS21],
718+
except that <a>order-modified document order</a> is used in place of raw document order,
719+
and 'z-index' values other than <a value for=z-index>auto</a> create a stacking context even if 'position' is ''static''.
720+
Thus the 'z-index' property can easily be used to control the z-axis order of grid items.
721+
722+
<p class='note'>
723+
Note: Descendants that are positioned outside a grid item still participate in any stacking context established by the grid item.
724+
725+
<div class="example">
726+
The following diagram shows several overlapping grid items,
727+
with a combination of implicit source order
728+
and explicit 'z-index'
729+
used to control their stacking order.
730+
731+
<figure>
732+
<img src="images/drawing-order.png" />
733+
734+
<figcaption>Drawing order controlled by z-index and source order.</figcaption>
735+
</figure>
736+
737+
<pre>
738+
&lt;style type="text/css">
739+
#grid {
740+
display: grid;
741+
grid-template-columns: 1fr 1fr;
742+
grid-template-rows: 1fr 1fr
743+
}
744+
#A { grid-column: 1 / span 2; grid-row: 2; align-self: end; }
745+
#B { grid-column: 1; grid-row: 1; z-index: 10; }
746+
#C { grid-column: 2; grid-row: 1; align-self: start; margin-left: -20px; }
747+
#D { grid-column: 2; grid-row: 2; justify-self: end; align-self: start; }
748+
#E { grid-column: 1 / span 2; grid-row: 1 / span 2;
749+
z-index: 5; justify-self: center; align-self: center; }
750+
&lt;/style>
751+
752+
&lt;div id="grid">
753+
&lt;div id="A">A&lt;/div>
754+
&lt;div id="B">B&lt;/div>
755+
&lt;div id="C">C&lt;/div>
756+
&lt;div id="D">D&lt;/div>
757+
&lt;div id="E">E&lt;/div>
758+
&lt;/div>
759+
</pre>
760+
</div>
761+
712762
<h2 id='grid-definition'>
713763
The Explicit Grid</h2>
714764

@@ -2514,56 +2564,6 @@ Aligning the Grid: the 'justify-content' and 'align-content' properties</h3>
25142564
</figure>
25152565
</div>
25162566

2517-
<h3 id='z-order'>
2518-
Z-axis Ordering: the 'z-index' property</h3>
2519-
2520-
<a>Grid items</a> can overlap when they are positioned into intersecting <a>grid areas</a>,
2521-
or even when positioned in non-intersecting areas because of negative margins or positioning.
2522-
The painting order of <a>grid items</a> is exactly the same as inline blocks [CSS21],
2523-
except that <a>order-modified document order</a> is used in place of raw document order,
2524-
and 'z-index' values other than <a value for=z-index>auto</a> create a stacking context even if 'position' is ''static''.
2525-
Thus the 'z-index' property can easily be used to control the z-axis order of grid items.
2526-
2527-
<p class='note'>
2528-
Note: Descendants that are positioned outside a grid item still participate in any stacking context established by the grid item.
2529-
2530-
<div class="example">
2531-
The following diagram shows several overlapping grid items,
2532-
with a combination of implicit source order
2533-
and explicit 'z-index'
2534-
used to control their stacking order.
2535-
2536-
<figure>
2537-
<img src="images/drawing-order.png" />
2538-
2539-
<figcaption>Drawing order controlled by z-index and source order.</figcaption>
2540-
</figure>
2541-
2542-
<pre>
2543-
&lt;style type="text/css">
2544-
#grid {
2545-
display: grid;
2546-
grid-template-columns: 1fr 1fr;
2547-
grid-template-rows: 1fr 1fr
2548-
}
2549-
#A { grid-column: 1 / span 2; grid-row: 2; align-self: end; }
2550-
#B { grid-column: 1; grid-row: 1; z-index: 10; }
2551-
#C { grid-column: 2; grid-row: 1; align-self: start; margin-left: -20px; }
2552-
#D { grid-column: 2; grid-row: 2; justify-self: end; align-self: start; }
2553-
#E { grid-column: 1 / span 2; grid-row: 1 / span 2;
2554-
z-index: 5; justify-self: center; align-self: center; }
2555-
&lt;/style>
2556-
2557-
&lt;div id="grid">
2558-
&lt;div id="A">A&lt;/div>
2559-
&lt;div id="B">B&lt;/div>
2560-
&lt;div id="C">C&lt;/div>
2561-
&lt;div id="D">D&lt;/div>
2562-
&lt;div id="E">E&lt;/div>
2563-
&lt;/div>
2564-
</pre>
2565-
</div>
2566-
25672567
<h3 id='grid-baselines'>
25682568
Grid Baselines</h3>
25692569

0 commit comments

Comments
 (0)