You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: css-grid/Overview.bs
+54-19Lines changed: 54 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -78,28 +78,63 @@ please report them to the CSSWG,
78
78
as this is likely an error.
79
79
80
80
<h2 id='intro'>
81
-
Introduction and Overview</h2>
82
-
83
-
Grid layout contains features targeted at web application authors.
84
-
The grid can be used to achieve many different layouts.
85
-
It excels at dividing up space for major regions of an application,
86
-
as well as defining the relative size, position, and painting order
87
-
for the parts of a control built from HTML primitives.
88
-
89
-
Like tables,
90
-
grid layout enables an author to align elements into columns and rows,
91
-
but unlike tables,
92
-
grid layout doesn't have content structure,
93
-
and thus enables a wide variety of layouts not possible with tables.
94
-
For example, the children of a grid container can position themselves
95
-
such that they overlap similar to positioned elements.
96
-
97
-
In addition, the absence of content structure in grid layout helps to manage changes to layout
98
-
by using fluid and source order independent layout techniques.
99
-
By combining media queries with the CSS properties that control layout of the grid container and its children,
81
+
Introduction</h2>
82
+
83
+
<em>This section is not normative.</em>
84
+
85
+
Like <a href="http://www.w3.org/TR/css-flexbox-1/">Flexible Box Layout</a>,
86
+
Grid Layout is a new layout model for CSS
87
+
that has powerful abilities to control the sizing and positioning of boxes and their contents.
88
+
Unlike Flexbox, however, which is single-axis–oriented,
89
+
Grid Layout is optimized for 2-dimensional layouts:
90
+
those in which alignment of content is desired in both dimensions.
91
+
In addition, and unlike tables,
92
+
the absence of content structure in grid layout helps to manage changes to layout
93
+
by allowing fluid and source order independent layout techniques.
94
+
By combining <a href="http://www.w3.org/TR/css3-mediaqueries/">media queries</a> with the CSS properties that control layout of the grid container and its children,
100
95
authors can adapt their layout to changes in device form factors, orientation, and available space,
101
96
without needing to alter the semantic nature of their content.
102
97
98
+
<h2 id='overview'>
99
+
Overview</h2>
100
+
101
+
Grid Layout controls the layout of its content
102
+
through the use of a <a>grid</a>:
103
+
an intersecting set of horizontal and vertical lines
104
+
which create a sizing and positioning coordinate system
105
+
for the <a>grid container</a>’s contents.
106
+
The contents of the <a>grid container</a> are organized into <a>grid items</a>
107
+
(analogous to <a>flex items</a>),
108
+
which are then assigned to slots (<a>grid areas</a>) in the <a>grid</a>--
109
+
either explicitly through the <a>grid placement properties</a>
110
+
or implicitly through <a href="#auto-placement">auto-placement</a>.
111
+
If the <a>explicit grid</a>
112
+
(defined by the 'grid-template-*' properties)
113
+
can’t fit all of the <a>grid items</a>,
114
+
<a>implicit grid tracks</a> are added
115
+
(as defined by the 'grid-auto-*' properties).
116
+
A 'grid' shorthand on the <a>grid container</a>
117
+
provides for setting all of these grid definition parameters at once,
118
+
while the <a>grid placement properties</a> on the <a>grid items</a>
119
+
determine their placement within the grid.
120
+
121
+
Once the <a>grid items</a> have been <a href="#placement">placed</a>,
122
+
the sizes of the <a>grid tracks</a> (rows and columns) are calculated,
123
+
accounting for the sizes of their contents and/or available space as specified in the grid definition.
124
+
The sized grid is then aligned within its <a>grid container</a>
125
+
according to the <a>grid container</a>’s 'align-content' and 'justify-content' properties.
126
+
Finally each <a>grid item</a> is sized and aligned within its assigned <a>grid area</a>,
127
+
as specified by its own sizing and alignment properties.
128
+
129
+
Grid Layout features
130
+
fixed, flexible, and content-based <a href="#track-sizing">track sizing functions</a>;
131
+
<a href="#placement">explicit item positioning</a> via forwards (positive) and backwards(negative) numbered grid coordinates,
132
+
named grid lines, and named grid areas;
133
+
automatic item placement into empty slots, including <a href="#order-property">reordering with <css>order</css>;
134
+
automatic addition of rows or columns to accommodate additional content;
135
+
control over alignment and spacing with
136
+
<a href="#auto-margins">margins</a>, <a>gutters</a>, and the <a href="http://www.w3.org/TR/css-align/">alignment properties</a>;
137
+
and the ability to overlap content and <a href="#z-order">control layering with <css>z-index</css></a>.
0 commit comments