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
@@ -103,18 +107,61 @@ <h2 class="no-num no-toc" id="table">Table of contents</h2>
103
107
104
108
105
109
<h2id="intro">
106
-
Introduction</h2>
110
+
Introduction and Overview</h2>
107
111
108
112
<p><em>This section is not normative.</em>
109
113
110
-
<p>CSS 2.1 defined four layout modes — algorithms which determine the size and position of boxes based on their relationships with their sibling and ancestor boxes: block layout, designed for laying out documents; inline layout, designed for laying out text; table layout, designed for laying out information in a tabular format; and positioned layout, designed for very explicit positioning without much regard for other elements in the document. This module introduces a new layout mode, flex layout, which is designed for laying out more complex applications and webpages.
114
+
<p>
115
+
CSS 2.1 defined four layout modes — algorithms which determine
116
+
the size and position of boxes based on their relationships
117
+
with their sibling and ancestor boxes:
118
+
<ulclass="compact">
119
+
<li>block layout, designed for laying out documents
120
+
<li>inline layout, designed for laying out text
121
+
<li>table layout, designed for laying out 2D data in a tabular format
122
+
<li>positioned layout, designed for very explicit positioning without much regard for other elements in the document
123
+
</ul>
124
+
<p>
125
+
This module introduces a new layout mode, <dfn>flex layout</dfn>,
126
+
which is designed for laying out more complex applications and webpages.
111
127
112
-
<p>Flex layout is superficially similar to block layout. It lacks many of the more complex text or document-formatting properties that can be used in block layout, such as 'float' and 'columns', but in return it gains more simple and powerful tools for aligning its contents in ways that webapps and complex web pages often need.
128
+
<h3id=overview>
129
+
Overview</h3>
130
+
<p><em>This section is not normative.</em>
113
131
114
-
<p>The contents of a flex container can be laid out in any direction (left, right, down, or even up!), can have their order swapped around dynamically (i.e., display order is independent of source order), and can "flex" their sizes and positions to respond to the available space. If a flex container is <i>multi-line</i>, the flex items flow in two dimensions, wrapping into separate lines in a fashion similar to how text is wrapped into multiple lines.
132
+
<p>
133
+
Flex layout is superficially similar to block layout.
134
+
It lacks many of the more complex text- or document-centric properties
135
+
that can be used in block layout, such as
136
+
<ahref="http://www.w3.org/TR/CSS21/visuren.html#floats">floats</a> and
in ways that webapps and complex web pages often need.
141
+
The contents of a flex container:
142
+
<ul>
143
+
<li>
144
+
can be laid out in any <ahref="#flex-direction-property">flow direction</a>
145
+
(leftwards, rightwards, downwards, or even upwards!)
146
+
<li>
147
+
can have their order <ahref="#flex-flow-row-reverse">reversed</a> or
148
+
<ahref="#order-property">rearranged</a> at the style layer
149
+
(i.e., display order can be independent of source order)
150
+
<li>
151
+
can be laid out linearly along a single (<ititle="main axis">main</i>) axis or
152
+
<ahref="#flex-wrap-property">wrapped</a> into multiple lines along a secondary (<ititle="cross axis">cross</i>) axis
153
+
<li>
154
+
can <ahref="#flexibility">“flex” their sizes</a>
155
+
to respond to the available space
156
+
<li>
157
+
can be <ahref="#alignment">aligned</a> with respect to their container or each other
158
+
<li>
159
+
can be dynamically <ahref="#visibility-collapse">collapsed</a> or uncollapsed
160
+
along the <i>main axis</i> while preserving the container's <i>cross size</i>
161
+
</ul>
115
162
116
163
<divclass="example">
117
-
<p>For example, the following HTML snippet uses a flex container to create a toolbar with icons. The flex container is horizontal, and the children's widths don't fill the flex container's width, so the additional space is distributed around and between the children. As the flex container grows (perhaps because the user is viewing the page on a wider screen), the children spread out evenly and automatically:
164
+
<p>For example, the following HTML snippet uses a flex container to create a toolbar with icons.
118
165
119
166
<pre>
120
167
<ul>
@@ -128,6 +175,12 @@ <h2 id="intro">
128
175
/* Irrelevant styling for this example removed. */
129
176
</style></pre>
130
177
178
+
<p>The flex container is horizontal,
179
+
and the children's widths don't fill the flex container's width,
180
+
so the additional space is distributed around and between the children.
181
+
As the flex container grows (perhaps because the user is viewing the page on a wider screen),
0 commit comments