css3-flexbox/Overview.html

Thu, 14 Mar 2013 14:54:35 -0700

author
Tab Atkins Jr. <jackalmage@gmail.com>
date
Thu, 14 Mar 2013 14:54:35 -0700
changeset 7745
9437131b3d6e
parent 7649
9895709f0a81
child 7746
c63e994df5a4
permissions
-rw-r--r--

[css3-flexbox] Per WG resolution, revert min-width/height back to 0. Adjust examples as appropriate, and add note recommending using it manually.

jackalmage@5934 1 <!DOCTYPE html>
jackalmage@5934 2
jackalmage@5934 3 <html lang=en>
jackalmage@6823 4 <head>
jackalmage@6613 5 <meta content="text/html; charset=utf-8" http-equiv=Content-Type>
jackalmage@5934 6 <title>CSS Flexible Box Layout Module</title>
jackalmage@6823 7 <!--
jackalmage@6823 8 <link href="http://purl.org/dc/terms/" rel="schema.dcterms">
jackalmage@6823 9 <link href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright" rel="dcterms.rights">
jackalmage@6823 10 -->
jackalmage@6823 11
jackalmage@6823 12 <meta content="CSS Flexible Box Layout Module" name=dcterms.title>
jackalmage@6823 13 <meta content=text name=dcterms.type>
jackalmage@7745 14 <meta content=2013-03-14 name=dcterms.issued>
jackalmage@6823 15 <meta content="http://dev.w3.org/csswg/css3-flexbox/" name=dcterms.creator>
jackalmage@6823 16 <meta content=W3C name=dcterms.publisher>
tantek@7527 17 <meta content="http://dev.w3.org/csswg/css3-flexbox/"
jackalmage@6823 18 name=dcterms.identifier>
jackalmage@5934 19 <link href="http://dev.w3.org/csswg/default.css" rel=stylesheet
jackalmage@6613 20 type="text/css">
ratan@7296 21 <link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
jackalmage@6823 22 <link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel=stylesheet
jackalmage@6613 23 type="text/css">
jackalmage@6092 24 <style>
jackalmage@6092 25 code.one-line { white-space: pre; }
jackalmage@6092 26 .code-and-figure {
jackalmage@6092 27 display: table;
jackalmage@6092 28 margin: 0 auto;
jackalmage@6092 29 border-spacing: 1em;
jackalmage@6092 30 }
jackalmage@6092 31 .code-and-figure > div {
jackalmage@6092 32 display: table-cell;
jackalmage@6092 33 vertical-align: middle;
jackalmage@6092 34 }
jackalmage@6092 35 :not(code) var { font-style: normal; color: #005A9C; }
jackalmage@6092 36
jackalmage@6092 37 i { font-style: normal; }
jackalmage@6092 38
jackalmage@6092 39 ol[start="0"] { counter-reset: list -1; }
jackalmage@6092 40 ol[start="0"],
jackalmage@6092 41 ol.continue { list-style: none; }
jackalmage@6092 42 ol[start="0"] > li,
jackalmage@6092 43 ol.continue > li { position: relative; counter-increment: list; }
jackalmage@6092 44 ol[start="0"] > li::before,
jackalmage@6092 45 ol.continue > li::before { content: counter(list) "."; position: absolute; left: -4.5em; width: 4em; text-align: right; }
fantasai@6124 46 .compact, .compact li {
fantasai@6124 47 margin-top: 0;
fantasai@6124 48 margin-bottom: 0;
fantasai@6124 49 }
fantasai@6148 50
fantasai@6267 51 /* Overview catalog example */
fantasai@6267 52 #overview-example {
fantasai@6267 53 display:table;
fantasai@6267 54 margin: 0 auto 1em;
fantasai@6267 55 border-spacing: .5em 0;
fantasai@6267 56 min-width: 672px;
fantasai@6267 57 }
fantasai@6267 58 #overview-example > .col {
fantasai@6267 59 display: table-column;
fantasai@6267 60 background: hsl(60,100%,90%);
fantasai@6267 61 }
fantasai@6267 62 #overview-example > .desc {
fantasai@6267 63 display: table-cell;
fantasai@6267 64 vertical-align: top;
fantasai@6267 65 width: 300px;
fantasai@6267 66 padding: 1em 1em 0;
fantasai@6267 67 text-align: left;
fantasai@6267 68 border: thick solid hsl(60,80%,50%);
fantasai@6267 69 border-radius: 1em 1em 0 0;
fantasai@6267 70 border-bottom: none;
fantasai@6267 71 }
fantasai@6267 72 #overview-example > .desc > img {
fantasai@6267 73 margin: 0 auto;
fantasai@6267 74 display: block;
fantasai@6267 75 }
fantasai@6267 76 #overview-example > .desc > h1 {
fantasai@6267 77 background: transparent;
fantasai@6267 78 }
fantasai@6267 79 #overview-example > .buttons {
fantasai@6267 80 display: table-row;
fantasai@6267 81 }
fantasai@6267 82 #overview-example > .buttons > div {
fantasai@6267 83 display: table-cell;
fantasai@6267 84 border: thick solid hsl(60,80%,50%);
fantasai@6267 85 border-radius: 0 0 1em 1em;
fantasai@6267 86 border-top: none;
fantasai@6267 87 text-align: center;
fantasai@6267 88 }
fantasai@6267 89 #overview-example button {
fantasai@6267 90 background-color: hsl(120,100%,40%);
fantasai@6267 91 border: medium inset hsl(120,70%,40%);
fantasai@6267 92 border-radius: 1em;
fantasai@6267 93 padding: .5em;
fantasai@6267 94 font-weight: bold;
fantasai@6267 95 color: white;
fantasai@6267 96 font-size: 1.6em;
fantasai@6267 97 cursor: pointer;
fantasai@6267 98 width: 90%;
fantasai@6267 99 margin: 1em auto;
fantasai@6267 100 }
fantasai@6267 101
fantasai@6148 102 /* Visibility: Collapse example */
fantasai@6148 103 #visibility-collapse-example {
fantasai@6148 104 display: table;
fantasai@6148 105 width: 100%;
fantasai@6148 106 box-shadow: 3px 3px 10px #333;
fantasai@6148 107 }
fantasai@6267 108 #visibility-collapse-example > article,
fantasai@6148 109 #visibility-collapse-example > nav {
fantasai@6148 110 display: table-cell;
fantasai@6148 111 }
fantasai@6267 112 #visibility-collapse-example > article {
fantasai@6148 113 width: 100%;
fantasai@6148 114 background: white;
fantasai@6148 115 }
fantasai@6148 116 #visibility-collapse-example ul,
fantasai@6148 117 #visibility-collapse-example li {
fantasai@6148 118 list-style: none;
fantasai@6148 119 margin: 0;
fantasai@6148 120 padding: 0;
fantasai@6148 121 }
fantasai@6151 122 #visibility-collapse-example > nav > ul {
fantasai@6152 123 background: #444;
fantasai@6151 124 border-radius: 0.5em;
fantasai@6159 125 padding: 0.075em;
fantasai@6151 126 }
fantasai@6148 127 #visibility-collapse-example li {
fantasai@6148 128 padding: 0 0.5em;
fantasai@6152 129 background: #ddd;
fantasai@6148 130 color: black;
fantasai@6159 131 border-radius: 0.40em;
fantasai@6159 132 border: #444 solid 0.075em;
fantasai@6148 133 }
fantasai@6148 134 #visibility-collapse-example li li {
fantasai@6152 135 background: #444;
fantasai@6148 136 color: white;
fantasai@6148 137 margin: 0 -0.5em;
fantasai@6151 138 border-radius: 0;
fantasai@6151 139 }
fantasai@6151 140 #visibility-collapse-example li li:first-child {
fantasai@6151 141 border-radius: 0.375em 0.375em 0 0;
fantasai@6148 142 }
fantasai@6148 143 #visibility-collapse-example a {
fantasai@6148 144 background: transparent;
fantasai@6148 145 color: inherit;
fantasai@6148 146 }
fantasai@6148 147 #visibility-collapse-example > nav > ul > li:target,
fantasai@6148 148 #visibility-collapse-example > nav > ul > li:hover {
fantasai@6152 149 background: #888;
fantasai@6148 150 color: white;
fantasai@6148 151 }
fantasai@6148 152 #visibility-collapse-example > nav > ul > li:not(:target):not(:hover) > ul {
fantasai@6148 153 height: 0;
fantasai@6148 154 overflow: hidden;
fantasai@6148 155 }
jackalmage@6150 156
fantasai@6267 157 #auto-bar {
fantasai@6267 158 overflow: hidden;
fantasai@6267 159 padding: .25em 1em;
fantasai@6267 160 background: #ddd;
fantasai@6267 161 list-style: none;
fantasai@6267 162 margin: 0;
fantasai@6267 163 border-radius: .3em;
fantasai@6267 164 }
fantasai@6267 165 #auto-bar > li {
fantasai@6930 166 float: left;
fantasai@6267 167 color: black;
fantasai@6267 168 margin: 0;
fantasai@6267 169 }
fantasai@6267 170 #auto-bar > li:first-child:after,
fantasai@6267 171 #auto-bar > li:first-child + li:after {
fantasai@6267 172 content: " | ";
fantasai@6267 173 white-space: pre;
fantasai@6267 174 }
fantasai@6267 175 #auto-bar > li > a {
fantasai@6267 176 display: inline-block;
fantasai@6267 177 padding: 0 .25em;
fantasai@6267 178 border-radius: .3em;
fantasai@6267 179 }
fantasai@6267 180 #auto-bar > li > a:not(:hover):not(:focus) {
fantasai@6267 181 text-decoration: none;
fantasai@6267 182 }
fantasai@6267 183 #auto-bar > li > a:hover {
fantasai@6267 184 color: #ddd;
fantasai@6267 185 background: #444;
fantasai@6267 186 }
fantasai@6267 187 #auto-bar > #login { float: right; }
fantasai@6267 188
fantasai@6267 189
fantasai@6267 190 .cross-auto-figure > div {
fantasai@6267 191 margin: 0 auto;
fantasai@6267 192 width: 70px;
fantasai@6267 193 background: #888;
fantasai@6267 194 padding: 0 .5em;
fantasai@6267 195 border-radius: 1em;
fantasai@6267 196 border: 1px solid transparent;
fantasai@6267 197 }
fantasai@6267 198 .cross-auto-figure > div > div {
fantasai@6267 199 border-spacing: 0;
fantasai@6267 200 display: table;
fantasai@6267 201 background: #ddd;
fantasai@6267 202 color: black;
fantasai@6267 203 text-align: center;
fantasai@6267 204 margin: .5em auto;
fantasai@6267 205 padding: .5em;
fantasai@6267 206 border-radius: .5em;
fantasai@6267 207 }
fantasai@6267 208
jackalmage@6149 209 .axis { color: hsl( 0,80%,40%); }
jackalmage@6149 210 .side { color: hsl(240,80%,50%); }
jackalmage@6149 211 .size { color: hsl(120,80%,30%); }
jackalmage@5934 212 </style>
jackalmage@5934 213
tantek@7527 214 <body class=h-entry>
jackalmage@5934 215 <div class=head> <!--begin-logo-->
jackalmage@5934 216 <p><a href="http://www.w3.org/"><img alt=W3C height=48
jackalmage@5934 217 src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
jackalmage@5934 218
tantek@7527 219 <h1 class=p-name id=head-box-flexible>CSS Flexible Box Layout Module</h1>
tantek@7527 220
tantek@7527 221 <h2 class="no-num no-toc" id=w3c-working>Editor's Draft, <time
jackalmage@7745 222 class=dt-updated datetime=20130314>14 March 2013</time></h2>
jackalmage@5934 223
jackalmage@5934 224 <dl>
jackalmage@5934 225 <dt>This version:
jackalmage@7745 226 <!--<dd><a class="u-url" href="http://dev.w3.org/csswg/css3-flexbox/">http://www.w3.org/TR/2013/CR-css3-flexbox-20130314/</a>-->
tantek@7527 227
tantek@7527 228 <dd><a class=u-url
tantek@7527 229 href="http://dev.w3.org/csswg/css3-flexbox/">http://dev.w3.org/csswg/css3-flexbox/</a>
tantek@7527 230
tantek@7527 231 <dt>Latest version:
tantek@7527 232 <!--<dd><a href="http://www.w3.org/TR/css3-flexbox/">http://www.w3.org/TR/css3-flexbox/</a>-->
tantek@7527 233
tantek@7527 234 <dd><a
tantek@7527 235 href="http://www.w3.org/TR/css3-flexbox/">http://www.w3.org/TR/css3-flexbox/</a>
tantek@7527 236
tantek@7527 237 <dt>Editor's Draft:
jackalmage@6823 238
jackalmage@6823 239 <dd><a
jackalmage@6823 240 href="http://dev.w3.org/csswg/css3-flexbox/">http://dev.w3.org/csswg/css3-flexbox/</a>
jackalmage@6823 241
jackalmage@6823 242 <dt>Previous version:
fantasai@6712 243
tantek@7527 244 <dd><a href="http://www.w3.org/TR/2012/CR-css3-flexbox-20120921/"
tantek@7527 245 rel=previous>http://www.w3.org/TR/2012/CR-css3-flexbox-20120921/</a>
jackalmage@5934 246
jackalmage@5934 247 <dt>Issues List:
jackalmage@5934 248
jackalmage@5934 249 <dd><a
jackalmage@5934 250 href="https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&amp;component=Flexbox&amp;resolution=---">Bugzilla
jackalmage@5934 251 Bugs for Flexbox</a>
jackalmage@5934 252
jackalmage@5934 253 <dt>Discussion:
jackalmage@5934 254
jackalmage@5934 255 <dd><a
jackalmage@5934 256 href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a>
jackalmage@5934 257 with subject line "<code>[css3-flexbox] …message topic…</code>"
jackalmage@5934 258
jackalmage@5934 259 <dt>Editors:
jackalmage@5934 260
tantek@7527 261 <dd class="p-author h-card vcard"><a class="p-name fn u-url url"
tantek@7527 262 href="http://www.xanthir.com/contact" rel=author>Tab Atkins Jr.</a>,
tantek@7527 263 <span class="p-org org">Google Inc.</span>
tantek@7527 264
tantek@7527 265 <dd class="p-author h-card vcard"><a class="p-name fn u-url url"
tantek@7527 266 href="http://fantasai.inkedblade.net/contact" rel=author>Elika J.
tantek@7527 267 Etemad</a>, <span class="p-org org">Mozilla</span>
tantek@7527 268
tantek@7527 269 <dd class="p-author h-card vcard"><span class="p-name fn">Rossen
tantek@7527 270 Atanassov</span>, <span class="p-org org">Microsoft Corporation</span>,
tantek@7527 271 <a class="u-email email"
ratan@7296 272 href="mailto:ratan@microsoft.com">ratan@microsoft.com</a>
ratan@7296 273
ratan@7296 274 <dt>Authors and former editors:
ratan@7296 275
tantek@7527 276 <dd class="p-author h-card"><span class=p-name>Alex Mogilevsky</span>,
tantek@7527 277 <span class=p-org>Microsoft Corporation</span>, <a class=u-email
jackalmage@5934 278 href="mailto:alexmog@microsoft.com">alexmog@microsoft.com</a>
jackalmage@5934 279
tantek@7527 280 <dd class="p-author h-card"><span class=p-name>L. David Baron</span>,
tantek@7527 281 <span class=p-org>Mozilla Corporation</span>, <a class=u-email
jackalmage@5934 282 href="mailto:dbaron@dbaron.org">dbaron@dbaron.org</a>
jackalmage@5934 283
tantek@7527 284 <dd class="p-author h-card"><span class=p-name>Neil Deakin</span>, <span
tantek@7527 285 class=p-org>Mozilla Corporation</span>, <a class=u-email
jackalmage@5934 286 href="mailto:enndeakin@gmail.com">enndeakin@gmail.com</a>
jackalmage@5934 287
tantek@7527 288 <dd class="p-author h-card"><span class=p-name>Ian Hickson</span>,
tantek@7527 289 formerly of Opera Software, <a class=u-email
jackalmage@5934 290 href="mailto:ian@hixie.ch">ian@hixie.ch</a>
jackalmage@5934 291
tantek@7527 292 <dd class="p-author h-card"><span class=p-name>David Hyatt</span>,
tantek@7527 293 formerly of Netscape Corporation, <a class=u-email
jackalmage@5934 294 href="mailto:hyatt@apple.com">hyatt@apple.com</a>
jackalmage@5934 295 </dl>
jackalmage@5934 296 <!--begin-copyright-->
jackalmage@5934 297 <p class=copyright><a
jackalmage@5934 298 href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
jackalmage@7178 299 rel=license>Copyright</a> © 2013 <a href="http://www.w3.org/"><abbr
jackalmage@5934 300 title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a
jackalmage@5934 301 href="http://www.csail.mit.edu/"><abbr
jackalmage@5934 302 title="Massachusetts Institute of Technology">MIT</abbr></a>, <a
jackalmage@5934 303 href="http://www.ercim.eu/"><abbr
jackalmage@5934 304 title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
fantasai@7247 305 <a href="http://www.keio.ac.jp/">Keio</a>, <a
fantasai@7247 306 href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. W3C <a
jackalmage@5934 307 href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
jackalmage@5934 308 <a
jackalmage@5934 309 href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
jackalmage@5934 310 and <a
jackalmage@5934 311 href="http://www.w3.org/Consortium/Legal/copyright-documents">document
jackalmage@5934 312 use</a> rules apply.</p>
jackalmage@5934 313 <!--end-copyright-->
jackalmage@5934 314 <hr title="Separator for header">
jackalmage@5934 315 </div>
jackalmage@5934 316
jackalmage@5934 317 <h2 class="no-num no-toc" id=abstract> Abstract</h2>
jackalmage@5934 318
tantek@7527 319 <p> <span class=p-summary> The specification describes a CSS box model
tantek@7527 320 optimized for user interface design. In the flex layout model, the
tantek@7527 321 children of a flex container can be laid out in any direction, and can
tantek@7527 322 "flex" their sizes, either growing to fill unused space or shrinking to
tantek@7527 323 avoid overflowing the parent. </span> Both horizontal and vertical
tantek@7527 324 alignment of the children can be easily manipulated. Nesting of these
tantek@7527 325 boxes (horizontal inside vertical, or vertical inside horizontal) can be
tantek@7527 326 used to build layouts in two dimensions.
jackalmage@5934 327
jackalmage@5934 328 <h2 class="no-num no-toc" id=status>Status of this document</h2>
jackalmage@5934 329 <!--begin-status-->
jackalmage@5934 330
jackalmage@6823 331 <p>This is a public copy of the editors' draft. It is provided for
jackalmage@6823 332 discussion only and may change at any moment. Its publication here does
jackalmage@6823 333 not imply endorsement of its contents by W3C. Don't cite this document
jackalmage@6823 334 other than as work in progress.
jackalmage@6823 335
jackalmage@6823 336 <p>The (<a
jackalmage@5934 337 href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
jackalmage@6096 338 mailing list <a
jackalmage@6096 339 href="mailto:www-style@w3.org?Subject=%5Bcss3-flexbox%5D%20PUT%20SUBJECT%20HERE">
jackalmage@6096 340 www-style@w3.org</a> (see <a
jackalmage@6823 341 href="http://www.w3.org/Mail/Request">instructions</a>) is preferred for
jackalmage@6823 342 discussion of this specification. When sending e-mail, please put the text
jackalmage@6823 343 “css3-flexbox” in the subject, preferably like this:
jackalmage@6823 344 “[<!---->css3-flexbox<!---->] <em>…summary of comment…</em>”
jackalmage@6823 345
jackalmage@7745 346 <p>This document was produced by the <a
jackalmage@7745 347 href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part of
jackalmage@7745 348 the <a href="http://www.w3.org/Style/">Style Activity</a>).
jackalmage@5934 349
jackalmage@5934 350 <p>This document was produced by a group operating under the <a
jackalmage@7745 351 href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
jackalmage@7745 352 2004 W3C Patent Policy</a>. W3C maintains a <a
jackalmage@7745 353 href="http://www.w3.org/2004/01/pp-impl/32061/status"
jackalmage@5934 354 rel=disclosure>public list of any patent disclosures</a> made in
jackalmage@5934 355 connection with the deliverables of the group; that page also includes
jackalmage@5934 356 instructions for disclosing a patent. An individual who has actual
jackalmage@5934 357 knowledge of a patent which the individual believes contains <a
jackalmage@7745 358 href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
jackalmage@6823 359 Claim(s)</a> must disclose the information in accordance with <a
jackalmage@7745 360 href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
jackalmage@7745 361 6 of the W3C Patent Policy</a>.</p>
jackalmage@5934 362 <!--end-status-->
jackalmage@5934 363
fantasai@6712 364 <p>The CR period will last at least until 20 March 2013. At the time of
fantasai@6712 365 publication, no test suite and implementation report have yet been made.
fantasai@6712 366 They will be made available from the <a href="/Style/CSS/Test/">CSS test
fantasai@6712 367 suites page</a>. See the section <a href="#cr-exit-criteria">“CR exit
fantasai@6712 368 criteria”</a> for details.
fantasai@6712 369
fantasai@6712 370 <p>See the section <a href="#changes">“Changes”</a> for changes made to
fantasai@6712 371 this specification since the last Working Draft.
fantasai@6712 372
fantasai@6712 373 <p> The following features are at-risk:
fantasai@6712 374
fantasai@6712 375 <ul>
fantasai@6712 376 <li>Calculation of the static position of absolutely-positioned flex
fantasai@6712 377 items.
fantasai@6712 378 </ul>
fantasai@5957 379
jackalmage@5934 380 <h2 class="no-num no-toc" id=table>Table of contents</h2>
jackalmage@5934 381 <!--begin-toc-->
jackalmage@5934 382
jackalmage@5934 383 <ul class=toc>
fantasai@6126 384 <li><a href="#intro"><span class=secno>1. </span> Introduction</a>
jackalmage@5934 385 <ul class=toc>
fantasai@6124 386 <li><a href="#overview"><span class=secno>1.1. </span> Overview</a>
fantasai@6124 387
fantasai@6124 388 <li><a href="#placement"><span class=secno>1.2. </span> Module
jackalmage@5934 389 interactions</a>
jackalmage@5934 390
fantasai@6124 391 <li><a href="#values"><span class=secno>1.3. </span> Values</a>
jackalmage@5934 392 </ul>
jackalmage@5934 393
jackalmage@5934 394 <li><a href="#box-model"><span class=secno>2. </span> Flex Layout Box
fantasai@6134 395 Model and Terminology</a>
jackalmage@5934 396
fantasai@5957 397 <li><a href="#flex-containers"><span class=secno>3. </span> Flex
fantasai@5957 398 Containers: the ‘<code class=css>flex</code>’ and ‘<code
jackalmage@5934 399 class=css>inline-flex</code>’ ‘<code class=property>display</code>’
jackalmage@5934 400 values</a>
jackalmage@5934 401
jackalmage@5934 402 <li><a href="#flex-items"><span class=secno>4. </span> Flex Items</a>
jackalmage@5934 403 <ul class=toc>
jackalmage@6317 404 <li><a href="#abspos-items"><span class=secno>4.1. </span>
jackalmage@6823 405 Absolutely-Positioned Flex Children</a>
jackalmage@6317 406
jackalmage@6317 407 <li><a href="#item-margins"><span class=secno>4.2. </span> Flex Item
fantasai@6210 408 Margins</a>
fantasai@6210 409
jackalmage@6317 410 <li><a href="#painting"><span class=secno>4.3. </span> Flex Item
jackalmage@7649 411 Z-Ordering</a>
fantasai@6210 412
jackalmage@6317 413 <li><a href="#visibility-collapse"><span class=secno>4.4. </span>
jackalmage@5934 414 Collapsed Items</a>
jackalmage@5934 415 </ul>
jackalmage@5934 416
tantek@7527 417 <li><a href="#flow-order"><span class=secno>5. </span> Ordering and
tantek@7527 418 Orientation</a>
jackalmage@5934 419 <ul class=toc>
jackalmage@5934 420 <li><a href="#flex-direction-property"><span class=secno>5.1. </span>
jackalmage@5934 421 Flex Flow Direction: the ‘<code
jackalmage@5934 422 class=property>flex-direction</code>’ property</a>
jackalmage@5934 423
jackalmage@5934 424 <li><a href="#flex-wrap-property"><span class=secno>5.2. </span> Flex
jackalmage@5934 425 Line Wrapping: the ‘<code class=property>flex-wrap</code>’
jackalmage@5934 426 property</a>
jackalmage@5934 427
jackalmage@5934 428 <li><a href="#flex-flow-property"><span class=secno>5.3. </span> Flex
jackalmage@5934 429 Direction and Wrap: the ‘<code class=property>flex-flow</code>’
jackalmage@5934 430 shorthand</a>
jackalmage@5934 431
jackalmage@5934 432 <li><a href="#order-property"><span class=secno>5.4. </span> Display
jackalmage@5934 433 Order: the ‘<code class=property>order</code>’ property</a>
fantasai@6290 434 <ul class=toc>
fantasai@6398 435 <li><a href="#order-accessibility"><span class=secno>5.4.1. </span>
fantasai@6398 436 Reordering and Accessibility</a>
fantasai@6290 437 </ul>
jackalmage@5934 438 </ul>
jackalmage@5934 439
jackalmage@5934 440 <li><a href="#flex-lines"><span class=secno>6. </span> Flex Lines</a>
jackalmage@5934 441
jackalmage@5934 442 <li><a href="#flexibility"><span class=secno>7. </span> Flexibility</a>
jackalmage@5934 443 <ul class=toc>
jackalmage@5934 444 <li><a href="#flex-property"><span class=secno>7.1. </span> The ‘<code
jackalmage@5934 445 class=property>flex</code>’ Shorthand</a>
jackalmage@5934 446
fantasai@6357 447 <li><a href="#flex-common"><span class=secno>7.2. </span> Common Values
fantasai@6357 448 of ‘<code class=property>flex</code>’</a>
jackalmage@5934 449
jackalmage@5934 450 <li><a href="#flex-components"><span class=secno>7.3. </span> Components
jackalmage@5934 451 of Flexibility</a>
jackalmage@5934 452 <ul class=toc>
jackalmage@5934 453 <li><a href="#flex-grow-property"><span class=secno>7.3.1. </span> The
jackalmage@5934 454 ‘<code class=property>flex-grow</code>’ property</a>
jackalmage@5934 455
jackalmage@5934 456 <li><a href="#flex-shrink-property"><span class=secno>7.3.2. </span>
jackalmage@5934 457 The ‘<code class=property>flex-shrink</code>’ property</a>
jackalmage@5934 458
jackalmage@5934 459 <li><a href="#flex-basis-property"><span class=secno>7.3.3. </span>
jackalmage@5934 460 The ‘<code class=property>flex-basis</code>’ property</a>
jackalmage@5934 461 </ul>
jackalmage@5934 462 </ul>
jackalmage@5934 463
jackalmage@5934 464 <li><a href="#alignment"><span class=secno>8. </span> Alignment</a>
jackalmage@5934 465 <ul class=toc>
jackalmage@5934 466 <li><a href="#auto-margins"><span class=secno>8.1. </span> Aligning with
jackalmage@5934 467 ‘<code class=css>auto</code>’ margins</a>
jackalmage@5934 468
jackalmage@5934 469 <li><a href="#justify-content-property"><span class=secno>8.2. </span>
jackalmage@5934 470 Axis Alignment: the ‘<code class=property>justify-content</code>’
jackalmage@5934 471 property</a>
jackalmage@5934 472
jackalmage@5934 473 <li><a href="#align-items-property"><span class=secno>8.3. </span>
jackalmage@5934 474 Cross-axis Alignment: the ‘<code class=property>align-items</code>’
jackalmage@5934 475 and ‘<code class=property>align-self</code>’ properties</a>
jackalmage@5934 476
fantasai@6141 477 <li><a href="#align-content-property"><span class=secno>8.4. </span>
fantasai@6141 478 Packing Flex Lines: the ‘<code class=property>align-content</code>’
fantasai@6141 479 property</a>
fantasai@6141 480
jackalmage@6204 481 <li><a href="#flex-baselines"><span class=secno>8.5. </span> Flex
jackalmage@6204 482 Baselines</a>
jackalmage@5934 483 </ul>
jackalmage@5934 484
jackalmage@5934 485 <li><a href="#layout-algorithm"><span class=secno>9. </span> Flex Layout
jackalmage@5934 486 Algorithm</a>
jackalmage@5934 487 <ul class=toc>
jackalmage@5934 488 <li><a href="#box-manip"><span class=secno>9.1. </span> Initial
jackalmage@5934 489 Setup</a>
jackalmage@5934 490
jackalmage@5934 491 <li><a href="#line-sizing"><span class=secno>9.2. </span> Line Length
jackalmage@5934 492 Determination</a>
jackalmage@5934 493
jackalmage@5934 494 <li><a href="#main-sizing"><span class=secno>9.3. </span> Main Size
jackalmage@5934 495 Determination</a>
jackalmage@5934 496
jackalmage@5934 497 <li><a href="#cross-sizing"><span class=secno>9.4. </span> Cross size
jackalmage@5934 498 determination</a>
jackalmage@5934 499
jackalmage@5934 500 <li><a href="#main-alignment"><span class=secno>9.5. </span> Main-Axis
jackalmage@5934 501 Alignment</a>
jackalmage@5934 502
jackalmage@5934 503 <li><a href="#cross-alignment"><span class=secno>9.6. </span> Cross-Axis
jackalmage@5934 504 Alignment</a>
jackalmage@5934 505
jackalmage@5934 506 <li><a href="#resolve-flexible-lengths"><span class=secno>9.7. </span>
jackalmage@5934 507 Resolving Flexible Lengths</a>
jackalmage@5934 508 </ul>
jackalmage@5934 509
jackalmage@5934 510 <li><a href="#pagination"><span class=secno>10. </span> Fragmenting Flex
jackalmage@5934 511 Layout</a>
jackalmage@5934 512 <ul class=toc>
jackalmage@5934 513 <li><a href="#pagination-algo"><span class=secno>10.1. </span> Sample
jackalmage@5934 514 Flex Fragmentation Algorithm</a>
jackalmage@5934 515 </ul>
jackalmage@5934 516
jackalmage@5934 517 <li><a href="#conformance"><span class=secno>11. </span> Conformance</a>
jackalmage@5934 518 <ul class=toc>
jackalmage@5934 519 <li><a href="#conventions"><span class=secno>11.1. </span> Document
jackalmage@5934 520 conventions</a>
jackalmage@5934 521
jackalmage@5934 522 <li><a href="#conformance-classes"><span class=secno>11.2. </span>
jackalmage@5934 523 Conformance classes</a>
jackalmage@5934 524
jackalmage@5934 525 <li><a href="#partial"><span class=secno>11.3. </span> Partial
jackalmage@5934 526 implementations</a>
jackalmage@5934 527
jackalmage@5934 528 <li><a href="#experimental"><span class=secno>11.4. </span> Experimental
jackalmage@5934 529 implementations</a>
jackalmage@5934 530
jackalmage@5934 531 <li><a href="#testing"><span class=secno>11.5. </span> Non-experimental
jackalmage@5934 532 implementations</a>
jackalmage@5934 533
jackalmage@5934 534 <li><a href="#cr-exit-criteria"><span class=secno>11.6. </span> CR exit
jackalmage@5934 535 criteria</a>
jackalmage@5934 536 </ul>
jackalmage@5934 537
jackalmage@5934 538 <li class=no-num><a href="#acknowledgments">Acknowledgments</a>
jackalmage@5934 539
jackalmage@5934 540 <li class=no-num><a href="#references">References</a>
jackalmage@5934 541 <ul class=toc>
jackalmage@5934 542 <li class=no-num><a href="#normative">Normative references</a>
jackalmage@5934 543
jackalmage@5934 544 <li class=no-num><a href="#informative">Other references</a>
jackalmage@5934 545 </ul>
jackalmage@5934 546
fantasai@5958 547 <li class=no-num><a href="#changes">Changes</a>
fantasai@5958 548
jackalmage@5934 549 <li class=no-num><a href="#property">Property index</a>
jackalmage@5934 550
jackalmage@5934 551 <li class=no-num><a href="#index">Index</a>
jackalmage@5934 552 </ul>
jackalmage@5934 553 <!--end-toc-->
jackalmage@5934 554
fantasai@6126 555 <h2 id=intro><span class=secno>1. </span> Introduction</h2>
jackalmage@5934 556
jackalmage@5934 557 <p><em>This section is not normative.</em>
jackalmage@5934 558
fantasai@6124 559 <p> CSS 2.1 defined four layout modes — algorithms which determine the
jackalmage@5934 560 size and position of boxes based on their relationships with their sibling
fantasai@6124 561 and ancestor boxes:
fantasai@6124 562
fantasai@6124 563 <ul class=compact>
fantasai@6124 564 <li>block layout, designed for laying out documents
fantasai@6124 565
fantasai@6124 566 <li>inline layout, designed for laying out text
fantasai@6124 567
fantasai@6124 568 <li>table layout, designed for laying out 2D data in a tabular format
fantasai@6124 569
fantasai@6124 570 <li>positioned layout, designed for very explicit positioning without much
fantasai@6124 571 regard for other elements in the document
fantasai@6124 572 </ul>
fantasai@6124 573
fantasai@6124 574 <p> This module introduces a new layout mode, <dfn id=flex-layout>flex
fantasai@6124 575 layout</dfn>, which is designed for laying out more complex applications
fantasai@6124 576 and webpages.
fantasai@6124 577
fantasai@6124 578 <h3 id=overview><span class=secno>1.1. </span> Overview</h3>
fantasai@6124 579
fantasai@6124 580 <p><em>This section is not normative.</em>
fantasai@6124 581
fantasai@6124 582 <p> Flex layout is superficially similar to block layout. It lacks many of
fantasai@6124 583 the more complex text- or document-centric properties that can be used in
fantasai@6124 584 block layout, such as <a
fantasai@6124 585 href="http://www.w3.org/TR/CSS21/visuren.html#floats">floats</a> and <a
fantasai@6124 586 href="http://www.w3.org/TR/css3-multicol/">columns</a>. In return it gains
fantasai@6124 587 simple and powerful tools for distributing space and aligning content in
fantasai@6124 588 ways that webapps and complex web pages often need. The contents of a flex
fantasai@6124 589 container:
fantasai@6124 590
fantasai@6124 591 <ul>
fantasai@6124 592 <li> can be laid out in any <a href="#flex-direction-property">flow
fantasai@6124 593 direction</a> (leftwards, rightwards, downwards, or even upwards!)
fantasai@6124 594
fantasai@6392 595 <li> can have their display order <a
fantasai@6267 596 href="#flex-flow-row-reverse">reversed</a> or <a
fantasai@6392 597 href="#order-property">rearranged</a> at the style layer (i.e., visual
fantasai@6392 598 order can be independent of source and speech order)
fantasai@6124 599
fantasai@6124 600 <li> can be laid out linearly along a single (<a href="#main-axis"><i
fantasai@6124 601 title="main axis">main</i></a>) axis or <a
fantasai@6124 602 href="#flex-wrap-property">wrapped</a> into multiple lines along a
fantasai@6124 603 secondary (<a href="#cross-axis"><i title="cross axis">cross</i></a>)
fantasai@6124 604 axis
fantasai@6124 605
fantasai@6124 606 <li> can <a href="#flexibility">“flex” their sizes</a> to respond to
fantasai@6124 607 the available space
fantasai@6124 608
fantasai@6124 609 <li> can be <a href="#alignment">aligned</a> with respect to their
fantasai@6124 610 container or each other
fantasai@6124 611
fantasai@6124 612 <li> can be dynamically <a href="#visibility-collapse">collapsed</a> or
fantasai@6124 613 uncollapsed along the <a href="#main-axis"><i>main axis</i></a> while
fantasai@6124 614 preserving the container's <a href="#cross-size"><i>cross size</i></a>
fantasai@6124 615 </ul>
jackalmage@5934 616
jackalmage@5934 617 <div class=example>
jackalmage@6142 618 <p> Here's an example of a catalog where each item has a title, an photo,
jackalmage@6142 619 a description, and a purchase button. The designer's intention is that
jackalmage@6142 620 each entry has the same overall size, that the photo be above the text,
fantasai@6392 621 and that the purchase buttons aligned at the bottom, regardless of the
fantasai@6392 622 length of the item's description. Flex layout makes many aspects of this
fantasai@6392 623 design easy:
jackalmage@6142 624
jackalmage@6142 625 <ul>
fantasai@6392 626 <li> The catalog uses flex layout to lay out rows of items horizontally,
fantasai@6392 627 and to ensure that items within a row are all equal-height. Each entry
fantasai@6392 628 is then itself a column flex container, laying out its contents
fantasai@6392 629 vertically.
fantasai@6392 630
fantasai@6392 631 <li> Within each entry, the source document content is ordered logically
fantasai@6392 632 with the title first, followed by the description and the photo. This
fantasai@6392 633 provides a sensible ordering for speech rendering and in non-CSS
fantasai@6392 634 browsers. For a more compelling visual presentation, however, ‘<a
fantasai@6392 635 href="#order"><code class=property>order</code></a>’ is used to pull
fantasai@6392 636 the image up from later in the content to the top, and ‘<a
fantasai@6392 637 href="#align-self"><code class=property>align-self</code></a>’ is used
fantasai@6392 638 to center it horizontally.
jackalmage@6142 639
fantasai@6356 640 <li> An <a href="#auto-margins">‘<code class=css>auto</code>’
fantasai@6392 641 margin</a> above the purchase button forces it to the bottom within each
fantasai@6392 642 entry box, regardless of the height of that item's description.
jackalmage@6142 643 </ul>
jackalmage@6142 644
fantasai@6293 645 <pre>
jackalmage@6092 646 &lt;style>
jackalmage@6142 647 #deals {
fantasai@6293 648 display: flex; /* Flex layout so items <a
fantasai@6293 649 href="#align-self"
fantasai@6293 650 title="Flex items stretch by default.">have equal height</a> */
fantasai@6293 651 flex-flow: row wrap; /* <a
fantasai@6293 652 href="http://dev.w3.org/csswg/css3-flexbox/#flex-flow-property">Allow items to wrap into multiple lines</a> */
jackalmage@6142 653 }
jackalmage@6140 654 .sale-item {
fantasai@6293 655 display: flex; /* Lay out each item using flex layout */
fantasai@6293 656 flex-flow: column; /* <a
fantasai@6293 657 href="#flex-flow-property">Lay out item's contents vertically</a> */
jackalmage@6140 658 }
jackalmage@6140 659 .sale-item > img {
fantasai@6293 660 order: -1; /* <a
fantasai@6293 661 href="#order-property">Shift image before other content (in visual order)</a> */
fantasai@6293 662 align-self: center; /* <a
fantasai@6293 663 href="#align-self">Center the image cross-wise (horizontally)</a> */
jackalmage@6140 664 }
jackalmage@6140 665 .sale-item > button {
fantasai@6293 666 margin-top: auto; /* <a
fantasai@6293 667 href="#auto-margins">Auto top margin pushes button to bottom</a> */
jackalmage@6140 668 }
jackalmage@6142 669 &lt;/style></pre>
fantasai@6293 670
fantasai@6293 671 <pre>
jackalmage@6142 672 &lt;section id='deals'>
jackalmage@6142 673 &lt;section class='sale-item'>
jackalmage@6142 674 &lt;h1>Computer Starter Kit&lt;/h1>
fantasai@6293 675 &lt;p>This is the best computer money can buy, if you don't have much money.
jackalmage@6142 676 &lt;ul>
jackalmage@6142 677 &lt;li>Computer
jackalmage@6142 678 &lt;li>Monitor
jackalmage@6142 679 &lt;li>Keyboard
jackalmage@6142 680 &lt;li>Mouse
jackalmage@6142 681 &lt;/ul>
fantasai@6293 682 &lt;img src='images/computer.jpg'
fantasai@6293 683 alt='You get: a white computer with matching peripherals.'>
jackalmage@6142 684 &lt;button>BUY NOW&lt;/button>
jackalmage@6142 685 &lt;/section>
jackalmage@6142 686 &lt;section class='sale-item'>
fantasai@6293 687
jackalmage@6142 688 &lt;/section>
fantasai@6293 689
jackalmage@6140 690 &lt;/section></pre>
jackalmage@6162 691 <figure>
fantasai@6267 692 <div id=overview-example>
fantasai@6267 693 <div class=col></div>
fantasai@6267 694
fantasai@6267 695 <div class=col></div>
fantasai@6267 696
fantasai@6267 697 <div class=desc> <img
fantasai@6267 698 alt="You get: a white computer with matching keyboard and monitor."
fantasai@6267 699 src="images/computer.jpg">
fantasai@6267 700 <h1 style="font-size: 1.4em;">Computer Starter Kit</h1>
fantasai@6267 701
fantasai@6267 702 <p> This is the best computer money can buy, if you don't have much
fantasai@6267 703 money.
fantasai@6267 704
fantasai@6267 705 <ul>
fantasai@6267 706 <li>Computer
fantasai@6267 707
fantasai@6267 708 <li>Monitor
fantasai@6267 709
fantasai@6267 710 <li>Keyboard
fantasai@6267 711
fantasai@6267 712 <li>Mouse
fantasai@6267 713 </ul>
fantasai@6267 714 </div>
fantasai@6267 715
fantasai@6267 716 <div class=desc> <img alt="You get: beautiful ASCII art."
fantasai@6267 717 src="images/printer.png">
fantasai@6267 718 <h1 style="font-size: 1.4em;">Printer</h1>
fantasai@6267 719
fantasai@6267 720 <p> Only capable of printing ASCII art.
fantasai@6267 721
fantasai@6267 722 <ul>
fantasai@6267 723 <li>Paper and ink not included.
fantasai@6267 724 </ul>
fantasai@6267 725 </div>
fantasai@6267 726
fantasai@6267 727 <div class=buttons>
fantasai@6267 728 <div><button>BUY NOW</button></div>
fantasai@6267 729
fantasai@6267 730 <div><button>BUY NOW</button></div>
fantasai@6267 731 </div>
fantasai@6267 732 </div>
jackalmage@6162 733 <figcaption> An example rendering of the code above. </figcaption>
jackalmage@6162 734 </figure></div>
jackalmage@6142 735
fantasai@6124 736 <h3 id=placement><span class=secno>1.2. </span> Module interactions</h3>
jackalmage@5934 737
fantasai@6117 738 <p> This module extends the definition of the ‘<code
fantasai@6117 739 class=property>display</code>’ property <a href="#CSS21"
fantasai@6117 740 rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>, adding a new block-level and
fantasai@6164 741 new inline-level display type, and defining a new type of formatting
jackalmage@7745 742 context along with properties to control its layout. None of the
jackalmage@7745 743 properties defined in this module apply to the ‘<code
jackalmage@7745 744 class=css>::first-line</code>’ or ‘<code
jackalmage@7745 745 class=css>::first-letter</code>’ pseudo-elements.
jackalmage@5934 746
fantasai@6124 747 <h3 id=values><span class=secno>1.3. </span> Values</h3>
jackalmage@5934 748
fantasai@6126 749 <p> This specification follows the <a
jackalmage@5934 750 href="http://www.w3.org/TR/CSS21/about.html#property-defs">CSS property
jackalmage@5934 751 definition conventions</a> from <a href="#CSS21"
jackalmage@6092 752 rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. Value types not defined in
jackalmage@5934 753 this specification are defined in CSS Level 2 Revision 1 <a
jackalmage@6092 754 href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. Other CSS
fantasai@6126 755 modules may expand the definitions of these value types: for example <a
fantasai@6126 756 href="#CSS3VAL" rel=biblioentry>[CSS3VAL]<!--{{CSS3VAL}}--></a>, when
fantasai@6126 757 combined with this module, expands the definition of the
fantasai@6126 758 <var>&lt;length&gt;</var> value type as used in this specification.
jackalmage@5934 759
jackalmage@5934 760 <p>In addition to the property-specific values listed in their definitions,
jackalmage@5934 761 all properties defined in this specification also accept the <a
jackalmage@5934 762 href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">‘<code
jackalmage@5934 763 class=css>inherit</code>’</a> keyword as their property value. For
jackalmage@5934 764 readability it has not been repeated explicitly.
jackalmage@5934 765
fantasai@6134 766 <h2 id=box-model><span class=secno>2. </span> Flex Layout Box Model and
fantasai@6134 767 Terminology</h2>
jackalmage@5934 768
fantasai@5957 769 <p> An element with ‘<code class=css>display:flex</code>’ or ‘<code
fantasai@5957 770 class=css>display:inline-flex</code>’ is a <a
fantasai@5957 771 href="#flex-container"><i>flex container</i></a>. Children of a flex
fantasai@5957 772 container are called <a href="#flex-item"><i>flex items</i></a> and are
fantasai@5957 773 laid out using the flex layout model.
jackalmage@5934 774
fantasai@6134 775 <p> Unlike block and inline layout, whose layout calculations are biased to
fantasai@6356 776 the <a href="http://www.w3.org/TR/css3-writing-modes/#abstract-box">block
fantasai@6356 777 and inline flow directions</a>, flex layout is biased to the <a
fantasai@6134 778 href="#flex-flow-property">flex flow</a> directions. To make it easier to
fantasai@6134 779 talk about flex layout, this section defines a set of flex flow–relative
fantasai@6134 780 terms. The ‘<a href="#flex-flow"><code
fantasai@6134 781 class=property>flex-flow</code></a>’ value determines how these terms
fantasai@6134 782 map to physical directions (top/right/bottom/left), axes
jackalmage@6613 783 (vertical/horizontal), and sizes (width/height). <figure> <img alt=alt
jackalmage@6162 784 height=277 src="images/flex-direction-terms.svg" width=665> <figcaption>
jackalmage@6147 785 An illustration of the various directions and sizing terms as applied to a
jackalmage@6146 786 ‘<a href="#flex-flow-row"><code class=css>row</code></a>’ flex
fantasai@6267 787 container. </figcaption> </figure>
jackalmage@5934 788
fantasai@6134 789 <dl id=main>
fantasai@6294 790 <dt class=axis title="main axis|main-axis">main axis
jackalmage@6149 791
jackalmage@6149 792 <dt class=axis>main dimension
fantasai@6134 793
fantasai@6134 794 <dd> The <dfn id=main-axis>main axis</dfn> of a flex container is the
fantasai@6134 795 primary axis along which <a href="#flex-item"><i>flex items</i></a> are
fantasai@6134 796 laid out. It extends in the <dfn id=main-dimension>main dimension</dfn>.
fantasai@6134 797
jackalmage@6149 798 <dt class=side>main-start
jackalmage@6149 799
jackalmage@6149 800 <dt class=side>main-end
fantasai@6134 801
fantasai@6134 802 <dd> The <a href="#flex-item"><i>flex items</i></a> are placed within the
fantasai@6134 803 container starting on the <dfn id=main-start>main-start</dfn> side and
fantasai@6134 804 going toward the <dfn id=main-end>main-end</dfn> side.
fantasai@6134 805
jackalmage@6149 806 <dt class=size>main size
jackalmage@6149 807
jackalmage@6149 808 <dt class=size>main size property
fantasai@6134 809
fantasai@6356 810 <dd> A <a href="#flex-item"><i>flex item</i></a>&apos;s width or height,
fantasai@6356 811 whichever is in the <a href="#main-dimension"><i>main dimension</i></a>,
fantasai@6356 812 is the item's <dfn id=main-size>main size</dfn>. The <a
fantasai@6356 813 href="#flex-item"><i>flex item</i></a>&apos;s <dfn
fantasai@6356 814 id=main-size-property>main size property</dfn> is either the ‘<code
fantasai@6356 815 class=property>width</code>’ or ‘<code
fantasai@6356 816 class=property>height</code>’ property, whichever is in the <a
fantasai@6356 817 href="#main-dimension"><i>main dimension</i></a>.
fantasai@6134 818 </dl>
fantasai@6134 819
fantasai@6134 820 <dl id=cross>
fantasai@6294 821 <dt class=axis title="cross axis|cross-axis">cross axis
jackalmage@6149 822
jackalmage@6149 823 <dt class=axis>cross dimension
fantasai@6134 824
fantasai@6134 825 <dd> The axis perpendicular to the <a href="#main-axis"><i>main
jackalmage@6162 826 axis</i></a> is called the <dfn id=cross-axis>cross axis</dfn>. It
jackalmage@6162 827 extends in the <dfn id=cross-dimension>cross dimension</dfn>.
fantasai@6134 828
jackalmage@6149 829 <dt class=side>cross-start
jackalmage@6149 830
jackalmage@6149 831 <dt class=side>cross-end
fantasai@6134 832
fantasai@6134 833 <dd> <i>Flex lines</i> are filled with items and placed into the container
fantasai@6134 834 starting on the <dfn id=cross-start>cross-start</dfn> side of the flex
fantasai@6134 835 container and going toward the <dfn id=cross-end>cross-end</dfn> side.
fantasai@6134 836
jackalmage@6149 837 <dt class=size>cross size
jackalmage@6149 838
jackalmage@6149 839 <dt class=size>cross size property
fantasai@6134 840
fantasai@6134 841 <dd> The width or height of a <a href="#flex-item"><i>flex item</i></a>,
jackalmage@6162 842 whichever is in the <a href="#cross-dimension"><i>cross
jackalmage@6162 843 dimension</i></a>, is the item's <dfn id=cross-size>cross size</dfn>. The
jackalmage@6162 844 <dfn id=cross-size-property>cross size property</dfn> is whichever of
jackalmage@6162 845 ‘<code class=property>width</code>’ or ‘<code
jackalmage@6162 846 class=property>height</code>’ that is in the <a
jackalmage@6162 847 href="#cross-dimension"><i>cross dimension</i></a>.
fantasai@6134 848 </dl>
jackalmage@5934 849
fantasai@6356 850 <h2 id=flex-containers><span class=secno>3. </span> Flex Containers: the <a
fantasai@6356 851 href="#display-flex">‘<code class=css>flex</code>’</a> and <a
fantasai@6373 852 href="#display-inline-flex">‘<code class=css>inline-flex</code>’</a>
fantasai@6373 853 ‘<code class=property>display</code>’ values</h2>
jackalmage@5934 854
jackalmage@5934 855 <table class=propdef>
jackalmage@5934 856 <tbody>
jackalmage@5934 857 <tr>
jackalmage@5934 858 <th>Name:
jackalmage@5934 859
jackalmage@5934 860 <td>display
jackalmage@5934 861
jackalmage@5934 862 <tr>
jackalmage@5934 863 <th><a href="#values">New value</a>:
jackalmage@5934 864
fantasai@7248 865 <td>flex | inline-flex
jackalmage@5934 866 </table>
jackalmage@5934 867
fantasai@6141 868 <dl>
fantasai@6141 869 <dt><dfn id=display-flex>‘<code class=css>flex</code>’</dfn>
fantasai@6141 870
jackalmage@6143 871 <dd> This value causes an element to generate a block-level <a
fantasai@6141 872 href="#flex-container"><i>flex container</i></a> box.
fantasai@6141 873
jackalmage@6143 874 <dt><dfn id=display-inline-flex>‘<code
jackalmage@6143 875 class=css>inline-flex</code>’</dfn>
jackalmage@6143 876
jackalmage@6143 877 <dd> This value causes an element to generate a inline-level <a
fantasai@6141 878 href="#flex-container"><i>flex container</i></a> box.
fantasai@6141 879 </dl>
fantasai@6141 880
fantasai@6141 881 <p> A <dfn id=flex-container>flex container</dfn> establishes a new <dfn
fantasai@5957 882 id=flex-formatting-context>flex formatting context</dfn> for its contents.
fantasai@5957 883 This is the same as establishing a block formatting context, except that
fantasai@5957 884 flex layout is used instead of block layout: floats do not intrude into
fantasai@5957 885 the flex container, and the flex container's margins do not collapse with
fantasai@6165 886 the margins of its contents. <a href="#flex-container"><i>Flex
fantasai@6165 887 containers</i></a> form a containing block for their contents <a
fantasai@6165 888 href="http://www.w3.org/TR/CSS21/visudet.html#containing-block-details">exactly
fantasai@6165 889 like block containers do</a>. <a href="#CSS21"
jackalmage@7272 890 rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> The ‘<code
jackalmage@7272 891 class=property>overflow</code>’ property applies to <a
jackalmage@7272 892 href="#flex-container"><i>flex containers</i></a>.
jackalmage@5934 893
jackalmage@5934 894 <p> Flex containers are not block containers, and so some properties that
jackalmage@5934 895 were designed with the assumption of block layout don't apply in the
jackalmage@5934 896 context of flex layout. In particular:
jackalmage@5934 897
jackalmage@5934 898 <ul>
jackalmage@5934 899 <li> all of the ‘<code class=css>column-*</code>’ properties in the
jackalmage@5934 900 Multicol module have no effect on a flex container.
jackalmage@5934 901
jackalmage@5934 902 <li> ‘<code class=property>float</code>’ and ‘<code
jackalmage@5934 903 class=property>clear</code>’ have no effect on a <a
jackalmage@6925 904 href="#flex-item"><i>flex item</i></a>. (However, the ‘<code
jackalmage@6925 905 class=property>float</code>’ property still affects the computed value
jackalmage@6925 906 of ‘<code class=property>display</code>’ on children of a flex
jackalmage@6925 907 container, as this occurs <em title="">before</em> <a
jackalmage@6925 908 href="#flex-item"><i>flex items</i></a> are determined.)
jackalmage@5934 909
jackalmage@5934 910 <li> ‘<code class=property>vertical-align</code>’ has no effect on a
jackalmage@5934 911 flex item.
jackalmage@7330 912
jackalmage@7330 913 <li> the ‘<code class=css>::first-line</code>’ and ‘<code
jackalmage@7330 914 class=css>::first-letter</code>’ pseudo-elements do not apply to <a
jackalmage@7330 915 href="#flex-container"><i>flex containers</i></a>.
jackalmage@5934 916 </ul>
jackalmage@5934 917
fantasai@6141 918 <p> If an element's specified ‘<code class=property>display</code>’ is
fantasai@6141 919 ‘<a href="#display-inline-flex"><code
fantasai@6141 920 class=css>inline-flex</code></a>’ and the element is floated or
fantasai@6141 921 absolutely positioned, the computed value of ‘<code
fantasai@6356 922 class=property>display</code>’ is <a href="#display-flex">‘<code
fantasai@6356 923 class=css>flex</code>’</a>. The table in <a
jackalmage@5934 924 href="http://www.w3.org/TR/CSS2/visuren.html#dis-pos-flo">CSS 2.1 Chapter
jackalmage@5934 925 9.7</a> is thus amended to contain an additional row, with ‘<a
jackalmage@5934 926 href="#display-inline-flex"><code class=css>inline-flex</code></a>’ in
fantasai@6356 927 the "Specified Value" column and <a href="#display-flex">‘<code
fantasai@6356 928 class=css>flex</code>’</a> in the "Computed Value" column.
jackalmage@5934 929
jackalmage@5934 930 <h2 id=flex-items><span class=secno>4. </span> Flex Items</h2>
jackalmage@5934 931
fantasai@6141 932 <p> The contents of a <a href="#flex-container"><i>flex container</i></a>
fantasai@6164 933 consists of zero or more <dfn id=flex-item title="flex item">flex
jackalmage@6823 934 items</dfn>: each in-flow child of a <a href="#flex-container"><i>flex
fantasai@6164 935 container</i></a> becomes a <a href="#flex-item"><i>flex item</i></a>, and
fantasai@6164 936 each contiguous run of text that is directly contained inside a <a
fantasai@6164 937 href="#flex-container"><i>flex container</i></a> is wrapped in an
jackalmage@6823 938 anonymous <a href="#flex-item"><i>flex item</i></a> element. However, an
jackalmage@6823 939 anonymous flex item that contains only <a
fantasai@6164 940 href="http://www.w3.org/TR/CSS21/text.html#white-space-prop">white
fantasai@6164 941 space</a> is not rendered, as if it were ‘<code
fantasai@6141 942 class=css>display:none</code>’.
fantasai@6141 943
fantasai@6370 944 <p class=note> Authors reading this spec may want to <a
fantasai@6370 945 href="#item-margins">skip past these box-generation details</a>.
fantasai@6370 946
fantasai@6141 947 <p> A <a href="#flex-item"><i>flex item</i></a> establishes a new
fantasai@6141 948 formatting context for its contents. The type of this formatting context
fantasai@6141 949 is determined by its ‘<code class=property>display</code>’ value, as
fantasai@6141 950 usual. The computed ‘<code class=property>display</code>’ of a <a
fantasai@6141 951 href="#flex-item"><i>flex item</i></a> is determined by applying the table
fantasai@6141 952 in <a href="http://www.w3.org/TR/CSS2/visuren.html#dis-pos-flo">CSS 2.1
fantasai@6164 953 Chapter 9.7</a>. However, flex items are flex-level boxes, not block-level
fantasai@6164 954 boxes: they participate in their container's flex formatting context, not
fantasai@6164 955 in a block formatting context.
fantasai@6164 956
fantasai@6164 957 <p class=note> The ‘<code class=property>display</code>’ computation on
fantasai@6164 958 flex items as defined here is expected to be superseded by a future
fantasai@6164 959 specification that defines a new ‘<code class=property>display</code>’
fantasai@6164 960 value specific to flex items.
jackalmage@5934 961
jackalmage@5934 962 <div class=example>
jackalmage@5934 963 <p>Examples of flex items:
jackalmage@5934 964
jackalmage@6092 965 <pre>
jackalmage@6092 966 &lt;div style="display:flex">
jackalmage@6092 967
jackalmage@6132 968 &lt;!-- flex item: block child -->
jackalmage@6092 969 &lt;div id="item1">block&lt;/div>
jackalmage@6092 970
fantasai@6141 971 &lt;!-- flex item: floated element; floating is ignored -->
jackalmage@6132 972 &lt;div id="item2" style="float: left;">float&lt;/div>
jackalmage@6092 973
jackalmage@6092 974 &lt;!-- flex item: anonymous block box around inline content -->
jackalmage@6132 975 anonymous item 3
jackalmage@6092 976
jackalmage@6132 977 &lt;!-- flex item: inline child -->
jackalmage@6092 978 &lt;span>
fantasai@6164 979 item 4
fantasai@6164 980 &lt;!-- flex items do not split around blocks -->
fantasai@6164 981 &lt;div id=not-an-item>item 4&lt;/div>
fantasai@6164 982 item 4
jackalmage@6092 983 &lt;/span>
jackalmage@5934 984 &lt;/div></pre>
jackalmage@5934 985 </div>
jackalmage@5934 986
fantasai@6141 987 <p> Some values of ‘<code class=property>display</code>’ trigger the
fantasai@6164 988 generation of anonymous boxes. For example, a misparented ‘<code
fantasai@6164 989 class=css>table-cell</code>’ child is fixed up by <a
fantasai@6141 990 href="http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes">generating
fantasai@6141 991 anonymous ‘<code class=css>table</code>’ and ‘<code
fantasai@6141 992 class=css>table-row</code>’ elements</a> around it. <a href="#CSS21"
fantasai@6141 993 rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> This fixup must occur
fantasai@6141 994 <em>before</em> a flex container's children are promoted to <a
fantasai@6141 995 href="#flex-item"><i>flex items</i></a>. For example, given two contiguous
fantasai@6141 996 child elements with ‘<code class=css>display:table-cell</code>’, an
fantasai@6141 997 anonymous table wrapper box around them becomes the <a
fantasai@6141 998 href="#flex-item"><i>flex item</i></a>.
fantasai@6141 999
jackalmage@5934 1000 <p class=note> Future display types may generate anonymous containers (e.g.
jackalmage@5934 1001 ruby) or otherwise mangle the box tree (e.g. run-ins). It is intended that
jackalmage@5934 1002 flex item determination run after these operations.
jackalmage@5934 1003
fantasai@6271 1004 <p id=table-items> On a flex item with ‘<code class=css>display:
fantasai@6271 1005 table</code>’, the table wrapper box becomes the <a
fantasai@6271 1006 href="#flex-item"><i>flex item</i></a>, and the ‘<a href="#order"><code
fantasai@6271 1007 class=property>order</code></a>’ and ‘<a href="#align-self"><code
fantasai@6372 1008 class=property>align-self</code></a>’ properties apply to it. The
fantasai@6372 1009 contents of any caption boxes contribute to the calculation of the table
fantasai@6372 1010 wrapper box's min-content and max-content sizes. However, like ‘<code
fantasai@6372 1011 class=property>width</code>’ and ‘<code
fantasai@6271 1012 class=property>height</code>’, the ‘<a href="#flex"><code
fantasai@6271 1013 class=property>flex</code></a>’ longhands apply to the table box as
fantasai@6372 1014 follows: the <a href="#flex-item"><i>flex item</i></a>&apos;s final size
fantasai@6372 1015 is calculated by performing layout as if the distance between the table
fantasai@6372 1016 wrapper box's edges and the table box's content edges were all part of the
fantasai@6372 1017 table box's border+padding area, and the table box were the <a
fantasai@6372 1018 href="#flex-item"><i>flex item</i></a>.
jackalmage@6317 1019
jackalmage@6317 1020 <h3 id=abspos-items><span class=secno>4.1. </span> Absolutely-Positioned
jackalmage@6823 1021 Flex Children</h3>
jackalmage@6823 1022
jackalmage@6823 1023 <p> An absolutely-positioned child element of a <a
jackalmage@6823 1024 href="#flex-container"><i>flex container</i></a> does not participate in
jackalmage@6823 1025 flex layout beyond the <a href="#algo-flex-order">reordering step</a>.
jackalmage@6823 1026 However, if both ‘<code class=property>left</code>’ and ‘<code
jackalmage@6823 1027 class=property>right</code>’ or both ‘<code
jackalmage@6823 1028 class=property>top</code>’ and ‘<code class=property>bottom</code>’
jackalmage@6823 1029 are ‘<code class=css>auto</code>’, then the used value of those
jackalmage@6823 1030 properties are computed from its <dfn id=flex-item-static-position>static
jackalmage@6823 1031 position</dfn>, as follows:
jackalmage@6317 1032
jackalmage@6320 1033 <p> If both ‘<code class=property>left</code>’ and ‘<code
fantasai@6356 1034 class=property>right</code>’ are ‘<code class=css>auto</code>’, the
jackalmage@6823 1035 absolutely-positioned child must be positioned so that its <a
jackalmage@6823 1036 href="#main-start"><i>main-start</i></a> or <a
jackalmage@6320 1037 href="#cross-start"><i>cross-start</i></a> edge (whichever is in the
jackalmage@6320 1038 horizontal axis) is aligned with the <a
jackalmage@6320 1039 href="#flex-item-static-position"><i>static position</i></a>. If both
jackalmage@6320 1040 ‘<code class=property>top</code>’ and ‘<code
fantasai@6356 1041 class=property>bottom</code>’ are ‘<code class=css>auto</code>’, the
jackalmage@6823 1042 absolutely-positioned child must be positioned so that its <a
jackalmage@6823 1043 href="#main-start"><i>main-start</i></a> or <a
jackalmage@6320 1044 href="#cross-start"><i>cross-start</i></a> edge (whichever is in the
jackalmage@6320 1045 vertical axis) is aligned with the <a
jackalmage@6320 1046 href="#flex-item-static-position"><i>static position</i></a>.
jackalmage@6320 1047
fantasai@6321 1048 <p> In the <a href="#main-axis"><i>main axis</i></a>,
fantasai@6321 1049
fantasai@6321 1050 <ol>
jackalmage@7330 1051 <li> If the <a href="#flex-container"><i>flex container</i></a> does not
jackalmage@7330 1052 contain any <a href="#flex-item"><i>flex items</i></a>, the <a
jackalmage@7330 1053 href="#flex-item-static-position"><i>static position</i></a> is
jackalmage@7330 1054 determined by the value of ‘<a href="#justify-content"><code
jackalmage@7330 1055 class=property>justify-content</code></a>’ on the <a
jackalmage@7330 1056 href="#flex-container"><i>flex container</i></a> as if the <a
jackalmage@7330 1057 href="#flex-item-static-position"><i>static position</i></a> were
jackalmage@7330 1058 represented by a single zero-sized <a href="#flex-item"><i>flex
jackalmage@7330 1059 item</i></a>.
jackalmage@7330 1060
jackalmage@7330 1061 <li> If there is no preceding flex item or the preceding flex item and the
jackalmage@7330 1062 subsequent flex item are on the same flex line, the <a
fantasai@6321 1063 href="#flex-item-static-position"><i>static position</i></a> is the outer
fantasai@6321 1064 <a href="#main-start"><i>main-start</i></a> edge of that <a
fantasai@6321 1065 href="#flex-item"><i>flex item</i></a>.
fantasai@6321 1066
jackalmage@6823 1067 <li> Otherwise, if there is a preceding <a href="#flex-item"><i>flex
jackalmage@7330 1068 item</i></a>, the <a href="#flex-item-static-position"><i>static
jackalmage@7330 1069 position</i></a> is the outer <a href="#main-end"><i>main-end</i></a>
jackalmage@7330 1070 edge of that <a href="#flex-item"><i>flex item</i></a>.
fantasai@6321 1071 </ol>
fantasai@6321 1072
fantasai@6321 1073 <p> In the <a href="#cross-axis"><i>cross axis</i></a>,
fantasai@6321 1074
fantasai@6321 1075 <ol>
jackalmage@6823 1076 <li> If there is a preceding <a href="#flex-item"><i>flex item</i></a>,
jackalmage@6823 1077 the <a href="#flex-item-static-position"><i>static position</i></a> is
jackalmage@6823 1078 the <a href="#cross-start"><i>cross-start</i></a> edge of the
jackalmage@6823 1079 <i>flex-line</i> that item is in.
fantasai@6321 1080
fantasai@6321 1081 <li> Otherwise, the <a href="#flex-item-static-position"><i>static
fantasai@6321 1082 position</i></a> is the <i>cross-start edge</i> of the first <i>flex
fantasai@6321 1083 line</i>.
fantasai@6321 1084 </ol>
fantasai@6321 1085
fantasai@6321 1086 <p class=note> The static position is intended to more-or-less match the
fantasai@6322 1087 position of an anonymous 0×0 in-flow <a href="#align-self">‘<code
fantasai@6322 1088 class=css>flex-start</code>’-aligned</a> flex item that participates in
fantasai@6355 1089 flex layout, the primary difference being that any packing spaces due to
fantasai@6322 1090 ‘<code class=css>justify-content: space-around</code>’ or ‘<code
fantasai@6321 1091 class=css>justify-content: space-between</code>’ are suppressed around
fantasai@6321 1092 the hypothetical item: between it and the next item if there is a real
fantasai@6321 1093 item after it, else between it and the previous item (if any) if there
fantasai@6321 1094 isn't.
jackalmage@6317 1095
jackalmage@6317 1096 <h3 id=item-margins><span class=secno>4.2. </span> Flex Item Margins</h3>
fantasai@6250 1097
fantasai@6250 1098 <p> The margins of adjacent <a href="#flex-item"><i>flex items</i></a> do
fantasai@6250 1099 not collapse. Auto margins absorb extra space in the corresponding
fantasai@6250 1100 dimension and can be used for alignment and to push adjacent flex items
fantasai@6250 1101 apart; see <a href="#auto-margins">Aligning with ‘<code
fantasai@6250 1102 class=css>auto</code>’ margins</a>.
fantasai@6250 1103
jackalmage@7649 1104 <h3 id=painting><span class=secno>4.3. </span> Flex Item Z-Ordering</h3>
fantasai@6250 1105
fantasai@6250 1106 <p> <a href="#flex-item"><i>Flex items</i></a> paint exactly the same as
fantasai@6356 1107 block-level elements in the normal flow, except that <a
fantasai@6356 1108 href="http://www.w3.org/TR/CSS21/visuren.html#propdef-z-index">‘<code
fantasai@6356 1109 class=property>z-index</code>’</a> values other than ‘<code
fantasai@6356 1110 class=css>auto</code>’ create a stacking context even if ‘<code
fantasai@6356 1111 class=property>position</code>’ is ‘<code class=css>static</code>’.
fantasai@6250 1112
fantasai@6250 1113 <p class=note> Note: Descendants that are positioned outside a flex item
fantasai@6250 1114 still participate in any stacking context established by the flex item.
fantasai@6250 1115
jackalmage@6317 1116 <h3 id=visibility-collapse><span class=secno>4.4. </span> Collapsed Items</h3>
jackalmage@5934 1117
jackalmage@5934 1118 <p> Specifying ‘<code class=css>visibility:collapse</code>’ on a flex
jackalmage@5934 1119 item causes it to become a <dfn id=collapsed-flex-item
jackalmage@5934 1120 title="collapsed flex item|collapsed">collapsed flex item</dfn>, producing
jackalmage@5934 1121 an effect similar to ‘<code class=css>visibility:collapse</code>’ on a
jackalmage@5934 1122 table-row or table-column: the collapsed element is removed from rendering
jackalmage@5934 1123 entirely, but leaves behind a "strut" that keeps the flex line's
jackalmage@5934 1124 cross-size stable. Thus, if a flex container has only one flex line,
jackalmage@5934 1125 dynamically collapsing or uncollapsing items is guaranteed to have no
jackalmage@5934 1126 effect on the flex container's <a href="#cross-size"><i>cross size</i></a>
jackalmage@5934 1127 and won't cause the rest of the page's layout to "wobble". Flex line
jackalmage@5934 1128 wrapping <em>is</em> re-done after collapsing, however, so the cross-size
jackalmage@5934 1129 of a flex container with multiple lines might or might not change.
jackalmage@5934 1130
jackalmage@5934 1131 <p> Though collapsed flex items aren't rendered, they do appear in the <a
jackalmage@5934 1132 href="http://www.w3.org/TR/CSS21/intro.html#formatting-structure">formatting
jackalmage@6133 1133 structure</a>. Therefore, unlike on ‘<code
jackalmage@5934 1134 class=css>display:none</code>’ items <a href="#CSS21"
jackalmage@6092 1135 rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>, effects that depend on an
jackalmage@5934 1136 element appearing in the formatting structure (like incrementing counters
jackalmage@5934 1137 or running animations and transitions) still operate on collapsed items.
jackalmage@5934 1138
fantasai@6148 1139 <div class=example>
fantasai@6148 1140 <p>In the following example, a sidebar is sized to fit its content.
fantasai@6148 1141 ‘<code class=css>Visibility: collapse</code>’ is used to dynamically
fantasai@6148 1142 hide parts of a navigation sidebar without affecting its width, even
fantasai@6148 1143 though the widest item (“Architecture”) is in a collapsed section.
fantasai@6148 1144 <figure> <figcaption>Sample rendering for example code below</figcaption>
jackalmage@6613 1145
fantasai@6148 1146 <div id=visibility-collapse-example>
fantasai@6148 1147 <!-- No, don't look at this source code, look at the other source code. -->
fantasai@6281 1148 <nav>
fantasai@6148 1149 <ul>
fantasai@6148 1150 <li id=nav-about><a href="#nav-about">About</a>
fantasai@6148 1151 <ul>
fantasai@6267 1152 <li><a href="#">History</a>
fantasai@6267 1153
fantasai@6267 1154 <li><a href="#">Mission</a>
fantasai@6267 1155
fantasai@6267 1156 <li><a href="#">People</a>
fantasai@6148 1157 </ul>
fantasai@6148 1158
fantasai@6148 1159 <li id=nav-projects><a href="#nav-projects">Projects</a>
fantasai@6148 1160 <ul>
fantasai@6267 1161 <li><a href="#">Art</a>
fantasai@6267 1162
fantasai@6267 1163 <li><a href="#">Architecture</a>
fantasai@6267 1164
fantasai@6267 1165 <li><a href="#">Music</a>
fantasai@6148 1166 </ul>
fantasai@6148 1167
fantasai@6148 1168 <li id=nav-interact><a href="#nav-interact">Interact</a>
fantasai@6148 1169 <ul>
fantasai@6267 1170 <li><a href="#">Blog</a>
fantasai@6267 1171
fantasai@6267 1172 <li><a href="#">Forums</a>
fantasai@6267 1173
fantasai@6267 1174 <li><a href="#">Events</a>
fantasai@6148 1175 </ul>
fantasai@6148 1176 </ul>
fantasai@6281 1177 </nav> <article> Interesting Stuff to Read </article></div>
fantasai@6148 1178 </figure>
fantasai@6148 1179
fantasai@6148 1180 <pre>
fantasai@6148 1181 <!-- -->&lt;style>
fantasai@6148 1182 <!-- --> @media (min-width: 60em) {
fantasai@6148 1183 <!-- --> /* <a
fantasai@6148 1184 href="http://www.w3.org/TR/css3-mediaqueries/#width">two column layout only when enough room</a> (relative to default text size) */
fantasai@6148 1185 <!-- --> header + div { display: flex; }
fantasai@6148 1186 <!-- --> #main {
fantasai@6148 1187 <!-- --> flex: 1; /* <a
fantasai@6148 1188 href="#flexibility">Main takes up all remaining space</a> */
fantasai@6282 1189 <!-- --> order: 1; /* <a
fantasai@6281 1190 href="#order-property">Place it after (to the right of) the navigation</a> */
fantasai@6148 1191 <!-- --> min-width: 12em; /* <a
fantasai@6148 1192 href="#min-size-opt">Optimize main content area sizing</a> */
fantasai@6148 1193 <!-- --> }
fantasai@6281 1194 <!-- --> }
fantasai@6281 1195 <!-- --> /* menu items use flex layout so that visibility:collapse will work */
fantasai@6281 1196 <!-- --> nav > ul > li {
fantasai@6281 1197 <!-- --> display: flex;
fantasai@6281 1198 <!-- --> flex-flow: column;
fantasai@6281 1199 <!-- --> }
fantasai@6281 1200 <!-- --> /* dynamically collapse submenus when not targetted */
fantasai@6281 1201 <!-- --> nav > ul > li:not(:target):not(:hover) > ul {
fantasai@6281 1202 <!-- --> visibility: collapse;
fantasai@6148 1203 <!-- --> }
fantasai@6148 1204 <!-- -->&lt;/style>
fantasai@6148 1205 <!-- -->…
fantasai@6148 1206 <!-- -->&lt;/header>
fantasai@6148 1207 <!-- -->&lt;div>
fantasai@6148 1208 <!-- --> &lt;article id="main">
fantasai@6148 1209 <!-- --> Interesting Stuff to Read
fantasai@6148 1210 <!-- --> &lt;/article>
fantasai@6148 1211 <!-- --> &lt;nav>
fantasai@6148 1212 <!-- --> &lt;ul>
fantasai@6148 1213 <!-- --> &lt;li id="nav-about">&lt;a href="#nav-about">About&lt;/a>
fantasai@6157 1214 <!-- --> …
fantasai@6148 1215 <!-- --> &lt;li id="nav-projects">&lt;a href="#nav-projects">Projects&lt;/a>
fantasai@6148 1216 <!-- --> &lt;ul>
fantasai@6148 1217 <!-- --> &lt;li>&lt;a href="…">Art&lt;/a>
fantasai@6148 1218 <!-- --> &lt;li>&lt;a href="…">Architecture&lt;/a>
fantasai@6148 1219 <!-- --> &lt;li>&lt;a href="…">Music&lt;/a>
fantasai@6148 1220 <!-- --> &lt;/ul>
fantasai@6148 1221 <!-- --> &lt;li id="nav-interact">&lt;a href="#nav-interact">Interact&lt;/a>
fantasai@6157 1222 <!-- --> …
fantasai@6148 1223 <!-- --> &lt;/ul>
fantasai@6148 1224 <!-- --> &lt;/nav>
fantasai@6148 1225 <!-- -->&lt;/div>
fantasai@6148 1226 <!-- -->&lt;footer>
fantasai@6148 1227 <!-- -->…
fantasai@6148 1228 </pre>
fantasai@6148 1229 </div>
fantasai@6148 1230
jackalmage@5934 1231 <p> To compute the size of the strut, flex layout is first performed with
jackalmage@5934 1232 all items uncollapsed, and then re-run with each collapsed item replaced
jackalmage@5934 1233 by a strut that maintains the original cross-size of the item's original
jackalmage@5934 1234 line. See the <a href="#layout-algorithm">Flex Layout Algorithm</a> for
jackalmage@5934 1235 the normative definition of how ‘<code
jackalmage@5934 1236 class=css>visibility:collapse</code>’ interacts with flex layout.
jackalmage@5934 1237
jackalmage@5934 1238 <p class=note> Note that using ‘<code
jackalmage@5934 1239 class=css>visibility:collapse</code>’ on any flex items will cause the
jackalmage@5934 1240 flex layout algorithm to repeat partway through, re-running the most
jackalmage@5934 1241 expensive steps. It's recommended that authors continue to use ‘<code
jackalmage@5934 1242 class=css>display:none</code>’ to hide items if the items will not be
jackalmage@5934 1243 dynamically collapsed and uncollapsed, as that is more efficient for the
fantasai@6148 1244 layout engine. (Since only part of the steps need to be repeated when
fantasai@6148 1245 ‘<code class=property>visibility</code>’ is changed, however, ‘<code
fantasai@6148 1246 class=css>visibility: collapse</code>’ is still recommended for dynamic
fantasai@6148 1247 cases.)
jackalmage@5934 1248
tantek@7527 1249 <h2 id=flow-order><span class=secno>5. </span> Ordering and Orientation</h2>
jackalmage@5934 1250
jackalmage@5934 1251 <p> The contents of a flex container can be laid out in any direction and
jackalmage@5934 1252 in any order. This allows an author to trivially achieve effects that
jackalmage@5934 1253 would previously have required complex or fragile methods, such as hacks
jackalmage@5934 1254 using the ‘<code class=property>float</code>’ and ‘<code
jackalmage@5934 1255 class=property>clear</code>’ properties. This functionality is exposed
jackalmage@5934 1256 through the ‘<a href="#flex-direction"><code
jackalmage@5934 1257 class=property>flex-direction</code></a>’, ‘<a href="#flex-wrap"><code
jackalmage@5934 1258 class=property>flex-wrap</code></a>’, and ‘<a href="#order"><code
jackalmage@5934 1259 class=property>order</code></a>’ properties.
jackalmage@5934 1260
fantasai@6391 1261 <p class=note> The reordering capabilities of flex layout intentionally
fantasai@6391 1262 affect <em>only the visual rendering</em>, leaving speech order and
fantasai@6391 1263 navigation based on the source order. This allows authors to manipulate
fantasai@6391 1264 the visual presentation while leaving the source order intact for non-CSS
fantasai@6391 1265 UAs and for linear models such as speech and sequential navigation. See <a
fantasai@6391 1266 href="#order-accessibility">Reordering and Accessibility</a> and the <a
fantasai@6391 1267 href="#overview">Flex Layout Overview</a> for examples that use this
fantasai@6391 1268 dichotomy to improve accessibility.
fantasai@6391 1269
fantasai@6391 1270 <p> Authors <em>must not</em> use these techniques as a substitute for
fantasai@6391 1271 correct source ordering, as that can ruin the accessibility of the
fantasai@6391 1272 document.
fantasai@6391 1273
jackalmage@5934 1274 <h3 id=flex-direction-property><span class=secno>5.1. </span> Flex Flow
jackalmage@5934 1275 Direction: the ‘<a href="#flex-direction"><code
jackalmage@5934 1276 class=property>flex-direction</code></a>’ property</h3>
jackalmage@5934 1277
jackalmage@5934 1278 <table class=propdef>
jackalmage@5934 1279 <tbody>
jackalmage@5934 1280 <tr>
jackalmage@5934 1281 <th>Name:
jackalmage@5934 1282
jackalmage@5934 1283 <td><dfn id=flex-direction>flex-direction</dfn>
jackalmage@5934 1284
jackalmage@5934 1285 <tr>
jackalmage@5934 1286 <th><a href="#values">Value</a>:
jackalmage@5934 1287
jackalmage@5934 1288 <td>row | row-reverse | column | column-reverse
jackalmage@5934 1289
jackalmage@5934 1290 <tr>
jackalmage@5934 1291 <th>Initial:
jackalmage@5934 1292
jackalmage@5934 1293 <td>row
jackalmage@5934 1294
jackalmage@5934 1295 <tr>
fantasai@7194 1296 <th>Applies to:
jackalmage@5934 1297
jackalmage@5934 1298 <td>flex containers
jackalmage@5934 1299
jackalmage@5934 1300 <tr>
jackalmage@5934 1301 <th>Inherited:
jackalmage@5934 1302
jackalmage@5934 1303 <td>no
jackalmage@5934 1304
jackalmage@5934 1305 <tr>
fantasai@7194 1306 <th>Computed value:
jackalmage@5934 1307
jackalmage@5934 1308 <td>specified value
jackalmage@5934 1309
jackalmage@5934 1310 <tr>
jackalmage@5934 1311 <th>Media:
jackalmage@5934 1312
jackalmage@5934 1313 <td>visual
jackalmage@5934 1314
jackalmage@5934 1315 <tr>
jackalmage@5934 1316 <th>Animatable:
jackalmage@5934 1317
jackalmage@5934 1318 <td>no
jackalmage@5934 1319
jackalmage@5934 1320 <tr>
jackalmage@5934 1321 <th>Canonical Order:
jackalmage@5934 1322
jackalmage@5934 1323 <td><abbr title="follows order of property value definition">per
jackalmage@5934 1324 grammar</abbr>
jackalmage@5934 1325 </table>
jackalmage@5934 1326
jackalmage@5934 1327 <p> The ‘<a href="#flex-direction"><code
jackalmage@5934 1328 class=property>flex-direction</code></a>’ property specifies how <a
jackalmage@5934 1329 href="#flex-item"><i>flex items</i></a> are placed in the flex container,
jackalmage@5934 1330 by setting the direction of the flex container's <a
jackalmage@5934 1331 href="#main-axis"><i>main axis</i></a>. This determines the direction that
jackalmage@5934 1332 flex items are laid out in.
jackalmage@5934 1333
jackalmage@5934 1334 <dl>
jackalmage@5934 1335 <dt><dfn id=flex-flow-row>‘<code class=css>row</code>’</dfn>
jackalmage@5934 1336
jackalmage@5934 1337 <dd> The flex container's <a href="#main-axis"><i>main axis</i></a> has
fantasai@6137 1338 the same orientation as the <a
fantasai@6137 1339 href="http://www.w3.org/TR/css3-writing-modes/#inline-axis">inline
fantasai@6137 1340 axis</a> of the current <i>writing mode</i>. The <a
jackalmage@5934 1341 href="#main-start"><i>main-start</i></a> and <a
jackalmage@5934 1342 href="#main-end"><i>main-end</i></a> directions are equivalent to the <a
jackalmage@5934 1343 href="http://www.w3.org/TR/css3-writing-modes/#start">start</a> and <a
jackalmage@5934 1344 href="http://www.w3.org/TR/css3-writing-modes/#end">end</a> directions,
fantasai@6137 1345 respectively, of the current <i>writing mode</i>.
jackalmage@5934 1346
jackalmage@5934 1347 <dt><dfn id=flex-flow-row-reverse>‘<code
jackalmage@5934 1348 class=css>row-reverse</code>’</dfn>
jackalmage@5934 1349
jackalmage@5934 1350 <dd> Same as ‘<a href="#flex-flow-row"><code
jackalmage@5934 1351 class=css>row</code></a>’, except the <a
jackalmage@5934 1352 href="#main-start"><i>main-start</i></a> and <a
jackalmage@5934 1353 href="#main-end"><i>main-end</i></a> directions are swapped.
jackalmage@5934 1354
jackalmage@5934 1355 <dt><dfn id=flex-flow-column>‘<code class=css>column</code>’</dfn>
jackalmage@5934 1356
jackalmage@5934 1357 <dd> The flex container's <a href="#main-axis"><i>main axis</i></a> has
fantasai@6137 1358 the same orientation as the <a
fantasai@6137 1359 href="http://www.w3.org/TR/css3-writing-modes/#block-axis">block axis</a>
fantasai@6137 1360 of the current <i>writing mode</i>. The <a
jackalmage@5934 1361 href="#main-start"><i>main-start</i></a> and <a
jackalmage@5934 1362 href="#main-end"><i>main-end</i></a> directions are equivalent to the <a
jackalmage@7082 1363 href="http://www.w3.org/TR/css3-writing-modes/#before">before</a> and <a
jackalmage@7082 1364 href="http://www.w3.org/TR/css3-writing-modes/#after">after</a>
fantasai@6373 1365 directions, respectively, of the current <i>writing mode</i>.
jackalmage@5934 1366
jackalmage@5934 1367 <dt><dfn id=flex-flow-column-reverse>‘<code
jackalmage@5934 1368 class=css>column-reverse</code>’</dfn>
jackalmage@5934 1369
jackalmage@5934 1370 <dd> Same as ‘<a href="#flex-flow-column"><code
jackalmage@5934 1371 class=css>column</code></a>’, except the <a
jackalmage@5934 1372 href="#main-start"><i>main-start</i></a> and <a
jackalmage@5934 1373 href="#main-end"><i>main-end</i></a> directions are swapped.
jackalmage@5934 1374 </dl>
jackalmage@5934 1375
fantasai@6290 1376 <p class=note> The reverse values do not reverse box ordering; like
fantasai@6290 1377 ‘<code class=property>writing-mode</code>’ and ‘<code
fantasai@6290 1378 class=property>direction</code>’ <a href="#CSS3-WRITING-MODES"
fantasai@6290 1379 rel=biblioentry>[CSS3-WRITING-MODES]<!--{{CSS3-WRITING-MODES}}--></a>,
fantasai@6290 1380 they only change the direction of flow. Painting order, speech order, and
jackalmage@6292 1381 sequential navigation orders are not affected.
fantasai@6290 1382
jackalmage@5934 1383 <h3 id=flex-wrap-property><span class=secno>5.2. </span> Flex Line
jackalmage@5934 1384 Wrapping: the ‘<a href="#flex-wrap"><code
jackalmage@5934 1385 class=property>flex-wrap</code></a>’ property</h3>
jackalmage@5934 1386
jackalmage@5934 1387 <table class=propdef>
jackalmage@5934 1388 <tbody>
jackalmage@5934 1389 <tr>
jackalmage@5934 1390 <th>Name:
jackalmage@5934 1391
jackalmage@5934 1392 <td><dfn id=flex-wrap>flex-wrap</dfn>
jackalmage@5934 1393
jackalmage@5934 1394 <tr>
jackalmage@5934 1395 <th><a href="#values">Value</a>:
jackalmage@5934 1396
jackalmage@5934 1397 <td>nowrap | wrap | wrap-reverse
jackalmage@5934 1398
jackalmage@5934 1399 <tr>
jackalmage@5934 1400 <th>Initial:
jackalmage@5934 1401
jackalmage@5934 1402 <td>nowrap
jackalmage@5934 1403
jackalmage@5934 1404 <tr>
fantasai@7194 1405 <th>Applies to:
jackalmage@5934 1406
jackalmage@5934 1407 <td>flex containers
jackalmage@5934 1408
jackalmage@5934 1409 <tr>
jackalmage@5934 1410 <th>Inherited:
jackalmage@5934 1411
jackalmage@5934 1412 <td>no
jackalmage@5934 1413
jackalmage@5934 1414 <tr>
fantasai@7194 1415 <th>Computed value:
jackalmage@5934 1416
jackalmage@5934 1417 <td>specified value
jackalmage@5934 1418
jackalmage@5934 1419 <tr>
jackalmage@5934 1420 <th>Media:
jackalmage@5934 1421
jackalmage@5934 1422 <td>visual
jackalmage@5934 1423
jackalmage@5934 1424 <tr>
jackalmage@5934 1425 <th>Animatable:
jackalmage@5934 1426
jackalmage@5934 1427 <td>no
jackalmage@5934 1428
jackalmage@5934 1429 <tr>
jackalmage@5934 1430 <th>Canonical Order:
jackalmage@5934 1431
jackalmage@5934 1432 <td><abbr title="follows order of property value definition">per
jackalmage@5934 1433 grammar</abbr>
jackalmage@5934 1434 </table>
jackalmage@5934 1435
jackalmage@5934 1436 <p> The ‘<a href="#flex-wrap"><code
jackalmage@5934 1437 class=property>flex-wrap</code></a>’ property controls whether the flex
jackalmage@5934 1438 container is <a href="#single-line"><i>single-line</i></a> or <a
jackalmage@5934 1439 href="#multi-line"><i>multi-line</i></a>, and the direction of the
jackalmage@5934 1440 <i>cross-axis</i>, which determines the direction new lines are stacked
jackalmage@5934 1441 in.
jackalmage@5934 1442
jackalmage@5934 1443 <dl>
jackalmage@5934 1444 <dt><dfn id=flex-flow-nowrap>‘<code class=css>nowrap</code>’</dfn>
jackalmage@5934 1445
jackalmage@5934 1446 <dd> The flex container is <a href="#single-line"><i>single-line</i></a>.
jackalmage@5934 1447 The <a href="#cross-start"><i>cross-start</i></a> direction is equivalent
jackalmage@5934 1448 to either the <a
fantasai@6712 1449 href="http://www.w3.org/TR/css3-writing-modes/#start">start</a> or
jackalmage@7082 1450 <i>before</i><!-- <a href="http://www.w3.org/TR/css3-writing-modes/#before">before</a> -->
fantasai@6712 1451 direction of the current <i>writing mode</i>, whichever is in the <a
fantasai@6137 1452 href="#cross-axis"><i>cross axis</i></a>, and the <a
fantasai@6137 1453 href="#cross-end"><i>cross-end</i></a> direction is the opposite
fantasai@6137 1454 direction of <a href="#cross-start"><i>cross-start</i></a>.
jackalmage@5934 1455
jackalmage@5934 1456 <dt><dfn id=flex-flow-wrap>‘<code class=css>wrap</code>’</dfn>
jackalmage@5934 1457
jackalmage@5934 1458 <dd> The flex container is <a href="#multi-line"><i>multi-line</i></a>.
jackalmage@5934 1459 The <a href="#cross-start"><i>cross-start</i></a> direction is equivalent
jackalmage@5934 1460 to either the <a
fantasai@6712 1461 href="http://www.w3.org/TR/css3-writing-modes/#start">start</a> or
jackalmage@7082 1462 <i>before</i><!-- <a href="http://www.w3.org/TR/css3-writing-modes/#before">before</a> -->
fantasai@6712 1463 direction of the current <i>writing mode</i>, whichever is in the <a
fantasai@6137 1464 href="#cross-axis"><i>cross axis</i></a>, and the <a
fantasai@6137 1465 href="#cross-end"><i>cross-end</i></a> direction is the opposite
fantasai@6137 1466 direction of <a href="#cross-start"><i>cross-start</i></a>.
jackalmage@5934 1467
jackalmage@5934 1468 <dt><dfn id=flex-flow-wrap-reverse>‘<code
jackalmage@5934 1469 class=css>wrap-reverse</code>’</dfn>
jackalmage@5934 1470
jackalmage@5934 1471 <dd> Same as ‘<a href="#flex-flow-wrap"><code
jackalmage@5934 1472 class=css>wrap</code></a>’, except the <a
jackalmage@5934 1473 href="#cross-start"><i>cross-start</i></a> and <a
jackalmage@5934 1474 href="#cross-end"><i>cross-end</i></a> directions are swapped.
jackalmage@5934 1475 </dl>
jackalmage@5934 1476
jackalmage@5934 1477 <h3 id=flex-flow-property><span class=secno>5.3. </span> Flex Direction and
jackalmage@5934 1478 Wrap: the ‘<a href="#flex-flow"><code
jackalmage@5934 1479 class=property>flex-flow</code></a>’ shorthand</h3>
jackalmage@5934 1480
jackalmage@5934 1481 <table class=propdef>
jackalmage@5934 1482 <tbody>
jackalmage@5934 1483 <tr>
jackalmage@5934 1484 <th>Name:
jackalmage@5934 1485
jackalmage@5934 1486 <td><dfn id=flex-flow>flex-flow</dfn>
jackalmage@5934 1487
jackalmage@5934 1488 <tr>
jackalmage@5934 1489 <th><a href="#values">Value</a>:
jackalmage@5934 1490
fantasai@6137 1491 <td>&lt;‘<a href="#flex-direction"><code
fantasai@6137 1492 class=property>flex-direction</code></a>’> || &lt;‘<a
fantasai@6137 1493 href="#flex-wrap"><code class=property>flex-wrap</code></a>’>
jackalmage@5934 1494
jackalmage@5934 1495 <tr>
jackalmage@5934 1496 <th>Initial:
jackalmage@5934 1497
jackalmage@5934 1498 <td>see individual properties
jackalmage@5934 1499
jackalmage@5934 1500 <tr>
fantasai@7194 1501 <th>Applies to:
jackalmage@5934 1502
jackalmage@5934 1503 <td>flex containers
jackalmage@5934 1504
jackalmage@5934 1505 <tr>
jackalmage@5934 1506 <th>Inherited:
jackalmage@5934 1507
jackalmage@5934 1508 <td>see individual properties
jackalmage@5934 1509
jackalmage@5934 1510 <tr>
fantasai@7194 1511 <th>Computed value:
jackalmage@5934 1512
jackalmage@5934 1513 <td>see individual properties
jackalmage@5934 1514
jackalmage@5934 1515 <tr>
jackalmage@5934 1516 <th>Media:
jackalmage@5934 1517
jackalmage@5934 1518 <td>visual
jackalmage@5934 1519
jackalmage@5934 1520 <tr>
jackalmage@5934 1521 <th>Animatable:
jackalmage@5934 1522
jackalmage@5934 1523 <td>no
jackalmage@5934 1524
jackalmage@5934 1525 <tr>
jackalmage@5934 1526 <th>Canonical Order:
jackalmage@5934 1527
jackalmage@5934 1528 <td><abbr title="follows order of property value definition">per
jackalmage@5934 1529 grammar</abbr>
jackalmage@5934 1530 </table>
jackalmage@5934 1531
jackalmage@5934 1532 <p>The ‘<a href="#flex-flow"><code class=property>flex-flow</code></a>’
jackalmage@5934 1533 property is a shorthand for setting the ‘<a href="#flex-direction"><code
jackalmage@5934 1534 class=property>flex-direction</code></a>’ and ‘<a
fantasai@6164 1535 href="#flex-wrap"><code class=property>flex-wrap</code></a>’ properties,
fantasai@6164 1536 which together define the flex container's main and cross axes.
jackalmage@5934 1537
jackalmage@5934 1538 <div class=example>
jackalmage@6200 1539 <p>Some examples of valid flows in an English (left-to-right, horizontal
jackalmage@6200 1540 writing mode) document:
jackalmage@5934 1541
jackalmage@5934 1542 <table
jackalmage@5934 1543 style="margin: 0 auto; vertical-align: middle; border-spacing: 2em 1em;">
jackalmage@5934 1544 <tbody>
jackalmage@5934 1545 <tr>
jackalmage@5934 1546 <td>
jackalmage@6092 1547 <pre>
jackalmage@6092 1548 div { flex-flow: row; }
jackalmage@6092 1549 /* Initial value. Main-axis is
jackalmage@5934 1550 inline, no wrap. */</pre>
jackalmage@5934 1551
jackalmage@6613 1552 <td><img alt=alt height=46 src="images/flex-flow1.svg" width=205>
jackalmage@5934 1553
jackalmage@5934 1554 <tr>
jackalmage@5934 1555 <td>
jackalmage@6092 1556 <pre>
jackalmage@6092 1557 div { flex-flow: column wrap; }
jackalmage@6200 1558 /* Main-axis is block-direction (top to bottom)
jackalmage@6200 1559 and lines wrap in the inline direction (rightwards). */</pre>
jackalmage@5934 1560
jackalmage@6613 1561 <td><img alt=alt height=160 src="images/flex-flow2.svg" width=89>
jackalmage@5934 1562
jackalmage@5934 1563 <tr>
jackalmage@5934 1564 <td>
jackalmage@6092 1565 <pre>
jackalmage@6129 1566 div { flex-flow: row-reverse wrap-reverse; }
jackalmage@6129 1567 /* Main-axis is the opposite of inline direction
jackalmage@6129 1568 (right to left). New lines wrap upwards. */</pre>
jackalmage@5934 1569
jackalmage@6613 1570 <td><img alt=alt height=89 src="images/flex-flow3.svg" width=160>
jackalmage@5934 1571 </table>
jackalmage@5934 1572 </div>
jackalmage@5934 1573
jackalmage@6200 1574 <div class=note>
jackalmage@6200 1575 <p> Note that the ‘<a href="#flex-flow"><code
jackalmage@6200 1576 class=property>flex-flow</code></a>’ directions are <i>writing-mode</i>
jackalmage@6200 1577 sensitive. In vertical Japanese, for example, a ‘<a
fantasai@6873 1578 href="#flex-flow-row"><code class=css>row</code></a>’ flex container
fantasai@6873 1579 lays out its contents from top to bottom, as seen in this example:
jackalmage@6200 1580
jackalmage@6200 1581 <table style="margin: 1em auto; text-align: center;">
jackalmage@6200 1582 <thead>
jackalmage@6200 1583 <tr>
jackalmage@6200 1584 <th>English
jackalmage@6200 1585
jackalmage@6200 1586 <th>Japanese
jackalmage@6200 1587
jackalmage@6200 1588 <tbody>
jackalmage@6200 1589 <tr>
jackalmage@6200 1590 <td>
jackalmage@6200 1591 <pre>flex-flow: row wrap;<br>writing-mode: horizontal-tb;</pre>
jackalmage@6200 1592
jackalmage@6200 1593 <td>
jackalmage@6200 1594 <pre>flex-flow: row wrap;<br>writing-mode: vertical-rl;</pre>
jackalmage@6200 1595
jackalmage@6200 1596 <tr>
jackalmage@6613 1597 <td><img alt=alt src="images/flex-flow-english.svg">
jackalmage@6613 1598
jackalmage@6613 1599 <td><img alt=alt src="images/flex-flow-japanese.svg">
jackalmage@6200 1600 </table>
jackalmage@6200 1601 </div>
jackalmage@6129 1602
jackalmage@5934 1603 <h3 id=order-property><span class=secno>5.4. </span> Display Order: the
jackalmage@5934 1604 ‘<a href="#order"><code class=property>order</code></a>’ property</h3>
jackalmage@5934 1605
jackalmage@6093 1606 <p> <a href="#flex-item"><i>Flex items</i></a> are, by default, displayed
jackalmage@5934 1607 and laid out in the same order as they appear in the source document. The
jackalmage@6093 1608 ‘<a href="#order"><code class=property>order</code></a>’ property can
jackalmage@5934 1609 be used to change this ordering.
jackalmage@5934 1610
jackalmage@5934 1611 <table class=propdef>
jackalmage@5934 1612 <tbody>
jackalmage@5934 1613 <tr>
jackalmage@5934 1614 <th>Name:
jackalmage@5934 1615
jackalmage@5934 1616 <td><dfn id=order>order</dfn>
jackalmage@5934 1617
jackalmage@5934 1618 <tr>
jackalmage@5934 1619 <th><a href="#values">Value</a>:
jackalmage@5934 1620
fantasai@6295 1621 <td>&lt;integer>
jackalmage@5934 1622
jackalmage@5934 1623 <tr>
jackalmage@5934 1624 <th>Initial:
jackalmage@5934 1625
jackalmage@5934 1626 <td>0
jackalmage@5934 1627
jackalmage@5934 1628 <tr>
jackalmage@5934 1629 <th>Applies to:
jackalmage@5934 1630
jackalmage@6823 1631 <td>flex items and absolutely-positioned flex container children
jackalmage@5934 1632
jackalmage@5934 1633 <tr>
jackalmage@5934 1634 <th>Inherited:
jackalmage@5934 1635
jackalmage@5934 1636 <td>no
jackalmage@5934 1637
jackalmage@5934 1638 <tr>
jackalmage@5934 1639 <th>Computed value:
jackalmage@5934 1640
jackalmage@5934 1641 <td>specified value
jackalmage@5934 1642
jackalmage@5934 1643 <tr>
jackalmage@5934 1644 <th>Media:
jackalmage@5934 1645
jackalmage@5934 1646 <td>visual
jackalmage@5934 1647
jackalmage@5934 1648 <tr>
jackalmage@5934 1649 <th>Animatable:
jackalmage@5934 1650
jackalmage@5934 1651 <td>yes
jackalmage@5934 1652
jackalmage@5934 1653 <tr>
jackalmage@5934 1654 <th>Canonical Order:
jackalmage@5934 1655
jackalmage@5934 1656 <td><abbr title="follows order of property value definition">per
jackalmage@5934 1657 grammar</abbr>
jackalmage@5934 1658 </table>
jackalmage@5934 1659
jackalmage@5934 1660 <p> The ‘<a href="#order"><code class=property>order</code></a>’
fantasai@6119 1661 property controls the order in which flex items appear within their flex
fantasai@6119 1662 container, by assigning them to ordinal groups.
jackalmage@5934 1663
jackalmage@5934 1664 <p> A flex container will lay out its content starting from the lowest
jackalmage@5934 1665 numbered ordinal group and going up. Items with the same ordinal group are
jackalmage@6094 1666 laid out in the order they appear in the source document. This also
jackalmage@6094 1667 affects the <a href="http://www.w3.org/TR/CSS2/zindex.html">painting
jackalmage@6094 1668 order</a> <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>,
jackalmage@6094 1669 exactly as if the elements were reordered in the document.
jackalmage@5934 1670
jackalmage@5934 1671 <div class=example>
jackalmage@5934 1672 <p>The following figure shows a simple tabbed interface, where the tab for
fantasai@6120 1673 the active pane is always first:
jackalmage@5934 1674
jackalmage@6613 1675 <div class=figure><img alt=alt src="images/flex-order-example.png"></div>
jackalmage@5934 1676
jackalmage@5934 1677 <p>This could be implemented with the following CSS (showing only the
jackalmage@5934 1678 relevant code):
jackalmage@5934 1679
jackalmage@6092 1680 <pre>
jackalmage@6092 1681 .tabs {
jackalmage@6092 1682 display: flex;
jackalmage@6092 1683 }
jackalmage@7745 1684 .tabs > * {
jackalmage@7745 1685 min-width: min-content;
jackalmage@7745 1686 /* Prevent tabs from getting too small for their content. */
jackalmage@7745 1687 }
jackalmage@6092 1688 .tabs > .current {
jackalmage@6092 1689 order: -1; /* Lower than the default of 0 */
jackalmage@5934 1690 }</pre>
jackalmage@5934 1691 </div>
jackalmage@5934 1692
fantasai@6398 1693 <p> Unless otherwise specified by a future specification, this property has
fantasai@6398 1694 no effect on elements that are not <a href="#flex-item"><i>flex
fantasai@6398 1695 items</i></a>. <!--
fantasai@6398 1696 <p class='note'>
fantasai@6398 1697 It is expected that future layout modes like Grid Layout
fantasai@6398 1698 will also use 'order' for similar purposes.
fantasai@6398 1699 -->
fantasai@6398 1700
fantasai@6398 1701 <h4 id=order-accessibility><span class=secno>5.4.1. </span> Reordering and
fantasai@6290 1702 Accessibility</h4>
fantasai@6290 1703
fantasai@6120 1704 <p> The ‘<a href="#order"><code class=property>order</code></a>’
fantasai@6391 1705 property <em>does not</em> affect ordering in non-visual media (such as <a
fantasai@6391 1706 href="http://www.w3.org/TR/css3-speech/">speech</a>). Likewise, ‘<a
fantasai@6289 1707 href="#order"><code class=property>order</code></a>’ does not affect the
fantasai@6290 1708 default traversal order of sequential navigation modes (such as cycling
fantasai@6290 1709 through links, see e.g. ‘<code class=property>nav-index</code>’ <a
fantasai@6290 1710 href="#CSS3UI" rel=biblioentry>[CSS3UI]<!--{{CSS3UI}}--></a> or <a
fantasai@6290 1711 href="http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#sequential-focus-navigation-and-the-tabindex-attribute"><code>tabindex</code></a>
fantasai@6290 1712 <a href="#HTML40" rel=biblioentry>[HTML40]<!--{{HTML40}}--></a>). Authors
fantasai@6290 1713 <em>must</em> use ‘<a href="#order"><code
fantasai@6120 1714 class=property>order</code></a>’ only for visual, not logical,
fantasai@6120 1715 reordering of content; style sheets that use ‘<a href="#order"><code
fantasai@6120 1716 class=property>order</code></a>’ to perform logical reordering are
fantasai@6120 1717 non-conforming.
fantasai@6120 1718
fantasai@6391 1719 <p class=note> This is so that non-visual media and non-CSS UAs, which
fantasai@6391 1720 typically present content linearly, can rely on a logical source order,
fantasai@6120 1721 while ‘<a href="#order"><code class=property>order</code></a>’ is used
fantasai@6391 1722 to tailor the visual order. (Since visual perception is two-dimensional
fantasai@6391 1723 and non-linear, the desired visual order is not always logical.)
fantasai@6120 1724
jackalmage@5934 1725 <div class=example>
jackalmage@5934 1726 <p> Many web pages have a similar shape in the markup, with a header on
jackalmage@5934 1727 top, a footer on bottom, and then a content area and one or two
jackalmage@5934 1728 additional columns in the middle. Generally, it's desirable that the
jackalmage@5934 1729 content come first in the page's source code, before the additional
jackalmage@5934 1730 columns. However, this makes many common designs, such as simply having
jackalmage@5934 1731 the additional columns on the left and the content area on the right,
jackalmage@5934 1732 difficult to achieve. This has been addressed in many ways over the
jackalmage@5934 1733 years, often going by the name "Holy Grail Layout" when there are two
jackalmage@5934 1734 additional columns. ‘<a href="#order"><code
jackalmage@5934 1735 class=property>order</code></a>’ makes this trivial. For example, take
jackalmage@5934 1736 the following sketch of a page's code and desired layout:
jackalmage@5934 1737
jackalmage@5934 1738 <div class=code-and-figure>
jackalmage@5934 1739 <div>
jackalmage@6092 1740 <pre>
jackalmage@6092 1741 &lt;!DOCTYPE html>
jackalmage@6092 1742 &lt;header>...&lt;/header>
jackalmage@6092 1743 &lt;div id='main'>
jackalmage@6092 1744 &lt;article>...&lt;/article>
jackalmage@6092 1745 &lt;nav>...&lt;/nav>
jackalmage@6092 1746 &lt;aside>...&lt;/aside>
jackalmage@6092 1747 &lt;/div>
jackalmage@5934 1748 &lt;footer>...&lt;/footer></pre>
jackalmage@5934 1749 </div>
jackalmage@5934 1750
jackalmage@5934 1751 <div><img
jackalmage@5934 1752 alt="In this page the header is at the top and the footer at the bottom, but the article is in the center, flanked by the nav on the right and the aside on the left."
jackalmage@5934 1753 height=360 src="images/flex-order-page.svg" width=400></div>
jackalmage@5934 1754 </div>
jackalmage@5934 1755
jackalmage@5934 1756 <p> This layout can be easily achieved with flex layout:
jackalmage@5934 1757
jackalmage@6092 1758 <pre>
jackalmage@6092 1759 #main { display: flex; }
jackalmage@7745 1760 #main > article { order: 2; min-width: 12em; flex:1; }
jackalmage@7745 1761 #main > nav { order: 1; width: 200px; }
jackalmage@7745 1762 #main > aside { order: 3; width: 200px; }</pre>
jackalmage@5934 1763
jackalmage@5934 1764 <p> As an added bonus, the columns will all be <a
fantasai@6373 1765 href="#align-stretch">equal-height</a> by default, and the main content
fantasai@6373 1766 will be as wide as necessary to fill the screen. Additionally, this can
fantasai@6373 1767 then be combined with media queries to switch to an all-vertical layout
fantasai@6373 1768 on narrow screens:
jackalmage@5934 1769
jackalmage@6092 1770 <pre>
jackalmage@6092 1771 @media all and (max-width: 600px) {
jackalmage@6092 1772 /* Too narrow to support three columns */
jackalmage@6092 1773 #main { flex-flow: column; }
jackalmage@6092 1774 #main > article, #main > nav, #main > aside {
jackalmage@6092 1775 /* Return them to document order */
jackalmage@6092 1776 order: 0; width: auto;
jackalmage@6092 1777 }
jackalmage@5934 1778 }</pre>
jackalmage@5934 1779
fantasai@6711 1780 <p><small>(Further use of multi-line flex containers to achieve even more
jackalmage@5934 1781 intelligent wrapping left as an exercise for the reader.)</small>
jackalmage@5934 1782 </div>
jackalmage@5934 1783
jackalmage@5934 1784 <h2 id=flex-lines><span class=secno>6. </span> Flex Lines</h2>
jackalmage@5934 1785
jackalmage@5934 1786 <p> A flex container can be either <a
jackalmage@5934 1787 href="#single-line"><i>single-line</i></a> or <a
jackalmage@5934 1788 href="#multi-line"><i>multi-line</i></a>, depending on the ‘<a
jackalmage@5934 1789 href="#flex-wrap"><code class=property>flex-wrap</code></a>’ property:
jackalmage@5934 1790
jackalmage@5934 1791 <ul>
jackalmage@5934 1792 <li> A <dfn id=single-line>single-line</dfn> flex container lays out all
jackalmage@5934 1793 of its children in a single line, even if that would cause its contents
jackalmage@5934 1794 to overflow.
jackalmage@5934 1795
jackalmage@5934 1796 <li> A <dfn id=multi-line>multi-line</dfn> flex container breaks its <a
jackalmage@6162 1797 href="#flex-item"><i>flex items</i></a> across multiple lines, similar to
jackalmage@6162 1798 how text is broken onto a new line when it gets too wide to fit on the
jackalmage@6162 1799 existing line. When additional lines are created, they are stacked in the
jackalmage@6162 1800 flex container along the <a href="#cross-axis"><i>cross axis</i></a>
jackalmage@6162 1801 according to the ‘<a href="#flex-wrap"><code
jackalmage@6162 1802 class=property>flex-wrap</code></a>’ property. Every line contains at
jackalmage@6162 1803 least one <a href="#flex-item"><i>flex item</i></a>, unless the flex
jackalmage@6162 1804 container itself is completely empty.
jackalmage@5934 1805 </ul>
jackalmage@5934 1806
jackalmage@5934 1807 <div class=example>
jackalmage@5934 1808 <p> This example shows four buttons that do not fit horizontally.
jackalmage@5934 1809
jackalmage@6092 1810 <pre>&lt;style>
fantasai@6873 1811 #flex {
jackalmage@6092 1812 display: flex;
jackalmage@6092 1813 flex-flow: row wrap;
jackalmage@6092 1814 width: 300px;
jackalmage@6092 1815 }
jackalmage@6135 1816 .item {
jackalmage@6135 1817 width: 80px;
jackalmage@6092 1818 }
jackalmage@7178 1819 &lt;/style>
jackalmage@6092 1820
fantasai@6873 1821 &lt;div id="flex">
jackalmage@6135 1822 &lt;div class='item'>1&lt;/div>
jackalmage@6135 1823 &lt;div class='item'>2&lt;/div>
jackalmage@6135 1824 &lt;div class='item'>3&lt;/div>
jackalmage@6135 1825 &lt;div class='item'>4&lt;/div>
jackalmage@5934 1826 &lt;/div></pre>
jackalmage@5934 1827
jackalmage@6135 1828 <p> Since the container is 300px wide, only three of the items fit onto a
jackalmage@6135 1829 single line. They take up 240px, with 60px left over of remaining space.
jackalmage@6135 1830 Because the ‘<a href="#flex-flow"><code
fantasai@7228 1831 class=property>flex-flow</code></a>’ property specifies a <a
fantasai@7228 1832 href="#multi-line"><i>multi-line</i></a> flex container (due to the ‘<a
fantasai@7228 1833 href="#flex-flow-wrap"><code class=css>wrap</code></a>’ keyword
fantasai@7228 1834 appearing in its value), the flex container will create an additional
fantasai@7228 1835 line to contain the last item. <figure> <img
fantasai@7228 1836 src="images/multiline-no-flex.svg"> <figcaption> An example rendering of
fantasai@7228 1837 the multi-line flex container. </figcaption> </figure>
jackalmage@6162 1838 </div>
jackalmage@6162 1839
jackalmage@6162 1840 <p> Once content is broken into lines, each line is laid out independently;
jackalmage@6162 1841 flexible lengths and the ‘<a href="#justify-content"><code
jackalmage@6162 1842 class=property>justify-content</code></a>’ and ‘<a
jackalmage@6162 1843 href="#align-self"><code class=property>align-self</code></a>’
jackalmage@6162 1844 properties only consider the items on a single line at a time.
jackalmage@6162 1845
jackalmage@6162 1846 <p> When a flex container has multiple lines, the <a
jackalmage@6162 1847 href="#cross-size"><i>cross size</i></a> of each line is the minimum size
jackalmage@6162 1848 necessary to contain the <a href="#flex-item"><i>flex items</i></a> on the
jackalmage@6162 1849 line (after aligment due to ‘<a href="#align-self"><code
jackalmage@6162 1850 class=property>align-self</code></a>’), and the lines are aligned within
jackalmage@6162 1851 the flex container with the ‘<a href="#align-content"><code
jackalmage@6162 1852 class=property>align-content</code></a>’ property. When a flex container
jackalmage@6162 1853 (even a <a href="#multi-line"><i>multi-line</i></a> one) has only one
jackalmage@6162 1854 line, the <a href="#cross-size"><i>cross size</i></a> of the line is the
jackalmage@6162 1855 <a href="#cross-size"><i>cross size</i></a> of the flex container, and
jackalmage@6162 1856 ‘<a href="#align-content"><code
jackalmage@6162 1857 class=property>align-content</code></a>’ has no effect. The <a
jackalmage@6162 1858 href="#main-size"><i>main size</i></a> of a line is always the same as the
jackalmage@6162 1859 <a href="#main-size"><i>main size</i></a> of the flex container's content
jackalmage@6162 1860 box.
jackalmage@6162 1861
jackalmage@6162 1862 <div class=example>
jackalmage@6162 1863 <p> Here's the same example as the previous, except that the flex items
jackalmage@6162 1864 have all been given ‘<code class=css>flex: auto</code>’. The first
jackalmage@6162 1865 line has 60px of remaining space, and all of the items have the same
jackalmage@6162 1866 flexibility, so each of the three items on that line will receives 20px
jackalmage@6162 1867 of extra width, ending up 100px wide. The remaining item is on a line of
jackalmage@6162 1868 its own and will stretch to the entire width of the line, or 300px.
fantasai@7193 1869 <figure> <img src="images/multiline-flex.svg"> <figcaption> A rendering
jackalmage@6162 1870 of the same as above, but with the items all given ‘<code
jackalmage@6162 1871 class=css>flex: auto</code>’. </figcaption> </figure>
jackalmage@5934 1872 </div>
jackalmage@5934 1873
jackalmage@5934 1874 <h2 id=flexibility><span class=secno>7. </span> Flexibility</h2>
jackalmage@5934 1875
jackalmage@5934 1876 <p> The defining aspect of flex layout is the ability to make the <a
jackalmage@5934 1877 href="#flex-item"><i>flex items</i></a> "flex", altering their width or
jackalmage@5934 1878 height to fill the available space. This is done with the ‘<a
jackalmage@5934 1879 href="#flex"><code class=property>flex</code></a>’ property. A flex
jackalmage@5934 1880 container distributes free space to its items proportional to their <a
jackalmage@6613 1881 href="#flex-grow-factor"><i>flex grow factor</i></a>, or shrinks them to
jackalmage@5934 1882 prevent overflow proportional to their <a
jackalmage@6613 1883 href="#flex-shrink-factor"><i>flex shrink factor</i></a>.
jackalmage@5934 1884
jackalmage@5934 1885 <h3 id=flex-property><span class=secno>7.1. </span> The ‘<a
jackalmage@5934 1886 href="#flex"><code class=property>flex</code></a>’ Shorthand</h3>
jackalmage@5934 1887
jackalmage@5934 1888 <table class=propdef>
jackalmage@5934 1889 <tbody>
jackalmage@5934 1890 <tr>
jackalmage@5934 1891 <th>Name:
jackalmage@5934 1892
jackalmage@5934 1893 <td><dfn id=flex>flex</dfn>
jackalmage@5934 1894
jackalmage@5934 1895 <tr>
jackalmage@5934 1896 <th><a href="#values">Value</a>:
jackalmage@5934 1897
jackalmage@5934 1898 <td>none | [ &lt;&apos;flex-grow&apos;> &lt;&apos;flex-shrink&apos;>? ||
jackalmage@5934 1899 &lt;&apos;flex-basis&apos;> ]
jackalmage@5934 1900
jackalmage@5934 1901 <tr>
jackalmage@5934 1902 <th>Initial:
jackalmage@5934 1903
jackalmage@5934 1904 <td>see individual properties
jackalmage@5934 1905
jackalmage@5934 1906 <tr>
jackalmage@5934 1907 <th>Applies to:
jackalmage@5934 1908
jackalmage@5934 1909 <td>flex items
jackalmage@5934 1910
jackalmage@5934 1911 <tr>
jackalmage@5934 1912 <th>Inherited:
jackalmage@5934 1913
jackalmage@5934 1914 <td>see individual properties
jackalmage@5934 1915
jackalmage@5934 1916 <tr>
fantasai@7194 1917 <th>Computed value:
jackalmage@5934 1918
jackalmage@5934 1919 <td>see individual properties
jackalmage@5934 1920
jackalmage@5934 1921 <tr>
jackalmage@5934 1922 <th>Media:
jackalmage@5934 1923
jackalmage@5934 1924 <td>visual
jackalmage@5934 1925
jackalmage@5934 1926 <tr>
jackalmage@5934 1927 <th>Animatable:
jackalmage@5934 1928
jackalmage@5934 1929 <td>see individual properties
jackalmage@5934 1930
jackalmage@5934 1931 <tr>
jackalmage@5934 1932 <th>Canonical Order:
jackalmage@5934 1933
jackalmage@5934 1934 <td>per grammar
jackalmage@5934 1935 </table>
jackalmage@5934 1936
jackalmage@5934 1937 <p> The ‘<a href="#flex"><code class=property>flex</code></a>’ property
jackalmage@5934 1938 specifies the components of a <dfn id=flexible-length
jackalmage@5934 1939 title="flexible length|flexible length's">flexible length</dfn>: the <a
jackalmage@6613 1940 href="#flex-grow-factor"><i>flex grow factor</i></a> and <a
jackalmage@6613 1941 href="#flex-shrink-factor"><i>flex shrink factor</i></a>, and the <a
jackalmage@5934 1942 href="#flex-basis"><i>flex basis</i></a>. When an element is a <a
jackalmage@5934 1943 href="#flex-item"><i>flex item</i></a>, ‘<a href="#flex"><code
jackalmage@5934 1944 class=property>flex</code></a>’ is consulted <em>instead of</em> the <a
jackalmage@5934 1945 href="#main-size-property"><i>main size property</i></a> to determine the
jackalmage@5934 1946 <a href="#main-size"><i>main size</i></a> of the element. If an element is
jackalmage@5934 1947 not a <a href="#flex-item"><i>flex item</i></a>, ‘<a href="#flex"><code
jackalmage@5934 1948 class=property>flex</code></a>’ has no effect.
jackalmage@5934 1949
fantasai@6369 1950 <dl>
fantasai@6369 1951 <dt><var>&lt;‘<a href="#flex-grow"><code
fantasai@6369 1952 class=property>flex-grow</code></a>’></var>
fantasai@6369 1953
fantasai@6369 1954 <dd>
fantasai@6369 1955 <p> This <var>&lt;number></var> component sets ‘<a
fantasai@6369 1956 href="#flex-grow"><code class=property>flex-grow</code></a>’ <a
fantasai@6369 1957 href="#flex-components">longhand</a> and specifies the <dfn
jackalmage@6613 1958 id=flex-grow-factor>flex grow factor</dfn>, which determines how much
jackalmage@6613 1959 the <a href="#flex-item"><i>flex item</i></a> will grow relative to the
jackalmage@6613 1960 rest of the <a href="#flex-item"><i>flex items</i></a> in the flex
jackalmage@6613 1961 container when positive free space is distributed. When omitted, it is
jackalmage@6613 1962 set to ‘<code class=css>1</code>’.
fantasai@6369 1963
fantasai@6369 1964 <dt><var>&lt;‘<a href="#flex-shrink"><code
fantasai@6369 1965 class=property>flex-shrink</code></a>’></var>
fantasai@6369 1966
fantasai@6369 1967 <dd>
fantasai@6369 1968 <p> This <var>&lt;number></var> component sets ‘<a
fantasai@6369 1969 href="#flex-shrink"><code class=property>flex-shrink</code></a>’ <a
fantasai@6369 1970 href="#flex-components">longhand</a> and specifies the <dfn
jackalmage@6613 1971 id=flex-shrink-factor>flex shrink factor</dfn>, which determines how
jackalmage@6613 1972 much the <a href="#flex-item"><i>flex item</i></a> will shrink relative
jackalmage@6613 1973 to the rest of the <a href="#flex-item"><i>flex items</i></a> in the
jackalmage@6613 1974 flex container when negative free space is distributed. When omitted, it
jackalmage@6613 1975 is set to ‘<code class=css>1</code>’. The <a
jackalmage@6613 1976 href="#flex-shrink-factor"><i>flex shrink factor</i></a> is multiplied
jackalmage@6613 1977 by the <a href="#flex-basis"><i>flex basis</i></a> when distributing
jackalmage@6585 1978 negative space.
fantasai@6369 1979
fantasai@6369 1980 <dt><var>&lt;‘<a href="#flex-basis-propdef"><code
fantasai@6369 1981 class=property>flex-basis</code></a>’></var>
fantasai@6369 1982
fantasai@6369 1983 <dd>
fantasai@6369 1984 <p> This component, which takes the same values as the ‘<code
fantasai@6369 1985 class=property>width</code>’ property, sets the ‘<a
fantasai@6369 1986 href="#flex-basis-propdef"><code class=property>flex-basis</code></a>’
fantasai@6369 1987 <a href="#flex-components">longhand</a> and specifies the <dfn
fantasai@6369 1988 id=flex-basis>flex basis</dfn>: the initial <a href="#main-size"><i>main
fantasai@6369 1989 size</i></a> of the <a href="#flex-item"><i>flex item</i></a>, before
fantasai@6713 1990 free space is distributed according to the flex factors. When omitted
fantasai@6369 1991 from the ‘<a href="#flex"><code class=property>flex</code></a>’
fantasai@6369 1992 shorthand, its specified value is the length zero.
fantasai@6369 1993
fantasai@6369 1994 <p> If the specified ‘<a href="#flex-basis-propdef"><code
fantasai@6369 1995 class=property>flex-basis</code></a>’ is <a
fantasai@6369 1996 href="#flex-basis-auto">‘<code class=css>auto</code>’</a>, the used
fantasai@6369 1997 <a href="#flex-basis"><i>flex basis</i></a> is the value of the
fantasai@6369 1998 element's <a href="#main-size-property"><i>main size property</i></a>.
fantasai@6369 1999 (This can itself be the keyword ‘<code class=css>auto</code>’, which
fantasai@6369 2000 sizes the element based on its contents.) <figure> <img height=240
fantasai@6369 2001 src="images/rel-vs-abs-flex.svg" width=504> <figcaption> A diagram
fantasai@6369 2002 showing the difference between "absolute" flex (starting from a basis of
fantasai@6369 2003 zero) and "relative" flex (starting from a basis of the item's content
fantasai@6713 2004 size). The three items have flex factors of ‘<code
fantasai@6369 2005 class=css>1</code>’, ‘<code class=css>1</code>’, and ‘<code
fantasai@6369 2006 class=css>2</code>’, respectively. </figcaption> </figure>
fantasai@6369 2007
fantasai@6369 2008 <dt><dfn id=flex-none>‘<code class=css>none</code>’</dfn>
fantasai@6369 2009
fantasai@6369 2010 <dd>
fantasai@6369 2011 <p>The keyword ‘<a href="#flex-none"><code
fantasai@6369 2012 class=property>none</code></a>’ computes to ‘<code class=css>0 0
fantasai@6369 2013 auto</code>’.
fantasai@6369 2014 </dl>
fantasai@6369 2015
fantasai@6369 2016 <p> The initial values of the ‘<a href="#flex"><code
fantasai@6369 2017 class=property>flex</code></a>’ components are equivalent to <a
fantasai@6369 2018 href="#flex-initial">‘<code class=css>flex: 0 1 auto</code>’</a>.
fantasai@6369 2019
fantasai@6369 2020 <p class=note> Note that the initial values of ‘<a
fantasai@6369 2021 href="#flex-grow"><code class=property>flex-grow</code></a>’ and ‘<a
fantasai@6369 2022 href="#flex-basis-propdef"><code class=property>flex-basis</code></a>’
fantasai@6369 2023 are different from their defaults when omitted in the ‘<a
fantasai@6369 2024 href="#flex"><code class=property>flex</code></a>’ shorthand. This so
fantasai@6369 2025 that the ‘<a href="#flex"><code class=property>flex</code></a>’
fantasai@6369 2026 shorthand can better accommodate the most <a href="#flex-common">common
fantasai@6369 2027 cases</a>.
jackalmage@5934 2028
fantasai@6710 2029 <p> A unitless zero that is not already preceded by two flex factors must
fantasai@6710 2030 be interpreted as a flex factor. To avoid misinterpretation or invalid
fantasai@6710 2031 declarations, authors must specify a zero <var>&lt;flex-basis></var>
fantasai@6713 2032 component with a unit or precede it by two flex factors.
fantasai@6710 2033
fantasai@6357 2034 <h3 id=flex-common><span class=secno>7.2. </span> Common Values of ‘<a
jackalmage@5934 2035 href="#flex"><code class=property>flex</code></a>’</h3>
jackalmage@5934 2036
jackalmage@5934 2037 <p><em>This section is informative.</em>
jackalmage@5934 2038
jackalmage@5934 2039 <p> The list below summarizes the effects of the most common ‘<a
jackalmage@5934 2040 href="#flex"><code class=property>flex</code></a>’ values:
jackalmage@5934 2041
jackalmage@5934 2042 <dl>
fantasai@6369 2043 <dt id=flex-initial>‘<code class=css>flex: 0 auto</code>’
fantasai@6369 2044
fantasai@6369 2045 <dt>‘<code class=css>flex: initial</code>’
jackalmage@5948 2046
fantasai@6357 2047 <dd> Equivalent to ‘<code class=css>flex: 0 1 auto</code>’. (This is
fantasai@6357 2048 the initial value.) Sizes the item based on the ‘<code
jackalmage@5948 2049 class=property>width</code>’/‘<code class=property>height</code>’
fantasai@6357 2050 properties. (If the item's <a href="#main-size-property"><i>main size
fantasai@6357 2051 property</i></a> computes to ‘<code class=css>auto</code>’, this will
fantasai@6357 2052 size the flex item based on its contents.) Makes the flex item inflexible
jackalmage@7745 2053 when there is positive free space, but allows it to shrink to its
jackalmage@7745 2054 min-size when there is insufficient space. The <a
jackalmage@7745 2055 href="#alignment">alignment abilities</a> or <a
fantasai@6356 2056 href="#auto-margins">‘<code class=css>auto</code>’ margins</a> can be
fantasai@6357 2057 used to align flex items along the <a href="#main-axis"><i>main
fantasai@6357 2058 axis</i></a>.
jackalmage@5948 2059
jackalmage@5934 2060 <dt>‘<code class=css>flex: auto</code>’
jackalmage@5934 2061
fantasai@6357 2062 <dd> Equivalent to ‘<code class=css>flex: 1 1 auto</code>’. Sizes the
fantasai@6357 2063 item based on the ‘<code class=property>width</code>’/‘<code
fantasai@6357 2064 class=property>height</code>’ properties, but makes them fully
fantasai@6357 2065 flexible, so that they absorb any free space along the <a
fantasai@6357 2066 href="#main-axis"><i>main axis</i></a>. If all items are either ‘<code
fantasai@6357 2067 class=css>flex: auto</code>’, ‘<code class=css>flex:
fantasai@6357 2068 initial</code>’, or ‘<code class=css>flex: none</code>’, any
fantasai@6357 2069 positive free space after the items have been sized will be distributed
fantasai@6357 2070 evenly to the items with ‘<code class=css>flex: auto</code>’.
fantasai@6357 2071
fantasai@6357 2072 <dt>‘<code class=css>flex: none</code>’
fantasai@6357 2073
fantasai@6357 2074 <dd> Equivalent to ‘<code class=css>flex: 0 0 auto</code>’. This value
fantasai@6357 2075 sizes the item according to the ‘<code
jackalmage@5934 2076 class=property>width</code>’/‘<code class=property>height</code>’
fantasai@6357 2077 properties, but makes the flex item fully inflexible. This is similar to
fantasai@6357 2078 <a href="#flex-initial">‘<code class=css>initial</code>’</a>, except
fantasai@6357 2079 that flex items are not allowed to shrink, even in overflow situations.
jackalmage@5934 2080
jackalmage@5934 2081 <dt>‘<code class=css>flex: &lt;positive-number></code>’
jackalmage@5934 2082
jackalmage@5934 2083 <dd> Equivalent to ‘<code class=css>flex: &lt;positive-number> 1
fantasai@6357 2084 0px</code>’. Makes the flex item flexible and sets the <a
jackalmage@5934 2085 href="#flex-basis"><i>flex basis</i></a> to zero, resulting in an item
jackalmage@5934 2086 that receives the specified proportion of the free space in the flex
jackalmage@5934 2087 container. If all items in the flex container use this pattern, their
fantasai@6713 2088 sizes will be proportional to the specified flex factor.
jackalmage@5934 2089 </dl>
jackalmage@5934 2090
jackalmage@7745 2091 <div class=note> Note that, because flex items typically can shrink, it is
jackalmage@7745 2092 often recommended that a minimum main size be set (with ‘<code
jackalmage@7745 2093 class=property>min-width</code>’ or ‘<code
jackalmage@7745 2094 class=property>min-height</code>’) to prevent them from shrinking too
jackalmage@7745 2095 small to fit their contents. This problem is especially common with
jackalmage@7745 2096 horizontal navigation or toolbars.
jackalmage@7745 2097 <pre>nav li { flex: 1; min-width: min-content; /* Don't overflow */}</pre>
jackalmage@7745 2098 </div>
jackalmage@5934 2099
jackalmage@5934 2100 <h3 id=flex-components><span class=secno>7.3. </span> Components of
jackalmage@5934 2101 Flexibility</h3>
jackalmage@5934 2102
fantasai@6369 2103 <p> Individual components of flexibility can be controlled by independent
fantasai@6369 2104 longhand properties.
jackalmage@5934 2105
jackalmage@5934 2106 <p class=note> Authors are encouraged to control flexibility using the
jackalmage@5934 2107 ‘<a href="#flex"><code class=property>flex</code></a>’ shorthand
fantasai@5942 2108 rather than with component properties, as the shorthand correctly resets
fantasai@6369 2109 any unspecified components to accommodate <a href="#flex-common">common
fantasai@6369 2110 uses</a>.
jackalmage@5934 2111
jackalmage@5934 2112 <h4 id=flex-grow-property><span class=secno>7.3.1. </span> The ‘<a
jackalmage@5934 2113 href="#flex-grow"><code class=property>flex-grow</code></a>’ property</h4>
jackalmage@5934 2114
jackalmage@5934 2115 <table class=propdef>
jackalmage@5934 2116 <tbody>
jackalmage@5934 2117 <tr>
jackalmage@5934 2118 <th>Name:
jackalmage@5934 2119
jackalmage@5934 2120 <td><dfn id=flex-grow>flex-grow</dfn>
jackalmage@5934 2121
jackalmage@5934 2122 <tr>
jackalmage@5934 2123 <th><a href="#values">Value</a>:
jackalmage@5934 2124
jackalmage@5934 2125 <td>&lt;number>
jackalmage@5934 2126
jackalmage@5934 2127 <tr>
jackalmage@5934 2128 <th>Initial:
jackalmage@5934 2129
fantasai@6432 2130 <td>0
jackalmage@5934 2131
jackalmage@5934 2132 <tr>
jackalmage@5934 2133 <th>Applies to:
jackalmage@5934 2134
jackalmage@5934 2135 <td>flex items
jackalmage@5934 2136
jackalmage@5934 2137 <tr>
jackalmage@5934 2138 <th>Inherited:
jackalmage@5934 2139
jackalmage@5934 2140 <td>no
jackalmage@5934 2141
jackalmage@5934 2142 <tr>
fantasai@7194 2143 <th>Computed value:
jackalmage@5934 2144
jackalmage@5934 2145 <td>specified value
jackalmage@5934 2146
jackalmage@5934 2147 <tr>
jackalmage@5934 2148 <th>Media:
jackalmage@5934 2149
jackalmage@5934 2150 <td>visual
jackalmage@5934 2151
jackalmage@5934 2152 <tr>
jackalmage@5934 2153 <th>Animatable:
jackalmage@5934 2154
jackalmage@5934 2155 <td>yes, except between ‘<code class=css>0</code>’ and other values
jackalmage@5934 2156
jackalmage@5934 2157 <tr>
jackalmage@5934 2158 <th>Canonical Order:
jackalmage@5934 2159
jackalmage@5934 2160 <td><abbr title="follows order of property value definition">per
jackalmage@5934 2161 grammar</abbr>
jackalmage@5934 2162 </table>
jackalmage@5934 2163
jackalmage@5934 2164 <p> The ‘<a href="#flex-grow"><code
jackalmage@5934 2165 class=property>flex-grow</code></a>’ property sets the <a
jackalmage@6613 2166 href="#flex-grow-factor"><i>flex grow factor</i></a>. Negative numbers are
jackalmage@5934 2167 invalid.
jackalmage@5934 2168
jackalmage@5934 2169 <h4 id=flex-shrink-property><span class=secno>7.3.2. </span> The ‘<a
jackalmage@5934 2170 href="#flex-shrink"><code class=property>flex-shrink</code></a>’
jackalmage@5934 2171 property</h4>
jackalmage@5934 2172
jackalmage@5934 2173 <table class=propdef>
jackalmage@5934 2174 <tbody>
jackalmage@5934 2175 <tr>
jackalmage@5934 2176 <th>Name:
jackalmage@5934 2177
jackalmage@5934 2178 <td><dfn id=flex-shrink>flex-shrink</dfn>
jackalmage@5934 2179
jackalmage@5934 2180 <tr>
jackalmage@5934 2181 <th><a href="#values">Value</a>:
jackalmage@5934 2182
jackalmage@5934 2183 <td>&lt;number>
jackalmage@5934 2184
jackalmage@5934 2185 <tr>
jackalmage@5934 2186 <th>Initial:
jackalmage@5934 2187
fantasai@6432 2188 <td>1
jackalmage@5934 2189
jackalmage@5934 2190 <tr>
jackalmage@5934 2191 <th>Applies to:
jackalmage@5934 2192
jackalmage@5934 2193 <td>flex items
jackalmage@5934 2194
jackalmage@5934 2195 <tr>
jackalmage@5934 2196 <th>Inherited:
jackalmage@5934 2197
jackalmage@5934 2198 <td>no
jackalmage@5934 2199
jackalmage@5934 2200 <tr>
fantasai@7194 2201 <th>Computed value:
jackalmage@5934 2202
jackalmage@5934 2203 <td>specified value
jackalmage@5934 2204
jackalmage@5934 2205 <tr>
jackalmage@5934 2206 <th>Media:
jackalmage@5934 2207
jackalmage@5934 2208 <td>visual
jackalmage@5934 2209
jackalmage@5934 2210 <tr>
jackalmage@5934 2211 <th>Animatable:
jackalmage@5934 2212
jackalmage@5934 2213 <td>yes, except between ‘<code class=css>0</code>’ and other values
jackalmage@5934 2214
jackalmage@5934 2215 <tr>
jackalmage@5934 2216 <th>Canonical Order:
jackalmage@5934 2217
jackalmage@5934 2218 <td><abbr title="follows order of property value definition">per
jackalmage@5934 2219 grammar</abbr>
jackalmage@5934 2220 </table>
jackalmage@5934 2221
jackalmage@5934 2222 <p> The ‘<a href="#flex-shrink"><code
jackalmage@5934 2223 class=property>flex-shrink</code></a>’ property sets the <a
jackalmage@6613 2224 href="#flex-shrink-factor"><i>flex shrink factor</i></a>. Negative numbers
jackalmage@5934 2225 are invalid.
jackalmage@5934 2226
jackalmage@5934 2227 <h4 id=flex-basis-property><span class=secno>7.3.3. </span> The ‘<a
fantasai@6369 2228 href="#flex-basis-propdef"><code class=property>flex-basis</code></a>’
fantasai@6369 2229 property</h4>
jackalmage@5934 2230
jackalmage@5934 2231 <table class=propdef>
jackalmage@5934 2232 <tbody>
jackalmage@5934 2233 <tr>
jackalmage@5934 2234 <th>Name:
jackalmage@5934 2235
fantasai@6369 2236 <td><dfn id=flex-basis-propdef>flex-basis</dfn>
jackalmage@5934 2237
jackalmage@5934 2238 <tr>
jackalmage@5934 2239 <th><a href="#values">Value</a>:
jackalmage@5934 2240
jackalmage@5934 2241 <td><var>&lt;&apos;width&apos;></var>
jackalmage@5934 2242
jackalmage@5934 2243 <tr>
jackalmage@5934 2244 <th>Initial:
jackalmage@5934 2245
jackalmage@5934 2246 <td>auto
jackalmage@5934 2247
jackalmage@5934 2248 <tr>
jackalmage@5934 2249 <th>Applies to:
jackalmage@5934 2250
jackalmage@5934 2251 <td>flex items
jackalmage@5934 2252
jackalmage@5934 2253 <tr>
jackalmage@5934 2254 <th>Inherited:
jackalmage@5934 2255
jackalmage@5934 2256 <td>no
jackalmage@5934 2257
jackalmage@5934 2258 <tr>
fantasai@7194 2259 <th>Computed value:
jackalmage@5934 2260
jackalmage@5940 2261 <td>as specified, with lengths made absolute
jackalmage@5940 2262
jackalmage@5940 2263 <tr>
jackalmage@5940 2264 <th>Percentages:
jackalmage@5940 2265
jackalmage@5940 2266 <td>relative to the flex container's inner <a href="#main-size"><i>main
jackalmage@5940 2267 size</i></a>
jackalmage@5934 2268
jackalmage@5934 2269 <tr>
jackalmage@5934 2270 <th>Media:
jackalmage@5934 2271
jackalmage@5934 2272 <td>visual
jackalmage@5934 2273
jackalmage@5934 2274 <tr>
jackalmage@5934 2275 <th>Animatable:
jackalmage@5934 2276
jackalmage@5934 2277 <td>yes, insofar as ‘<code class=property>width</code>’ is
jackalmage@5934 2278 animatable
jackalmage@5934 2279
jackalmage@5934 2280 <tr>
jackalmage@5934 2281 <th>Canonical Order:
jackalmage@5934 2282
jackalmage@5934 2283 <td><abbr title="follows order of property value definition">per
jackalmage@5934 2284 grammar</abbr>
jackalmage@5934 2285 </table>
jackalmage@5934 2286
fantasai@6369 2287 <p> The ‘<a href="#flex-basis-propdef"><code
jackalmage@5934 2288 class=property>flex-basis</code></a>’ property sets the <a
jackalmage@5934 2289 href="#flex-basis"><i>flex basis</i></a>. Negative lengths are invalid.
jackalmage@5934 2290
fantasai@6369 2291 <p> Except for <dfn id=flex-basis-auto title="flex-basis: auto">‘<code
fantasai@6369 2292 class=css>auto</code>’</dfn>, which retrieves the value of the <a
fantasai@6369 2293 href="#main-size-property"><i>main size property</i></a>, ‘<a
fantasai@6369 2294 href="#flex-basis-propdef"><code class=property>flex-basis</code></a>’
fantasai@6369 2295 is resolved the same way as <a
fantasai@6369 2296 href="http://www.w3.org/TR/CSS21/visudet.html#propdef-width">‘<code
fantasai@6369 2297 class=property>width</code>’</a> in horizontal writing modes <a
fantasai@6369 2298 href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>: percentage
fantasai@6369 2299 values of ‘<a href="#flex-basis-propdef"><code
fantasai@6369 2300 class=property>flex-basis</code></a>’ are resolved against the flex
fantasai@6369 2301 item's containing block, i.e. its flex container, and if that containing
fantasai@6369 2302 block's size is indefinite, the result is undefined. Similarly, ‘<a
fantasai@6369 2303 href="#flex-basis-propdef"><code class=property>flex-basis</code></a>’
jackalmage@5934 2304 determines the size of the content box, unless otherwise specified such as
jackalmage@5934 2305 by ‘<code class=property>box-sizing</code>’ <a href="#CSS3UI"
jackalmage@6092 2306 rel=biblioentry>[CSS3UI]<!--{{CSS3UI}}--></a>.
jackalmage@5934 2307
jackalmage@5934 2308 <h2 id=alignment><span class=secno>8. </span> Alignment</h2>
jackalmage@5934 2309
jackalmage@5934 2310 <p> After a flex container's contents have finished their flexing and the
jackalmage@5934 2311 dimensions of all flex items are finalized, they can then be aligned
jackalmage@5934 2312 within the flex container.
jackalmage@5934 2313
jackalmage@5934 2314 <p> The ‘<code class=property>margin</code>’ properties can be used to
jackalmage@5934 2315 align items in a manner similar to, but more powerful than, what margins
jackalmage@5934 2316 can do in block layout. <a href="#flex-item"><i>Flex items</i></a> also
jackalmage@5934 2317 respect the alignment properties from the Box Alignment spec, which allow
jackalmage@5934 2318 easy keyword-based alignment of items in both the <a
jackalmage@5934 2319 href="#main-axis"><i>main axis</i></a> and <a href="#cross-axis"><i>cross
jackalmage@5934 2320 axis</i></a>. These properties make many common types of alignment
jackalmage@5934 2321 trivial, including some things that were very difficult in CSS 2.1, like
jackalmage@5934 2322 horizontal and vertical centering.
jackalmage@5934 2323
jackalmage@5934 2324 <p class=note> While the alignment properties are defined in the Box
fantasai@6873 2325 Alignment spec, Flexible Box Layout reproduces the definitions of the
fantasai@6873 2326 relevant ones here so as to not create a normative dependency that may
fantasai@6873 2327 slow down advancement of the spec. These properties apply only to flex
fantasai@6873 2328 layout until Box Alignment is finished and defines their effect for other
fantasai@6873 2329 layout modes.
jackalmage@5934 2330
fantasai@6356 2331 <h3 id=auto-margins><span class=secno>8.1. </span> Aligning with ‘<code
fantasai@6356 2332 class=css>auto</code>’ margins</h3>
jackalmage@5934 2333
jackalmage@5934 2334 <p> <em>This section is non-normative. The normative definition of how
jackalmage@5934 2335 margins affect flex items is in the <a href="#layout-algorithm">Flex
jackalmage@5934 2336 Layout Algorithm</a> section.</em>
jackalmage@5934 2337
fantasai@6356 2338 <p> Auto margins on flex items have an effect very similar to auto margins
fantasai@6356 2339 in block flow:
jackalmage@5934 2340
jackalmage@5934 2341 <ul>
jackalmage@6092 2342 <li> During calculations of flex bases and flexible lengths, auto margins
jackalmage@6092 2343 are treated as ‘<code class=css>0</code>’.
jackalmage@5934 2344
jackalmage@5934 2345 <li> Prior to alignment via ‘<a href="#justify-content"><code
jackalmage@5934 2346 class=property>justify-content</code></a>’ and ‘<a
jackalmage@5934 2347 href="#align-self"><code class=property>align-self</code></a>’, any
jackalmage@5934 2348 positive free space is distributed to auto margins in that dimension.
jackalmage@5934 2349
jackalmage@6588 2350 <li> Overflowing elements ignore their auto margins and overflow in the
jackalmage@7082 2351 <i>end</i>/<i>after</i> direction.
jackalmage@5934 2352 </ul>
jackalmage@5934 2353
jackalmage@5934 2354 <p class=note> Note that, if free space is distributed to auto margins, the
jackalmage@5934 2355 alignment properties will have no effect in that dimension because the
jackalmage@5934 2356 margins will have stolen all the free space left over after flexing.
jackalmage@5934 2357
jackalmage@5934 2358 <div class=example>
fantasai@6356 2359 <p> One use of ‘<code class=css>auto</code>’ margins in the main axis
fantasai@6356 2360 is to separate flex items into distinct "groups". The following example
fantasai@6356 2361 shows how to use this to reproduce a common UI pattern - a single bar of
fantasai@6356 2362 actions with some aligned on the left and others aligned on the right.
fantasai@6356 2363 <figure> <figcaption> Sample rendering of the code below. </figcaption>
jackalmage@6158 2364 <ul id=auto-bar>
jackalmage@6158 2365 <li><a href="#">About</a>
jackalmage@6158 2366
jackalmage@6158 2367 <li><a href="#">Projects</a>
jackalmage@6158 2368
jackalmage@6158 2369 <li><a href="#">Interact</a>
jackalmage@6158 2370
jackalmage@6158 2371 <li id=login><a href="#">Login</a>
jackalmage@6158 2372 </ul>
jackalmage@6158 2373 </figure>
jackalmage@5934 2374
jackalmage@6092 2375 <pre>
jackalmage@6158 2376 &lt;style>
jackalmage@6158 2377 nav > ul {
jackalmage@6092 2378 display: flex;
jackalmage@6092 2379 }
jackalmage@7745 2380 nav > ul > li {
jackalmage@7745 2381 min-width: min-content;
jackalmage@7745 2382 /* Prevent items from getting too small for their content. */
jackalmage@7745 2383 }
jackalmage@6158 2384 nav > ul > #login {
jackalmage@6158 2385 margin-left: auto;
jackalmage@6092 2386 }
jackalmage@6158 2387 &lt;/style>
jackalmage@6158 2388 &lt;nav>
jackalmage@6158 2389 &lt;ul>
jackalmage@6158 2390 &lt;li>&lt;a href=/about>About&lt;/a>
jackalmage@6158 2391 &lt;li>&lt;a href=/projects>Projects&lt;/a>
jackalmage@6158 2392 &lt;li>&lt;a href=/interact>Interact&lt;/a>
jackalmage@6158 2393 &lt;li id='login'>&lt;a href=/login>Login&lt;/a>
jackalmage@6158 2394 &lt;/ul>
jackalmage@6158 2395 &lt;/nav></pre>
jackalmage@5934 2396 </div>
jackalmage@5934 2397
jackalmage@6160 2398 <div class=example>
jackalmage@6160 2399 <p> The figure below illustrates the difference in cross-axis alignment in
fantasai@6356 2400 overflow situations between using <a href="#auto-margins">‘<code
fantasai@6356 2401 class=css>auto</code>’ margins</a> and using the <a
jackalmage@6160 2402 href="#align-items-property">alignment properties</a>. <figure>
jackalmage@6160 2403 <div style="display:table; margin: 0 auto 1em;">
jackalmage@6160 2404 <div class=cross-auto-figure
jackalmage@6160 2405 style="display:table-cell; padding-right: 50px;">
jackalmage@6160 2406 <div>
jackalmage@6160 2407 <div>About</div>
jackalmage@6160 2408
jackalmage@6160 2409 <div>Authoritarianism</div>
jackalmage@6160 2410
jackalmage@6160 2411 <div>Blog</div>
jackalmage@6160 2412 </div>
jackalmage@6160 2413 </div>
jackalmage@6160 2414
jackalmage@6160 2415 <div class=cross-auto-figure
jackalmage@6160 2416 style="display:table-cell; padding-left: 50px;">
jackalmage@6160 2417 <div>
jackalmage@6160 2418 <div>About</div>
jackalmage@6160 2419
jackalmage@6160 2420 <div style="margin-left: -31px;">Authoritarianism</div>
jackalmage@6160 2421
jackalmage@6160 2422 <div>Blog</div>
jackalmage@6160 2423 </div>
jackalmage@6160 2424 </div>
jackalmage@6160 2425 </div>
jackalmage@6160 2426 <figcaption> The items in the figure on the left are centered with
jackalmage@6160 2427 margins, while those in the figure on the right are centered with ‘<a
jackalmage@6160 2428 href="#align-self"><code class=property>align-self</code></a>’. If this
fantasai@6873 2429 column flex container was placed against the left edge of the page, the
fantasai@6873 2430 margin behavior would be more desirable, as the long item would be fully
jackalmage@6160 2431 readable. In other circumstances, the true centering behavior might be
jackalmage@6160 2432 better. </figcaption> </figure>
jackalmage@6160 2433 </div>
jackalmage@6160 2434
jackalmage@5934 2435 <h3 id=justify-content-property><span class=secno>8.2. </span> Axis
jackalmage@5934 2436 Alignment: the ‘<a href="#justify-content"><code
jackalmage@5934 2437 class=property>justify-content</code></a>’ property</h3>
jackalmage@5934 2438
jackalmage@5934 2439 <table class=propdef>
jackalmage@5934 2440 <tbody>
jackalmage@5934 2441 <tr>
jackalmage@5934 2442 <th>Name:
jackalmage@5934 2443
jackalmage@5934 2444 <td><dfn id=justify-content>justify-content</dfn>
jackalmage@5934 2445
jackalmage@5934 2446 <tr>
jackalmage@5934 2447 <th><a href="#values">Value</a>:
jackalmage@5934 2448
jackalmage@5934 2449 <td>flex-start | flex-end | center | space-between | space-around
jackalmage@5934 2450
jackalmage@5934 2451 <tr>
jackalmage@5934 2452 <th>Initial:
jackalmage@5934 2453
fantasai@5963 2454 <td>flex-start
jackalmage@5934 2455
jackalmage@5934 2456 <tr>
jackalmage@5934 2457 <th>Applies to:
jackalmage@5934 2458
jackalmage@5934 2459 <td>flex containers
jackalmage@5934 2460
jackalmage@5934 2461 <tr>
jackalmage@5934 2462 <th>Inherited:
jackalmage@5934 2463
jackalmage@5934 2464 <td>no
jackalmage@5934 2465
jackalmage@5934 2466 <tr>
fantasai@7194 2467 <th>Computed value:
jackalmage@5934 2468
jackalmage@5934 2469 <td>specified value
jackalmage@5934 2470
jackalmage@5934 2471 <tr>
jackalmage@5934 2472 <th>Media:
jackalmage@5934 2473
jackalmage@5934 2474 <td>visual
jackalmage@5934 2475
jackalmage@5934 2476 <tr>
jackalmage@5934 2477 <th>Animatable:
jackalmage@5934 2478
jackalmage@5934 2479 <td>no
jackalmage@5934 2480
jackalmage@5934 2481 <tr>
jackalmage@5934 2482 <th>Canonical Order:
jackalmage@5934 2483
jackalmage@5934 2484 <td><abbr title="follows order of property value definition">per
jackalmage@5934 2485 grammar</abbr>
jackalmage@5934 2486 </table>
jackalmage@5934 2487
jackalmage@5934 2488 <p> The ‘<a href="#justify-content"><code
jackalmage@5934 2489 class=property>justify-content</code></a>’ property aligns <a
jackalmage@5934 2490 href="#flex-item"><i>flex items</i></a> along the <a
jackalmage@5934 2491 href="#main-axis"><i>main axis</i></a> of the current line of the flex
jackalmage@5934 2492 container. This is done <em title="">after</em> any flexible lengths and
jackalmage@5934 2493 any <a href="#auto-margins">auto margins</a> have been resolved. Typically
jackalmage@5934 2494 it helps distribute extra free space leftover when either all the <a
jackalmage@5934 2495 href="#flex-item"><i>flex items</i></a> on a line are inflexible, or are
jackalmage@5934 2496 flexible but have reached their maximum size. It also exerts some control
jackalmage@5934 2497 over the alignment of items when they overflow the line.
jackalmage@5934 2498
jackalmage@5934 2499 <dl>
fantasai@6356 2500 <dt><dfn id=justify-flex-start>‘<code
jackalmage@5934 2501 class=css>flex-start</code>’</dfn>
jackalmage@5934 2502
jackalmage@5934 2503 <dd> <a href="#flex-item"><i>Flex items</i></a> are packed toward the
jackalmage@5934 2504 start of the line. The <a href="#main-start"><i>main-start</i></a> margin
jackalmage@5934 2505 edge of the first <a href="#flex-item"><i>flex item</i></a> on the line
jackalmage@5934 2506 is placed flush with the <a href="#main-start"><i>main-start</i></a> edge
jackalmage@5934 2507 of the line, and each subsequent <a href="#flex-item"><i>flex
jackalmage@5934 2508 item</i></a> is placed flush with the preceding item.
jackalmage@5934 2509
fantasai@6356 2510 <dt><dfn id=justify-flex-end>‘<code class=css>flex-end</code>’</dfn>
jackalmage@5934 2511
jackalmage@5934 2512 <dd> <a href="#flex-item"><i>Flex items</i></a> are packed toward the end
jackalmage@5934 2513 of the line. The <a href="#main-end"><i>main-end</i></a> margin edge of
jackalmage@5934 2514 the last <a href="#flex-item"><i>flex item</i></a> is placed flush with
jackalmage@5934 2515 the <a href="#main-end"><i>main-end</i></a> edge of the line, and each
jackalmage@5934 2516 preceding <a href="#flex-item"><i>flex item</i></a> is placed flush with
jackalmage@5934 2517 the subsequent item.
jackalmage@5934 2518
fantasai@6356 2519 <dt><dfn id=justify-center>‘<code class=css>center</code>’</dfn>
jackalmage@5934 2520
jackalmage@5934 2521 <dd> <a href="#flex-item"><i>Flex items</i></a> are packed toward the
jackalmage@5934 2522 center of the line. The <a href="#flex-item"><i>flex items</i></a> on the
jackalmage@5934 2523 line are placed flush with each other and aligned in the center of the
jackalmage@5934 2524 line, with equal amounts of empty space between the <a
jackalmage@5934 2525 href="#main-start"><i>main-start</i></a> edge of the line and the first
jackalmage@5934 2526 item on the line and between the <a href="#main-end"><i>main-end</i></a>
jackalmage@5934 2527 edge of the line and the last item on the line. (If the leftover
jackalmage@5934 2528 free-space is negative, the <a href="#flex-item"><i>flex items</i></a>
jackalmage@5934 2529 will overflow equally in both directions.)
jackalmage@5934 2530
fantasai@6356 2531 <dt><dfn id=justify-space-between>‘<code
jackalmage@5934 2532 class=css>space-between</code>’</dfn>
jackalmage@5934 2533
jackalmage@5934 2534 <dd> <a href="#flex-item"><i>Flex items</i></a> are evenly distributed in
jackalmage@5934 2535 the line. If the leftover free-space is negative or there is only a
jackalmage@5934 2536 single <a href="#flex-item"><i>flex item</i></a> on the line, this value
fantasai@6356 2537 is identical to <a href="#justify-flex-start">‘<code
fantasai@6356 2538 class=css>flex-start</code>’</a>. Otherwise, the <a
jackalmage@5934 2539 href="#main-start"><i>main-start</i></a> margin edge of the first <a
jackalmage@5934 2540 href="#flex-item"><i>flex item</i></a> on the line is placed flush with
jackalmage@5934 2541 the <a href="#main-start"><i>main-start</i></a> edge of the line, the <a
jackalmage@5934 2542 href="#main-end"><i>main-end</i></a> margin edge of the last <a
jackalmage@5934 2543 href="#flex-item"><i>flex item</i></a> on the line is placed flush with
jackalmage@5934 2544 the <a href="#main-end"><i>main-end</i></a> edge of the line, and the
jackalmage@5934 2545 remaining <a href="#flex-item"><i>flex items</i></a> on the line are
jackalmage@5934 2546 distributed so that the empty space between any two adjacent items is the
jackalmage@5934 2547 same.
jackalmage@5934 2548
fantasai@6356 2549 <dt><dfn id=justify-space-around>‘<code
jackalmage@5934 2550 class=css>space-around</code>’</dfn>
jackalmage@5934 2551
jackalmage@5934 2552 <dd> <a href="#flex-item"><i>Flex items</i></a> are evenly distributed in
jackalmage@5934 2553 the line, with half-size spaces on either end. If the leftover free-space
jackalmage@6194 2554 is negative or there is only a single <a href="#flex-item"><i>flex
fantasai@6356 2555 item</i></a> on the line, this value is identical to <a
fantasai@6356 2556 href="#justify-center">‘<code class=css>center</code>’</a>.
jackalmage@5934 2557 Otherwise, the <a href="#flex-item"><i>flex items</i></a> on the line are
jackalmage@5934 2558 distributed such that the empty space between any two adjacent <a
jackalmage@5934 2559 href="#flex-item"><i>flex items</i></a> on the line is the same, and the
jackalmage@5934 2560 empty space before the first and after the last <a
jackalmage@5934 2561 href="#flex-item"><i>flex items</i></a> on the line are half the size of
jackalmage@5934 2562 the other empty spaces.
jackalmage@5934 2563 </dl>
jackalmage@5934 2564
jackalmage@6613 2565 <div class=figure> <img alt=alt height=270 src="images/flex-pack.svg"
jackalmage@5934 2566 width=504>
jackalmage@5934 2567 <p class=caption>An illustration of the five ‘<a
jackalmage@5934 2568 href="#justify-content"><code
jackalmage@5934 2569 class=property>justify-content</code></a>’ keywords and their effects
jackalmage@5934 2570 on a flex container with three colored items.
jackalmage@5934 2571 </div>
jackalmage@5934 2572
jackalmage@5934 2573 <h3 id=align-items-property><span class=secno>8.3. </span> Cross-axis
jackalmage@5934 2574 Alignment: the ‘<a href="#align-items"><code
jackalmage@5934 2575 class=property>align-items</code></a>’ and ‘<a
jackalmage@5934 2576 href="#align-self"><code class=property>align-self</code></a>’
jackalmage@5934 2577 properties</h3>
jackalmage@5934 2578
jackalmage@5934 2579 <table class=propdef>
jackalmage@5934 2580 <tbody>
jackalmage@5934 2581 <tr>
jackalmage@5934 2582 <th>Name:
jackalmage@5934 2583
jackalmage@5934 2584 <td><dfn id=align-items>align-items</dfn>
jackalmage@5934 2585
jackalmage@5934 2586 <tr>
jackalmage@5934 2587 <th><a href="#values">Value</a>:
jackalmage@5934 2588
jackalmage@5934 2589 <td>flex-start | flex-end | center | baseline | stretch
jackalmage@5934 2590
jackalmage@5934 2591 <tr>
jackalmage@5934 2592 <th>Initial:
jackalmage@5934 2593
jackalmage@5934 2594 <td>stretch
jackalmage@5934 2595
jackalmage@5934 2596 <tr>
jackalmage@5934 2597 <th>Applies to:
jackalmage@5934 2598
jackalmage@5934 2599 <td>flex containers
jackalmage@5934 2600
jackalmage@5934 2601 <tr>
jackalmage@5934 2602 <th>Inherited:
jackalmage@5934 2603
jackalmage@5934 2604 <td>no
jackalmage@5934 2605
jackalmage@5934 2606 <tr>
fantasai@7194 2607 <th>Computed value:
jackalmage@5934 2608
jackalmage@5934 2609 <td>specified value
jackalmage@5934 2610
jackalmage@5934 2611 <tr>
jackalmage@5934 2612 <th>Media:
jackalmage@5934 2613
jackalmage@5934 2614 <td>visual
jackalmage@5934 2615
jackalmage@5934 2616 <tr>
jackalmage@5934 2617 <th>Animatable:
jackalmage@5934 2618
jackalmage@5934 2619 <td>no
jackalmage@5934 2620
jackalmage@5934 2621 <tr>
jackalmage@5934 2622 <th>Canonical Order:
jackalmage@5934 2623
jackalmage@5934 2624 <td><abbr title="follows order of property value definition">per
jackalmage@5934 2625 grammar</abbr>
jackalmage@5934 2626 </table>
jackalmage@5934 2627
jackalmage@5934 2628 <table class=propdef>
jackalmage@5934 2629 <tbody>
jackalmage@5934 2630 <tr>
jackalmage@5934 2631 <th>Name:
jackalmage@5934 2632
jackalmage@5934 2633 <td><dfn id=align-self>align-self</dfn>
jackalmage@5934 2634
jackalmage@5934 2635 <tr>
jackalmage@5934 2636 <th><a href="#values">Value</a>:
jackalmage@5934 2637
jackalmage@5934 2638 <td>auto | flex-start | flex-end | center | baseline | stretch
jackalmage@5934 2639
jackalmage@5934 2640 <tr>
jackalmage@5934 2641 <th>Initial:
jackalmage@5934 2642
jackalmage@5934 2643 <td>auto
jackalmage@5934 2644
jackalmage@5934 2645 <tr>
jackalmage@5934 2646 <th>Applies to:
jackalmage@5934 2647
jackalmage@5934 2648 <td><a href="#flex-item"><i>flex items</i></a>
jackalmage@5934 2649
jackalmage@5934 2650 <tr>
jackalmage@5934 2651 <th>Inherited:
jackalmage@5934 2652
jackalmage@5934 2653 <td>no
jackalmage@5934 2654
jackalmage@5934 2655 <tr>
fantasai@7194 2656 <th>Computed value:
jackalmage@5934 2657
fantasai@6356 2658 <td>‘<code class=css>auto</code>’ computes to parent's ‘<a
fantasai@6356 2659 href="#align-items"><code class=property>align-items</code></a>’;
fantasai@6356 2660 otherwise as specified
jackalmage@5934 2661
jackalmage@5934 2662 <tr>
jackalmage@5934 2663 <th>Media:
jackalmage@5934 2664
jackalmage@5934 2665 <td>visual
jackalmage@5934 2666
jackalmage@5934 2667 <tr>
jackalmage@5934 2668 <th>Animatable:
jackalmage@5934 2669
jackalmage@5934 2670 <td>no
jackalmage@5934 2671
jackalmage@5934 2672 <tr>
jackalmage@5934 2673 <th>Canonical Order:
jackalmage@5934 2674
jackalmage@5934 2675 <td><abbr title="follows order of property value definition">per
jackalmage@5934 2676 grammar</abbr>
jackalmage@5934 2677 </table>
jackalmage@5934 2678
jackalmage@5934 2679 <p> <a href="#flex-item"><i>Flex items</i></a> can be aligned in the <a
jackalmage@5934 2680 href="#cross-axis"><i>cross axis</i></a> of the current line of the flex
jackalmage@5934 2681 container, similar to ‘<a href="#justify-content"><code
jackalmage@5934 2682 class=property>justify-content</code></a>’ but in the perpendicular
jackalmage@5934 2683 direction. ‘<a href="#align-items"><code
jackalmage@5934 2684 class=property>align-items</code></a>’ sets the default alignment for
jackalmage@5934 2685 all of the flex container's <a href="#flex-item"><i
jackalmage@5934 2686 title="flex items">items</i></a>, including anonymous <a
jackalmage@5934 2687 href="#flex-item"><i>flex items</i></a>. ‘<a href="#align-self"><code
jackalmage@5934 2688 class=property>align-self</code></a>’ allows this default alignment to
jackalmage@5934 2689 be overridden for individual <a href="#flex-item"><i>flex items</i></a>.
jackalmage@5934 2690 (For anonymous flex items, ‘<a href="#align-self"><code
jackalmage@5934 2691 class=property>align-self</code></a>’ always matches the value of ‘<a
jackalmage@5934 2692 href="#align-items"><code class=property>align-items</code></a>’ on
jackalmage@5934 2693 their associated flex container.)
jackalmage@5934 2694
jackalmage@6588 2695 <p> If either of the <a href="#flex-item"><i>flex item's</i></a> cross-axis
jackalmage@6588 2696 margins are ‘<code class=css>auto</code>’, ‘<a
jackalmage@6588 2697 href="#align-self"><code class=property>align-self</code></a>’ has no
jackalmage@6588 2698 effect.
jackalmage@6588 2699
fantasai@6356 2700 <p> A value of <dfn id=align-self-auto title="align-self: auto">‘<code
jackalmage@5934 2701 class=css>auto</code>’</dfn> for ‘<a href="#align-self"><code
jackalmage@5934 2702 class=property>align-self</code></a>’ computes to the value of ‘<a
jackalmage@5934 2703 href="#align-items"><code class=property>align-items</code></a>’ on the
jackalmage@5934 2704 element's parent, or <a href="#align-items-stretch">‘<code
jackalmage@5934 2705 class=css>stretch</code>’</a> if the element has no parent. The
jackalmage@5934 2706 alignments are defined as:
jackalmage@5934 2707
jackalmage@5934 2708 <dl>
fantasai@6356 2709 <dt><dfn id=align-flex-start>‘<code class=css>flex-start</code>’</dfn>
jackalmage@5934 2710
jackalmage@5934 2711 <dd> The <a href="#cross-start"><i>cross-start</i></a> margin edge of the
jackalmage@5934 2712 <a href="#flex-item"><i>flex item</i></a> is placed flush with the <a
jackalmage@5934 2713 href="#cross-start"><i>cross-start</i></a> edge of the line.
jackalmage@5934 2714
fantasai@6356 2715 <dt><dfn id=align-flex-end>‘<code class=css>flex-end</code>’</dfn>
jackalmage@5934 2716
jackalmage@5934 2717 <dd> The <a href="#cross-end"><i>cross-end</i></a> margin edge of the <a
jackalmage@5934 2718 href="#flex-item"><i>flex item</i></a> is placed flush with the <a
jackalmage@5934 2719 href="#cross-end"><i>cross-end</i></a> edge of the line.
jackalmage@5934 2720
fantasai@6356 2721 <dt><dfn id=align-center>‘<code class=css>center</code>’</dfn>
jackalmage@5934 2722
jackalmage@6201 2723 <dd> The <a href="#flex-item"><i>flex item</i></a>&apos;s margin box is
jackalmage@6201 2724 centered in the <a href="#cross-axis"><i>cross axis</i></a> within the
jackalmage@6201 2725 line. (If the <a href="#cross-size"><i>cross size</i></a> of the flex
jackalmage@6201 2726 line is less than that of the <a href="#flex-item"><i>flex item</i></a>,
jackalmage@6201 2727 it will overflow equally in both directions.)
jackalmage@6201 2728
fantasai@6356 2729 <dt><dfn id=align-baseline>‘<code class=css>baseline</code>’</dfn>
jackalmage@5934 2730
jackalmage@5934 2731 <dd>
jackalmage@6194 2732 <p> If the <a href="#flex-item"><i>flex item</i></a>&apos;s inline axis
jackalmage@6194 2733 is the same as the <a href="#cross-axis"><i>cross axis</i></a>, this
fantasai@6356 2734 value is identical to <a href="#align-flex-start">‘<code
fantasai@6356 2735 class=css>flex-start</code>’</a>.
jackalmage@5934 2736
jackalmage@6203 2737 <p> Otherwise, it <dfn id=baseline-participation>participates in baseline
jackalmage@6203 2738 alignment</dfn>: all participating <a href="#flex-item"><i>flex
jackalmage@6203 2739 items</i></a> on the line are aligned such that their baselines align,
jackalmage@6203 2740 and the item with the largest distance between its baseline and its <a
jackalmage@5934 2741 href="#cross-start"><i>cross-start</i></a> margin edge is placed flush
jackalmage@5934 2742 against the <a href="#cross-start"><i>cross-start</i></a> edge of the
jackalmage@5934 2743 line.
jackalmage@5934 2744
fantasai@6356 2745 <dt><dfn id=align-stretch>‘<code class=css>stretch</code>’</dfn>
jackalmage@5934 2746
jackalmage@5934 2747 <dd>
jackalmage@5934 2748 <p> If the <a href="#cross-size-property"><i>cross size property</i></a>
jackalmage@7330 2749 of the <a href="#flex-item"><i>flex item</i></a> computes to ‘<code
fantasai@6356 2750 class=css>auto</code>’, its used value is the length necessary to make
fantasai@6356 2751 the <a href="#cross-size"><i>cross size</i></a> of the item's margin box
fantasai@6356 2752 as close to the same size as the line as possible, while still
fantasai@6356 2753 respecting the constraints imposed by ‘<code
fantasai@6356 2754 class=css>min/max-width/height</code>’.
jackalmage@5934 2755
jackalmage@5934 2756 <p class=note> Note that if the flex container's height is constrained
jackalmage@5934 2757 this value may cause the contents of the <a href="#flex-item"><i>flex
jackalmage@5934 2758 item</i></a> to overflow the item.
jackalmage@5934 2759
jackalmage@5934 2760 <p> The <a href="#cross-start"><i>cross-start</i></a> margin edge of the
jackalmage@5934 2761 <a href="#flex-item"><i>flex item</i></a> is placed flush with the <a
jackalmage@5934 2762 href="#cross-start"><i>cross-start</i></a> edge of the line.
jackalmage@5934 2763 </dl>
jackalmage@5934 2764
jackalmage@6613 2765 <div class=figure> <img alt=alt height=377 src="images/flex-align.svg"
jackalmage@5934 2766 width=508>
jackalmage@5934 2767 <p class=caption>An illustration of the five ‘<a
jackalmage@5934 2768 href="#align-items"><code class=property>align-items</code></a>’
jackalmage@5934 2769 keywords and their effects on a flex container with four colored items.
jackalmage@5934 2770 </div>
jackalmage@5934 2771
fantasai@6141 2772 <h3 id=align-content-property><span class=secno>8.4. </span> Packing Flex
fantasai@6141 2773 Lines: the ‘<a href="#align-content"><code
fantasai@6141 2774 class=property>align-content</code></a>’ property</h3>
jackalmage@5934 2775
jackalmage@5934 2776 <table class=propdef>
jackalmage@5934 2777 <tbody>
jackalmage@5934 2778 <tr>
jackalmage@5934 2779 <th>Name:
jackalmage@5934 2780
jackalmage@5934 2781 <td><dfn id=align-content>align-content</dfn>
jackalmage@5934 2782
jackalmage@5934 2783 <tr>
jackalmage@5934 2784 <th><a href="#values">Value</a>:
jackalmage@5934 2785
jackalmage@5934 2786 <td>flex-start | flex-end | center | space-between | space-around |
jackalmage@5934 2787 stretch
jackalmage@5934 2788
jackalmage@5934 2789 <tr>
jackalmage@5934 2790 <th>Initial:
jackalmage@5934 2791
jackalmage@5934 2792 <td>stretch
jackalmage@5934 2793
jackalmage@5934 2794 <tr>
jackalmage@5934 2795 <th>Applies to:
jackalmage@5934 2796
jackalmage@5934 2797 <td><a href="#multi-line"><i>multi-line</i></a> flex containers
jackalmage@5934 2798
jackalmage@5934 2799 <tr>
jackalmage@5934 2800 <th>Inherited:
jackalmage@5934 2801
jackalmage@5934 2802 <td>no
jackalmage@5934 2803
jackalmage@5934 2804 <tr>
fantasai@7194 2805 <th>Computed value:
jackalmage@5934 2806
jackalmage@5934 2807 <td>specified value
jackalmage@5934 2808
jackalmage@5934 2809 <tr>
jackalmage@5934 2810 <th>Media:
jackalmage@5934 2811
jackalmage@5934 2812 <td>visual
jackalmage@5934 2813
jackalmage@5934 2814 <tr>
jackalmage@5934 2815 <th>Animatable:
jackalmage@5934 2816
jackalmage@5934 2817 <td>no
jackalmage@5934 2818
jackalmage@5934 2819 <tr>
jackalmage@5934 2820 <th>Canonical Order:
jackalmage@5934 2821
jackalmage@5934 2822 <td><abbr title="follows order of property value definition">per
jackalmage@5934 2823 grammar</abbr>
jackalmage@5934 2824 </table>
jackalmage@5934 2825
jackalmage@5934 2826 <p> The ‘<a href="#align-content"><code
jackalmage@5934 2827 class=property>align-content</code></a>’ property aligns a flex
jackalmage@5934 2828 container's lines within the flex container when there is extra space in
jackalmage@5934 2829 the <i>cross-axis</i>, similar to how ‘<a href="#justify-content"><code
jackalmage@5934 2830 class=property>justify-content</code></a>’ aligns individual items
jackalmage@6586 2831 within the <i>main-axis</i>. Note, this property has no effect when the
fantasai@6873 2832 flex container has only a single line. Values have the following meanings:
jackalmage@5934 2833
jackalmage@5934 2834 <dl>
jackalmage@5934 2835 <dt><dfn id=align-content-flex-start>‘<code
jackalmage@5934 2836 class=css>flex-start</code>’</dfn>
jackalmage@5934 2837
jackalmage@5934 2838 <dd> Lines are packed toward the start of the flex container. The <a
jackalmage@5934 2839 href="#cross-start"><i>cross-start</i></a> edge of the first line in the
jackalmage@5934 2840 flex container is placed flush with the <a
jackalmage@5934 2841 href="#cross-start"><i>cross-start</i></a> edge of the flex container,
jackalmage@5934 2842 and each subsequent line is placed flush with the preceding line.
jackalmage@5934 2843
jackalmage@5934 2844 <dt><dfn id=align-content-flex-end>‘<code
jackalmage@5934 2845 class=css>flex-end</code>’</dfn>
jackalmage@5934 2846
jackalmage@5934 2847 <dd> Lines are packed toward the end of the flex container. The <a
jackalmage@5934 2848 href="#cross-end"><i>cross-end</i></a> edge of the last line is placed
jackalmage@5934 2849 flush with the <a href="#cross-end"><i>cross-end</i></a> edge of the flex
jackalmage@5934 2850 container, and each preceding line is placed flush with the subsequent
jackalmage@5934 2851 line.
jackalmage@5934 2852
jackalmage@5934 2853 <dt><dfn id=align-content-center>‘<code class=css>center</code>’</dfn>
jackalmage@5934 2854
jackalmage@5934 2855 <dd> Lines are packed toward the center of the flex container. The lines
jackalmage@5934 2856 in the flex container are placed flush with each other and aligned in the
jackalmage@5934 2857 center of the flex container, with equal amounts of empty space between
jackalmage@5934 2858 the <a href="#cross-start"><i>cross-start</i></a> content edge of the
jackalmage@5934 2859 flex container and the first line in the flex container, and between the
jackalmage@5934 2860 <a href="#cross-end"><i>cross-end</i></a> content edge of the flex
jackalmage@5934 2861 container and the last line in the flex container. (If the leftover
jackalmage@5934 2862 free-space is negative, the lines will overflow equally in both
jackalmage@5934 2863 directions.)
jackalmage@5934 2864
jackalmage@5934 2865 <dt><dfn id=align-content-space-between>‘<code
jackalmage@5934 2866 class=css>space-between</code>’</dfn>
jackalmage@5934 2867
jackalmage@5934 2868 <dd> Lines are evenly distributed in the flex container. If the leftover
jackalmage@6586 2869 free-space is negative this value is identical to <a
fantasai@6373 2870 href="#align-content-flex-start">‘<code
fantasai@6356 2871 class=css>flex-start</code>’</a>. Otherwise, the <a
jackalmage@5934 2872 href="#cross-start"><i>cross-start</i></a> edge of the first line in the
jackalmage@5934 2873 flex container is placed flush with the <a
jackalmage@5934 2874 href="#cross-start"><i>cross-start</i></a> content edge of the flex
jackalmage@5934 2875 container, the <a href="#cross-end"><i>cross-end</i></a> edge of the last
jackalmage@5934 2876 line in the flex container is placed flush with the <a
jackalmage@5934 2877 href="#cross-end"><i>cross-end</i></a> content edge of the flex
jackalmage@5934 2878 container, and the remaining lines in the flex container are distributed
jackalmage@5934 2879 so that the empty space between any two adjacent lines is the same.
jackalmage@5934 2880
jackalmage@5934 2881 <dt><dfn id=align-content-space-around>‘<code
jackalmage@5934 2882 class=css>space-around</code>’</dfn>
jackalmage@5934 2883
jackalmage@5934 2884 <dd> Lines are evenly distributed in the flex container, with half-size
jackalmage@6586 2885 spaces on either end. If the leftover free-space is negative this value
jackalmage@6586 2886 is identical to <a href="#align-content-center">‘<code
jackalmage@6586 2887 class=css>center</code>’</a>. Otherwise, the lines in the flex
jackalmage@6586 2888 container are distributed such that the empty space between any two
jackalmage@6586 2889 adjacent lines is the same, and the empty space before the first and
jackalmage@6586 2890 after the last lines in the flex container are half the size of the other
jackalmage@6586 2891 empty spaces.
jackalmage@5934 2892
jackalmage@5934 2893 <dt><dfn id=align-content-stretch>‘<code
jackalmage@5934 2894 class=css>stretch</code>’</dfn>
jackalmage@5934 2895
jackalmage@5934 2896 <dd> Lines stretch to take up the remaining space. If the leftover
fantasai@6356 2897 free-space is negative, this value is identical to <a
fantasai@6356 2898 href="#align-content-flex-start">‘<code
fantasai@6356 2899 class=css>flex-start</code>’</a>. Otherwise, the free-space is split
jackalmage@5934 2900 equally between all of the lines, increasing their cross size.
jackalmage@5934 2901 </dl>
jackalmage@5934 2902
jackalmage@5934 2903 <p class=note> Note: Only flex containers with multiple lines ever have
jackalmage@5934 2904 free space in the <i>cross-axis</i> for lines to be aligned in, because in
jackalmage@5934 2905 a flex container with a single line the sole line automatically stretches
jackalmage@5934 2906 to fill the space.
jackalmage@5934 2907
jackalmage@6613 2908 <div class=figure> <img alt=alt height=508
jackalmage@5934 2909 src="images/align-content-example.svg" width=612>
jackalmage@5934 2910 <p class=caption> An illustration of the ‘<a href="#align-content"><code
jackalmage@5934 2911 class=property>align-content</code></a>’ keywords and their effects on
fantasai@7228 2912 a <a href="#multi-line"><i>multi-line</i></a> flex container.
jackalmage@5934 2913 </div>
jackalmage@5934 2914
jackalmage@6204 2915 <h3 id=flex-baselines><span class=secno>8.5. </span> Flex Baselines</h3>
fantasai@6141 2916
jackalmage@6203 2917 <p> The baselines of a flex container are determined as follows (after
jackalmage@6203 2918 reordering with ‘<a href="#order"><code
jackalmage@6203 2919 class=property>order</code></a>’):
jackalmage@6203 2920
jackalmage@6203 2921 <dl>
jackalmage@6203 2922 <dt><dfn id=main-axis-baseline>main-axis baseline</dfn>
jackalmage@6203 2923
jackalmage@6203 2924 <dd>
jackalmage@6203 2925 <ol>
jackalmage@6203 2926 <li> If any of the <a href="#flex-item"><i>flex items</i></a> on the
jackalmage@6203 2927 flex container's first line <a
jackalmage@6203 2928 href="#baseline-participation">participate in baseline alignment</a>,
jackalmage@6203 2929 the flex container's <a href="#main-axis-baseline"><i>main-axis
jackalmage@6203 2930 baseline</i></a> is the baseline of those <a href="#flex-item"><i>flex
jackalmage@6203 2931 items</i></a>.
jackalmage@6203 2932
jackalmage@6203 2933 <li> Otherwise, if the flex container has at least one <a
jackalmage@6203 2934 href="#flex-item"><i>flex item</i></a>, and its first <a
jackalmage@6203 2935 href="#flex-item"><i>flex item</i></a> has a baseline parallel to the
jackalmage@6203 2936 flex container's <a href="#main-axis"><i>main axis</i></a>, the flex
jackalmage@6203 2937 container's <a href="#main-axis-baseline"><i>main-axis baseline</i></a>
jackalmage@6203 2938 is that baseline.
jackalmage@6203 2939
jackalmage@6203 2940 <li> Otherwise, the flex container's <a
jackalmage@6203 2941 href="#main-axis-baseline"><i>main-axis baseline</i></a> is <a
jackalmage@6203 2942 href="http://www.w3.org/TR/css3-writing-modes/#inline-alignment">synthesized</a>
jackalmage@6209 2943 from the first item's content box, or, failing that, from the flex
jackalmage@6615 2944 container's content box. <!--
jackalmage@6615 2945 Logic behind this choice (because it's different than other baseline calculations):
jackalmage@6615 2946 If a flexbox has content, the baseline will definitely be inside the flexbox's content box.
jackalmage@6615 2947 Thus, using the *flexbox's* content box keeps this fairly consistent -
jackalmage@6615 2948 you don't suddenly jump outside the content box when you delete the last bit of content.
jackalmage@6615 2949 -->
jackalmage@6203 2950 </ol>
jackalmage@6203 2951
jackalmage@6203 2952 <dt><dfn id=cross-axis-baseline>cross-axis baseline</dfn>
jackalmage@6203 2953
jackalmage@6203 2954 <dd>
jackalmage@6203 2955 <ol>
jackalmage@6203 2956 <li> If the flex container has at least one <a href="#flex-item"><i>flex
jackalmage@6203 2957 item</i></a>, and its first <a href="#flex-item"><i>flex item</i></a>
jackalmage@6203 2958 has a baseline parallel to the flex container's <a
jackalmage@6203 2959 href="#cross-axis"><i>cross axis</i></a>, the flex container's <a
jackalmage@6203 2960 href="#cross-axis-baseline"><i>cross-axis baseline</i></a> is that
jackalmage@6203 2961 baseline.
jackalmage@6203 2962
jackalmage@6203 2963 <li> Otherwise, the flex container's <a
jackalmage@6203 2964 href="#cross-axis-baseline"><i>cross-axis baseline</i></a> is <a
jackalmage@6203 2965 href="http://www.w3.org/TR/css3-writing-modes/#inline-alignment">synthesized</a>
jackalmage@6209 2966 from the first item's content box, or, failing that, from the flex
jackalmage@6208 2967 container's content box.
jackalmage@6203 2968 </ol>
jackalmage@6203 2969 </dl>
jackalmage@6203 2970
jackalmage@6656 2971 <p> When calculating the baseline according to the above rules, if the box
jackalmage@6656 2972 contributing a baseline has an ‘<code class=property>overflow</code>’
jackalmage@6656 2973 value that allows scrolling, the box must be treated as being in its
jackalmage@6656 2974 initial scroll position for the purpose of determining its baseline.
jackalmage@6656 2975
jackalmage@6203 2976 <p> When <a
jackalmage@6203 2977 href="http://www.w3.org/TR/CSS21/tables.html#height-layout">determining
jackalmage@6203 2978 the baseline of a table cell</a>, a flex container provides a baseline
jackalmage@6212 2979 just as a line box or table-row does. <a href="#CSS21"
jackalmage@6203 2980 rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>
jackalmage@6203 2981
jackalmage@6203 2982 <div class=note>
jackalmage@6203 2983 <p> CSS 2.1 did not define the baseline of block or table boxes. It is
jackalmage@6203 2984 expected that they will be defined consistent with those of <a
jackalmage@6203 2985 href="http://www.w3.org/TR/CSS2/tables.html#height-layout">table
jackalmage@6203 2986 cells</a>, as follows:
jackalmage@6203 2987
jackalmage@6203 2988 <dl>
jackalmage@6203 2989 <dt>‘<code class=css>block</code>’
jackalmage@6203 2990
jackalmage@6203 2991 <dt>‘<code class=css>list-item</code>’
jackalmage@6203 2992
jackalmage@6203 2993 <dd>
jackalmage@6203 2994 <p> The inline-axis baseline of a block is the baseline of the first
jackalmage@6203 2995 in-flow line box in the block, or the first in-flow block-level child
jackalmage@6203 2996 in the block that has a baseline, whichever comes first. If there is no
jackalmage@6203 2997 such line box or child, then the block has no baseline. For the
jackalmage@6203 2998 purposes of finding a baseline, in-flow boxes with a scrolling
jackalmage@6203 2999 mechanisms (see the ‘<code class=property>overflow</code>’
jackalmage@6203 3000 property) must be considered as if scrolled to their origin position.
jackalmage@6203 3001
jackalmage@6203 3002 <p> A block has no block-axis baseline.
jackalmage@6203 3003
jackalmage@6203 3004 <dt>‘<code class=css>table</code>’
jackalmage@6203 3005
jackalmage@6203 3006 <dd>
jackalmage@6203 3007 <p> The inline-axis baseline of a table box is the baseline of its first
jackalmage@6319 3008 row. However, when calculating the baseline of an inline-block, table
jackalmage@6319 3009 boxes must be skipped.
jackalmage@6203 3010
jackalmage@6203 3011 <p> The block-axis baseline of a table is undefined.
jackalmage@6203 3012 </dl>
jackalmage@6203 3013 </div>
fantasai@6141 3014
jackalmage@5934 3015 <h2 id=layout-algorithm><span class=secno>9. </span> Flex Layout Algorithm</h2>
jackalmage@5934 3016
jackalmage@5934 3017 <p> This section contains normative algorithms detailing the exact layout
jackalmage@5934 3018 behavior of a flex container and its contents. The algorithms here are
jackalmage@5934 3019 written to optimize readability and theoretical simplicity, and may not
jackalmage@5934 3020 necessarily be the most efficient. Implementations may use whatever actual
jackalmage@5934 3021 algorithms they wish, but must produce the same results as the algorithms
jackalmage@5934 3022 described here.
jackalmage@5934 3023
jackalmage@5934 3024 <p class=note> This section is mainly intended for implementors. Authors
jackalmage@5934 3025 writing web pages should generally be served well by the individual
jackalmage@5934 3026 property descriptions, and do not need to read this section unless they
jackalmage@7082 3027 have a deep-seated urge to understand arcane details of CSS layout.
jackalmage@5934 3028
jackalmage@5934 3029 <p> For the purposes of these definitions, a <dfn id=definite-size
jackalmage@5934 3030 title="definite|definite size">definite size</dfn> is one that can be
fantasai@6126 3031 determined without measuring content, i.e. is a <var>&lt;length></var>, a
fantasai@6126 3032 size of the initial containing block, or a <var>&lt;percentage></var> that
jackalmage@7343 3033 is resolved against a definite size. If a <a
jackalmage@7343 3034 href="#single-line"><i>single-line</i></a> <a
jackalmage@7343 3035 href="#flex-container"><i>flex container</i></a> has a definite cross
jackalmage@7343 3036 size, any <a href="#flex-item"><i>flex items</i></a> with ‘<code
jackalmage@7343 3037 class=css>align-self: stretch</code>’ must also be treated as having a
jackalmage@7343 3038 definite cross size. An <dfn id=indefinite-size
jackalmage@5934 3039 title="indefinite|indefinite size">indefinite size</dfn> is one that is
jackalmage@5934 3040 not <a href="#definite-size"><i>definite</i></a>.
jackalmage@5934 3041
jackalmage@5934 3042 <p> The following sections define the algorithm for laying out a flex
jackalmage@5934 3043 container and its contents.
jackalmage@5934 3044
jackalmage@5934 3045 <h3 id=box-manip><span class=secno>9.1. </span> Initial Setup</h3>
jackalmage@5934 3046
jackalmage@5934 3047 <ol start=0>
jackalmage@6095 3048 <li id=algo-anon-box> <strong>Generate anonymous flex items</strong> as
jackalmage@6095 3049 described in the <a href="#flex-items">Flex Items</a> section.
jackalmage@5934 3050
jackalmage@6823 3051 <li id=algo-flex-order> <strong>Re-order the flex items and absolutely
jackalmage@6823 3052 positioned flex container children according to their ‘<a
jackalmage@6823 3053 href="#order"><code class=property>order</code></a>’.</strong> The
jackalmage@6823 3054 elements with the lowest (most negative) ‘<a href="#order"><code
jackalmage@5934 3055 class=property>order</code></a>’ values are first in the ordering. If
jackalmage@6823 3056 multiple elements share an ‘<a href="#order"><code
jackalmage@5934 3057 class=property>order</code></a>’ value, they're ordered by document
jackalmage@6823 3058 order. This affects the order in which the elements generate boxes in the
jackalmage@6823 3059 box-tree, and how the rest of this algorithm deals with the generated
jackalmage@6823 3060 flex items.
jackalmage@5934 3061 </ol>
jackalmage@5934 3062
jackalmage@5934 3063 <h3 id=line-sizing><span class=secno>9.2. </span> Line Length Determination</h3>
jackalmage@5934 3064
jackalmage@5934 3065 <ol class=continue>
jackalmage@5934 3066 <li id=algo-available> <strong>Determine the available main and cross
jackalmage@5934 3067 space for the flex items.</strong> For each dimension, if that dimension
jackalmage@5934 3068 of the flex container is a <a href="#definite-size"><i>definite
jackalmage@5934 3069 size</i></a>, use that; otherwise, subtract the flex container's margin,
jackalmage@5934 3070 border, and padding from the space available to the flex container in
jackalmage@5934 3071 that dimension and use that value. <span class=note>This might result in
jackalmage@5934 3072 an infinite value.</span>
jackalmage@5934 3073
fantasai@5943 3074 <li id=algo-main-item> <strong>Determine the <dfn id=flex-base-size>flex
fantasai@5943 3075 base size</dfn> and <dfn id=hypothetical-main-size>hypothetical main
fantasai@5943 3076 size</dfn> of each item:</strong>
jackalmage@5934 3077 <ul>
jackalmage@5934 3078 <li> If the item has a <a href="#definite-size"><i>definite</i></a> flex
fantasai@5943 3079 basis, that's the <a href="#flex-base-size"><i>flex base size</i></a>.
jackalmage@5934 3080
fantasai@6356 3081 <li> If the flex basis is ‘<code class=css>auto</code>’ or depends
fantasai@6356 3082 on its available size, and the flex container is being sized under a
fantasai@6356 3083 min-content or max-content constraint (e.g. when performing <a
jackalmage@6108 3084 href="http://www.w3.org/TR/CSS21/tables.html#auto-table-layout">automatic
jackalmage@6108 3085 table layout</a> <a href="#CSS21"
jackalmage@6108 3086 rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>), size the item under that
jackalmage@6108 3087 constraint. The <a href="#flex-base-size"><i>flex base size</i></a> is
jackalmage@6108 3088 the item's resulting main size.
jackalmage@6108 3089
fantasai@7228 3090 <li> If flex item has an intrinsic aspect ratio, the flex item has
fantasai@7228 3091 ‘<code class=css>align-self: stretch</code>’, the flex basis and
fantasai@7228 3092 cross size are both ‘<code class=css>auto</code>’ , and the flex
fantasai@7228 3093 container is <a href="#single-line"><i>single-line</i></a> and has a <a
fantasai@7228 3094 href="#definite-size"><i>definite</i></a> cross size, the <a
jackalmage@7083 3095 href="#flex-base-size"><i>flex base size</i></a> is computed from the
jackalmage@7330 3096 flex container's inner cross size (clamped to the <a
jackalmage@7330 3097 href="#flex-item"><i>flex item</i></a>’s min and max <a
jackalmage@7330 3098 href="#cross-size"><i>cross size</i></a>) and the <a
jackalmage@7330 3099 href="#flex-item"><i>flex item</i></a>’s intrinsic aspect ratio.
jackalmage@7083 3100 <p class=issue> This substep needs review, see thread at <a
jackalmage@7083 3101 href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0781.html">http://lists.w3.org/Archives/Public/www-style/2012Oct/0781.html</a>.
jackalmage@7083 3102
fantasai@6356 3103 <li> Otherwise, if the flex basis is ‘<code class=css>auto</code>’
fantasai@6356 3104 or depends on its available size, the available main size is infinite,
fantasai@6356 3105 and the flex item's inline axis is parallel to the main axis, lay the
fantasai@6356 3106 item out using <a
jackalmage@6108 3107 href="http://www.w3.org/TR/css3-writing-modes/#orthogonal-flows">the
jackalmage@6108 3108 rules for a box in an orthogonal flow</a> <a href="#CSS3-WRITING-MODES"
jackalmage@6108 3109 rel=biblioentry>[CSS3-WRITING-MODES]<!--{{!CSS3-WRITING-MODES}}--></a>.
jackalmage@6108 3110 The <a href="#flex-base-size"><i>flex base size</i></a> is the item's
jackalmage@6108 3111 max-content main size.
jackalmage@6106 3112
jackalmage@6106 3113 <li> Otherwise, lay out the item into the available space using its flex
fantasai@6356 3114 basis in place of its main size, and treating ‘<code
fantasai@6356 3115 class=css>auto</code>’ as ‘<code class=css>max-content</code>’.
fantasai@6356 3116 The <a href="#flex-base-size"><i>flex base size</i></a> is the item's
fantasai@6356 3117 resulting main size.
jackalmage@5934 3118 </ul>
jackalmage@6111 3119 The <a href="#hypothetical-main-size"><i>hypothetical main size</i></a>
jackalmage@6111 3120 is the item's <a href="#flex-base-size"><i>flex base size</i></a> clamped
jackalmage@6111 3121 according to its min and max main size properties.
jackalmage@5934 3122
jackalmage@5934 3123 <li id=algo-main-container> <strong>Determine the main size of the flex
fantasai@7227 3124 container</strong> using the rules of the formatting context in which it
fantasai@7227 3125 participates. In this calculation, the <i>min-content main size</i> of
fantasai@7227 3126 the flex container is the maximum of the flex container's items'
jackalmage@5934 3127 <i>min-content size contributions</i>, and the <i>max content main
jackalmage@5934 3128 size</i> of the flex container is the sum of the flex container's items'
fantasai@5943 3129 <i>max-content size contributions</i>. The min-content/max-content main
fantasai@5943 3130 size contribution of an item is its outer <a
fantasai@5943 3131 href="#hypothetical-main-size"><i>hypothetical main size</i></a> when
fantasai@5945 3132 sized under a min-content/max-content constraint (respectively). For this
jackalmage@6588 3133 computation, ‘<code class=css>auto</code>’ margins on flex items are
jackalmage@6588 3134 treated as ‘<code class=css>0</code>’.
jackalmage@5934 3135 </ol>
jackalmage@5934 3136
jackalmage@5934 3137 <h3 id=main-sizing><span class=secno>9.3. </span> Main Size Determination</h3>
jackalmage@5934 3138
jackalmage@5934 3139 <ol class=continue>
jackalmage@5934 3140 <li id=algo-line-break> <strong>Collect flex items into flex
jackalmage@5934 3141 lines:</strong>
jackalmage@5934 3142 <ul>
fantasai@7228 3143 <li> If the flex container is <a
fantasai@7228 3144 href="#single-line"><i>single-line</i></a>, collect all the flex items
jackalmage@5934 3145 into a single flex line.
jackalmage@5934 3146
jackalmage@7336 3147 <li> Otherwise, starting from the first uncollected item, collect
jackalmage@7336 3148 consecutive items one by one until the first time that the
jackalmage@7336 3149 <em>next</em> collected item would not fit into the flex container's
jackalmage@7336 3150 inner main size, or until a forced break is encountered. If the very
jackalmage@7336 3151 first uncollected item wouldn't fit, collect just it into the line. A
jackalmage@7336 3152 break is forced wherever the CSS2.1 ‘<code
jackalmage@7336 3153 class=css>page-break-before/after</code>’ <a href="#CSS21"
jackalmage@6092 3154 rel=biblioentry>[CSS21]<!--{{CSS21}}--></a> or the CSS3 ‘<code
jackalmage@5934 3155 class=css>break-before/after</code>’ <a href="#CSS3-BREAK"
jackalmage@6092 3156 rel=biblioentry>[CSS3-BREAK]<!--{{CSS3-BREAK}}--></a> properties
jackalmage@5934 3157 specify a fragmentation break.
fantasai@5943 3158 <p> For this step, the size of a flex item is its outer <a
fantasai@5943 3159 href="#hypothetical-main-size"><i>hypothetical main size</i></a>.
jackalmage@5934 3160
jackalmage@5934 3161 <p> Repeat until all flex items have been collected into flex lines.
jackalmage@5934 3162
jackalmage@7332 3163 <p class=note> Note that the "collect as many" line will collect
jackalmage@7332 3164 zero-sized flex items onto the end of the previous line even if the
jackalmage@7332 3165 last non-zero item exactly "filled up" the line.
jackalmage@5934 3166 </ul>
jackalmage@5934 3167
jackalmage@5934 3168 <li id=algo-flex> <strong><a href="#resolve-flexible-lengths">Resolve the
jackalmage@5934 3169 flexible lengths</a></strong> of all the flex items to find their used
jackalmage@6206 3170 main size (see section 9.7.).
jackalmage@5934 3171 </ol>
jackalmage@5934 3172
jackalmage@5934 3173 <h3 id=cross-sizing><span class=secno>9.4. </span> Cross size determination</h3>
jackalmage@5934 3174
jackalmage@5934 3175 <ol class=continue>
jackalmage@6206 3176 <li id=algo-cross-item> <strong>Determine the <dfn
jackalmage@6206 3177 id=hypothetical-cross-size>hypothetical cross size</dfn> of each
jackalmage@6206 3178 item</strong> by performing layout with the used main size and the
fantasai@6356 3179 available space, treating ‘<code class=css>auto</code>’ as ‘<code
fantasai@6356 3180 class=css>fit-content</code>’.
jackalmage@6206 3181
jackalmage@5934 3182 <li id=algo-cross-line> <strong>Calculate the cross size of each flex
jackalmage@5934 3183 line.</strong>
jackalmage@5934 3184 <p> If the flex container has only a single line (even if it's a <a
jackalmage@7089 3185 href="#multi-line"><i>multi-line</i></a> flex container) and has a <a
jackalmage@7089 3186 href="#definite-size"><i>definite</i></a> cross size, the cross size of
jackalmage@7089 3187 the flex line is the flex container's inner cross size.
jackalmage@5934 3188
jackalmage@5934 3189 <p> Otherwise, for each flex line:
jackalmage@5934 3190
jackalmage@5934 3191 <ol>
jackalmage@5934 3192 <li> Collect all the flex items whose inline-axis is parallel to the
jackalmage@5934 3193 main-axis, whose ‘<a href="#align-self"><code
fantasai@6356 3194 class=property>align-self</code></a>’ is <a
fantasai@6356 3195 href="#align-baseline">‘<code class=css>baseline</code>’</a>, and
fantasai@6356 3196 whose cross-axis margins are both non-‘<code
fantasai@6356 3197 class=css>auto</code>’. Find the largest of the distances between
fantasai@6356 3198 each item's baseline and its hypothetical outer cross-start edge, and
fantasai@6356 3199 the largest of the distances between each item's baseline and its
fantasai@6356 3200 hypothetical outer cross-end edge, and sum these two values.
jackalmage@5934 3201
jackalmage@5934 3202 <li> Among all the items not collected by the previous step, find the
fantasai@5943 3203 largest outer <a href="#hypothetical-cross-size"><i>hypothetical cross
fantasai@5943 3204 size</i></a>.
fantasai@5943 3205
jackalmage@7331 3206 <li> The used cross-size of the flex line is the largest of the numbers
jackalmage@7331 3207 found in the previous two steps and zero.
jackalmage@5934 3208 </ol>
jackalmage@5934 3209
jackalmage@5934 3210 <li id=algo-line-stretch> <strong>Handle ‘<code class=css>align-content:
jackalmage@5934 3211 stretch</code>’.</strong> If the flex container has a <a
jackalmage@5934 3212 href="#definite-size"><i>definite</i></a> cross size, ‘<a
jackalmage@5934 3213 href="#align-content"><code class=property>align-content</code></a>’ is
jackalmage@5934 3214 <a href="#align-content-stretch">‘<code
jackalmage@5934 3215 class=css>stretch</code>’</a>, and the sum of the flex lines' cross
jackalmage@5934 3216 sizes is less than the flex container's inner cross size, increase the
jackalmage@5934 3217 cross size of each flex line by equal amounts such that the sum of their
jackalmage@5934 3218 cross sizes exactly equals the flex container's inner cross size.
jackalmage@5934 3219
jackalmage@5934 3220 <li id=algo-visibility> <strong>Collapse ‘<code
jackalmage@5934 3221 class=css>visibility:collapse</code>’ items.</strong> If any flex items
jackalmage@5934 3222 have ‘<code class=css>visibility: collapse</code>’, note the cross
jackalmage@5934 3223 size of the line they're in as the item's <dfn id=strut-size>strut
jackalmage@5934 3224 size</dfn>, and restart layout from the beginning.
jackalmage@5934 3225 <p> In this second layout round, when <a
jackalmage@5934 3226 href="#algo-line-break">collecting items into lines</a>, treat the
jackalmage@5934 3227 collapsed items as having zero main size. For the rest of the algorithm
jackalmage@5934 3228 following that step, ignore the collapsed items entirely (as if they
jackalmage@5934 3229 were ‘<code class=css>display:none</code>’) except that after <a
jackalmage@5934 3230 href="#algo-cross-line">calculating the cross size of the lines</a>, if
jackalmage@5934 3231 any line's cross size is less than the largest <a
jackalmage@5934 3232 href="#strut-size"><var>strut size</var></a> among all the collapsed
jackalmage@5934 3233 items in the line, set its cross size to that <a
jackalmage@5934 3234 href="#strut-size"><var>strut size</var></a>.
jackalmage@5934 3235
jackalmage@5934 3236 <p> Skip this step in the second layout round.
jackalmage@5934 3237
fantasai@6267 3238 <li id=algo-stretch> <strong>Determine the used cross size of each flex
jackalmage@5934 3239 item.</strong> If a flex item has ‘<code class=css>align-self:
jackalmage@7090 3240 stretch</code>’, its computed cross size property is ‘<code
fantasai@6356 3241 class=css>auto</code>’, and neither of its cross-axis margins are
fantasai@6356 3242 ‘<code class=css>auto</code>’, the used outer cross size is the used
fantasai@6356 3243 cross size of its flex line, clamped according to the item's min and max
fantasai@6356 3244 cross size properties. Otherwise, the used cross size is the item's <a
fantasai@5943 3245 href="#hypothetical-cross-size"><i>hypothetical cross size</i></a>.
jackalmage@7084 3246 <p class=note> Note that this step does not affect the main size of the
jackalmage@7084 3247 flex item, even if it has an intrinsic aspect ratio.
jackalmage@5934 3248 </ol>
jackalmage@5934 3249
jackalmage@5934 3250 <h3 id=main-alignment><span class=secno>9.5. </span> Main-Axis Alignment</h3>
jackalmage@5934 3251
jackalmage@5934 3252 <ol class=continue>
jackalmage@5934 3253 <li id=algo-main-align> <strong>Distribute any remaining free
jackalmage@5934 3254 space.</strong> For each flex line:
jackalmage@5934 3255 <ol>
jackalmage@5934 3256 <li> If the remaining free space is positive and at least one main-axis
fantasai@6356 3257 margin on this line is ‘<code class=css>auto</code>’, distribute
fantasai@6356 3258 the free space equally among these margins. Otherwise, set all ‘<code
fantasai@6356 3259 class=css>auto</code>’ margins to zero.
jackalmage@5934 3260
jackalmage@5934 3261 <li> Align the items along the main-axis per ‘<a
jackalmage@5934 3262 href="#justify-content"><code
jackalmage@5934 3263 class=property>justify-content</code></a>’.
jackalmage@5934 3264 </ol>
jackalmage@5934 3265 </ol>
jackalmage@5934 3266
jackalmage@5934 3267 <h3 id=cross-alignment><span class=secno>9.6. </span> Cross-Axis Alignment</h3>
jackalmage@5934 3268
jackalmage@5934 3269 <ol class=continue>
fantasai@6356 3270 <li id=algo-cross-margins> <strong>Resolve cross-axis ‘<code
fantasai@6356 3271 class=css>auto</code>’ margins.</strong> If a flex item has ‘<code
jackalmage@6588 3272 class=css>auto</code>’ cross-axis margins:
jackalmage@6588 3273 <ul>
jackalmage@6588 3274 <li> If its outer cross size (treating those ‘<code
jackalmage@6588 3275 class=css>auto</code>’ margins as zero) is less than the cross size
jackalmage@6588 3276 of its flex line, distribute the difference in those sizes equally to
jackalmage@6588 3277 the ‘<code class=css>auto</code>’ margins.
jackalmage@6588 3278
jackalmage@7082 3279 <li> Otherwise, if the <i>start</i> or <i>block-before</i> margin
jackalmage@7082 3280 (whichever is in the cross axis) is ‘<code class=css>auto</code>’,
jackalmage@7082 3281 set it to zero; set the opposite margin so that the outer cross size of
jackalmage@7082 3282 the item equals the cross size of its flex line.
jackalmage@6588 3283 </ul>
jackalmage@5934 3284
jackalmage@5934 3285 <li id=algo-cross-align> <strong>Align all flex items along the
jackalmage@5934 3286 cross-axis</strong> per ‘<a href="#align-self"><code
jackalmage@5934 3287 class=property>align-self</code></a>’, if neither of the item's
fantasai@6356 3288 cross-axis margins are ‘<code class=css>auto</code>’.
jackalmage@5934 3289
jackalmage@5934 3290 <li id=algo-cross-container> <strong>Determine the flex container's used
jackalmage@5934 3291 cross size:</strong>
jackalmage@5934 3292 <ul>
jackalmage@5934 3293 <li> If the cross size property is a <a
jackalmage@5934 3294 href="#definite-size"><i>definite</i></a> size, use that.
jackalmage@5934 3295
jackalmage@5934 3296 <li> Otherwise, use the sum of the flex lines' cross sizes.
jackalmage@5934 3297 </ul>
jackalmage@5934 3298
jackalmage@5934 3299 <li id=algo-line-align> <strong>Align all flex lines</strong> per ‘<a
jackalmage@5934 3300 href="#align-content"><code class=property>align-content</code></a>’.
jackalmage@5934 3301 </ol>
jackalmage@5934 3302
jackalmage@5934 3303 <h3 id=resolve-flexible-lengths><span class=secno>9.7. </span> Resolving
jackalmage@5934 3304 Flexible Lengths</h3>
jackalmage@5934 3305
jackalmage@5934 3306 <p> To resolve the flexible lengths of the items within a flex line:
jackalmage@5934 3307
jackalmage@5934 3308 <ol>
fantasai@6713 3309 <li> <strong>Determine the used flex factor.</strong> Sum the outer <a
fantasai@5943 3310 href="#hypothetical-main-size"><i>hypothetical main sizes</i></a> of all
fantasai@5945 3311 items on the line. If the sum is less than the flex container's inner
jackalmage@6613 3312 main size, use the <a href="#flex-grow-factor"><i>flex grow
jackalmage@6613 3313 factor</i></a> for the rest of this algorithm; otherwise, use the <a
jackalmage@6613 3314 href="#flex-shrink-factor"><i>flex shrink factor</i></a>.
jackalmage@5934 3315
jackalmage@6100 3316 <li> <strong>Size inflexible items.</strong> For any items that have a
fantasai@6713 3317 flex factor of zero, set their used main size to their <a
jackalmage@6100 3318 href="#hypothetical-main-size"><i>hypothetical main size</i></a>.
jackalmage@6100 3319
jackalmage@5934 3320 <li> <strong>Check that you can distribute any space.</strong> If all the
fantasai@6713 3321 flex items on the line are either frozen or have a flex factor of zero,
jackalmage@5934 3322 exit the algorithm.
jackalmage@5934 3323
fantasai@5943 3324 <li> <strong>Calculate free space.</strong> Sum the outer <a
fantasai@5943 3325 href="#flex-base-size"><i>flex base sizes</i></a> of all items on the
fantasai@5943 3326 line, and subtract this from the flex container's inner main size. This
fantasai@5943 3327 is the free space.
jackalmage@5934 3328
fantasai@5945 3329 <li> <strong>Distribute free space proportional to the flex
fantasai@6713 3330 factors.</strong> If the sign of the free space is positive and the
jackalmage@6613 3331 algorithm is using the <a href="#flex-grow-factor"><i>flex grow
jackalmage@6613 3332 factor</i></a>, or if the sign of the free space is negative and the
jackalmage@6613 3333 algorithm is using the <a href="#flex-shrink-factor"><i>flex shrink
jackalmage@6613 3334 factor</i></a>, distribute the free space to each flexible item's main
fantasai@6713 3335 size in proportion to the item's flex factor:
jackalmage@5934 3336 <dl>
fantasai@5945 3337 <dt>If the free space is positive
jackalmage@5934 3338
jackalmage@6613 3339 <dd> Find the ratio of the item's <a href="#flex-grow-factor"><i>flex
jackalmage@6613 3340 grow factor</i></a> to the sum of the <a
jackalmage@6613 3341 href="#flex-grow-factor"><i>flex grow factors</i></a> of all items on
jackalmage@6613 3342 the line. Set the item's main size to its <a
jackalmage@6613 3343 href="#flex-base-size"><i>flex base size</i></a> plus a fraction of the
jackalmage@6613 3344 free space proportional to the ratio.
jackalmage@5934 3345
fantasai@5945 3346 <dt>If the free space is negative
jackalmage@5934 3347
jackalmage@5935 3348 <dd> For every item on the line, multiply its <a
jackalmage@6613 3349 href="#flex-shrink-factor"><i>flex shrink factor</i></a> by its outer
jackalmage@6613 3350 <a href="#flex-base-size"><i>flex base size</i></a>, and note this as
fantasai@6713 3351 its <dfn id=scaled-flex-shrink-factor>scaled flex shrink factor</dfn>.
fantasai@6713 3352 Find the ratio of the item's <a
fantasai@6713 3353 href="#scaled-flex-shrink-factor"><i>scaled flex shrink factor</i></a>
fantasai@6713 3354 to the sum of the <a href="#scaled-flex-shrink-factor"><i>scaled flex
fantasai@6713 3355 shrink factors</i></a> of all items on the line. Set the item's main
fantasai@6713 3356 size to its <a href="#flex-base-size"><i>flex base size</i></a> minus a
jackalmage@6613 3357 fraction of the absolute value of the free space proportional to the
jackalmage@6613 3358 ratio. <span class=note>Note this may result in a negative inner main
jackalmage@6613 3359 size; it will be corrected in the next step.</span>
jackalmage@5934 3360 </dl>
jackalmage@5934 3361
jackalmage@5934 3362 <li> <strong>Fix min/max violations.</strong> Clamp each item's main size
jackalmage@5934 3363 by its min and max main size properties. If the item's main size was made
jackalmage@5934 3364 smaller by this, it's a max violation. If the item's main size was made
jackalmage@5934 3365 larger by this, it's a min violation.
jackalmage@5934 3366
jackalmage@5934 3367 <li> The total violation is the sum of the adjustments from the previous
jackalmage@5934 3368 step (<code><var>clamped size</var> - <var>unclamped size</var></code>).
jackalmage@5934 3369 If the total violation is:
jackalmage@5934 3370 <dl>
jackalmage@5934 3371 <dt>Zero
jackalmage@5934 3372
jackalmage@5934 3373 <dd> Exit the algorithm.
jackalmage@5934 3374
jackalmage@5934 3375 <dt>Positive
jackalmage@5934 3376
jackalmage@5934 3377 <dd> Freeze all the items with min violations, reset all other items to
jackalmage@5934 3378 their size upon entering this algorithm, and return to step 2 of this
jackalmage@5934 3379 algorithm.
jackalmage@5934 3380
jackalmage@5934 3381 <dt>Negative
jackalmage@5934 3382
jackalmage@5934 3383 <dd> Freeze all the items with max violations, reset all other items to
jackalmage@5934 3384 their size upon entering this algorithm, and return to step 2 of this
jackalmage@5934 3385 algorithm.
jackalmage@5934 3386 </dl>
jackalmage@5934 3387 </ol>
jackalmage@5934 3388
jackalmage@5934 3389 <h2 id=pagination><span class=secno>10. </span> Fragmenting Flex Layout</h2>
jackalmage@5934 3390
jackalmage@5934 3391 <p> Flex containers can break across pages between items, between lines of
fantasai@7228 3392 items (in <a href="#multi-line"><i>multi-line</i></a> mode), and inside
fantasai@7228 3393 items. The ‘<code class=css>break-*</code>’ properties apply to flex
fantasai@7228 3394 containers as normal for block-level or inline-level boxes. This section
fantasai@7228 3395 defines how they apply to flex items and elements inside flex items.
jackalmage@5934 3396
jackalmage@5934 3397 <p> The following breaking rules refer to the fragmentation container as
jackalmage@5934 3398 the “page”. The same rules apply to any other fragmenters. (Substitute
jackalmage@5934 3399 “page” with the appropriate fragmenter type as needed.) See the CSS3
jackalmage@5934 3400 Fragmentation Module <a href="#CSS3-BREAK"
jackalmage@6092 3401 rel=biblioentry>[CSS3-BREAK]<!--{{!CSS3-BREAK}}--></a>. For readability,
jackalmage@5934 3402 in this section the terms "row" and "column" refer to the relative
jackalmage@5934 3403 orientation of the flex container with respect to the block flow direction
fantasai@6137 3404 of the fragmentation context, rather than to that of the flex container
fantasai@6137 3405 itself.
jackalmage@5934 3406
jackalmage@5934 3407 <p> The exact layout of a fragmented flex container is not defined in this
jackalmage@5934 3408 level of Flexible Box Layout. However, breaks inside a flex container are
jackalmage@5934 3409 subject to the following rules:
jackalmage@5934 3410
jackalmage@5934 3411 <ul>
jackalmage@5934 3412 <li> In a row flex container, the ‘<code
jackalmage@5934 3413 class=property>break-before</code>’ and ‘<code
jackalmage@5934 3414 class=property>break-after</code>’ properties on flex items are
jackalmage@5934 3415 propagated to the flex line. The ‘<code
jackalmage@5934 3416 class=property>break-before</code>’ property on the first line and the
jackalmage@5934 3417 ‘<code class=property>break-after</code>’ property on the last line
jackalmage@5934 3418 are propagated to the flex container.
jackalmage@5934 3419
jackalmage@5934 3420 <li> In a column flex container, the ‘<code
jackalmage@5934 3421 class=property>break-before</code>’ property on the first item and the
jackalmage@5934 3422 ‘<code class=property>break-after</code>’ property on the last item
jackalmage@5934 3423 are propagated to the flex container. Forced breaks on other items are
jackalmage@5934 3424 applied to the item itself.
jackalmage@5934 3425
jackalmage@5934 3426 <li> A forced break inside a flex item effectively increases the size of
jackalmage@5934 3427 its contents; it does not trigger a forced break inside sibling items.
jackalmage@5934 3428
jackalmage@5934 3429 <li> In a row flex container, <a
jackalmage@5934 3430 href="http://www.w3.org/TR/css3-break/#btw-blocks">Class 1 break
jackalmage@5934 3431 opportunities</a> occur between sibling flex lines, and <a
jackalmage@5934 3432 href="http://www.w3.org/TR/css3-break/#end-block">Class 3 break
jackalmage@5934 3433 opportunities</a> occur between the first/last flex line and the flex
jackalmage@5934 3434 container's content edges. In a column flex container, <a
jackalmage@5934 3435 href="http://www.w3.org/TR/css3-break/#btw-blocks">Class 1 break
jackalmage@5934 3436 opportunities</a> occur between sibling flex items, and <a
jackalmage@5934 3437 href="http://www.w3.org/TR/css3-break/#end-block">Class 3 break
jackalmage@5934 3438 opportunities</a> occur between the first/last flex items on a line and
jackalmage@5934 3439 the flex container's content edges. <a href="#CSS3-BREAK"
jackalmage@6092 3440 rel=biblioentry>[CSS3-BREAK]<!--{{!CSS3-BREAK}}--></a>
jackalmage@5934 3441
jackalmage@5934 3442 <li> When a flex container is continued after a break, the space available
jackalmage@5934 3443 to its <a href="#flex-item"><i>flex items</i></a> (in the block flow
jackalmage@5934 3444 direction of the fragmentation context) is reduced by the space consumed
jackalmage@5934 3445 by flex container fragments on previous pages. The space consumed by a
jackalmage@5934 3446 flex container fragment is the size of its content box on that page. If
jackalmage@5934 3447 as a result of this adjustment the available space becomes negative, it
jackalmage@5934 3448 is set to zero.
jackalmage@5934 3449
jackalmage@5934 3450 <li> If the first fragment of the flex container is not at the top of the
jackalmage@5934 3451 page, and some of its flex items don't fit in the remaining space on the
jackalmage@5934 3452 page, the entire fragment is moved to the next page.
jackalmage@5934 3453
jackalmage@5934 3454 <li> When a <a href="#multi-line"><i>multi-line</i></a> colum flex
jackalmage@5934 3455 container breaks, each fragment has its own "stack" of flex lines, just
jackalmage@5934 3456 like each fragment of a multi-column element has its own row of column
jackalmage@5934 3457 boxes.
jackalmage@5934 3458
jackalmage@5934 3459 <li> Aside from the rearrangement of items imposed by the previous point,
jackalmage@5934 3460 UAs should attempt to minimize distortation of the flex container with
jackalmage@5934 3461 respect to unfragmented flow.
jackalmage@5934 3462 </ul>
jackalmage@5934 3463
jackalmage@5934 3464 <h3 id=pagination-algo><span class=secno>10.1. </span> Sample Flex
jackalmage@5934 3465 Fragmentation Algorithm</h3>
jackalmage@5934 3466
jackalmage@5934 3467 <p> This informative section presents a possible fragmentation algorithm
jackalmage@6194 3468 for flex containers. Implementors are encouraged to improve on this
jackalmage@6194 3469 algorithm and <a href="#status">provide feedback to the CSS Working
jackalmage@6194 3470 Group</a>.
jackalmage@5934 3471
jackalmage@5934 3472 <div class=example>
jackalmage@5934 3473 <p class=note> This algorithm assumes that pagination always proceeds only
jackalmage@5934 3474 in the forward direction; therefore, in the algorithms below, alignment
jackalmage@5934 3475 is mostly ignored prior to pagination. Advanced layout engines may be
jackalmage@5934 3476 able to honor alignment across fragments.
jackalmage@5934 3477
jackalmage@5934 3478 <dl>
fantasai@7228 3479 <dt><a href="#single-line"><i>Single-line</i></a> column flex container
jackalmage@5934 3480
jackalmage@5934 3481 <dd>
jackalmage@5934 3482 <ol>
jackalmage@5934 3483 <li> Run the flex layout algorithm (without regards to pagination)
jackalmage@5934 3484 through <a href="#cross-sizing">Cross Sizing Determination</a>.
jackalmage@5934 3485
jackalmage@5934 3486 <li> Lay out as many consecutive flex items or item fragments as
jackalmage@5934 3487 possible (but at least one or a fragment thereof), starting from the
jackalmage@5934 3488 first, until there is no more room on the page or a forced break is
jackalmage@5934 3489 encountered.
jackalmage@5934 3490
jackalmage@5934 3491 <li> If the previous step ran out of room and the free space is
jackalmage@5934 3492 positive, the UA may reduce the distributed free space on this page
jackalmage@5934 3493 (down to, but not past, zero) in order to make room for the next
jackalmage@5934 3494 unbreakable flex item or fragment. Otherwise, the item or fragment
jackalmage@5934 3495 that does not fit is pushed to the next page. The UA should pull up if
jackalmage@5934 3496 more than 50% of the fragment would have fit in the remaining space
jackalmage@5934 3497 and should push otherwise.
jackalmage@5934 3498
jackalmage@5934 3499 <li> If there are any flex items or fragments not laid out by the
jackalmage@5934 3500 previous steps, rerun the flex layout algorithm from <a
jackalmage@5934 3501 href="#line-sizing">Line Length Determination</a> through <a
jackalmage@5934 3502 href="#cross-sizing">Cross Sizing Determination</a> with the next
jackalmage@5934 3503 page's size and <em>all</em> the contents (including those already
jackalmage@5934 3504 laid out), and return to the previous step, but starting from the
jackalmage@5934 3505 first item or fragment not already laid out.
jackalmage@5934 3506
jackalmage@5934 3507 <li> For each fragment of the flex container, continue the flex layout
jackalmage@5934 3508 algorithm from <a href="#main-alignment">Main-Axis Alignment</a> to
jackalmage@5934 3509 its finish.
jackalmage@5934 3510 </ol>
jackalmage@5934 3511
jackalmage@5934 3512 <p class=note> It is the intent of this algorithm that column-direction
fantasai@7228 3513 <a href="#single-line"><i>single-line</i></a> flex containers paginate
fantasai@7228 3514 very similarly to block flow. As a test of the intent, a flex container
fantasai@7228 3515 with ‘<code class=css>justify-content:start</code>’ and no flexible
fantasai@7228 3516 items should paginate identically to a block with in-flow children with
fantasai@7228 3517 same content, same used size and same used margins.
fantasai@7228 3518
fantasai@7228 3519 <dt><a href="#multi-line"><i>Multi-line</i></a> column flex container
jackalmage@5934 3520
jackalmage@5934 3521 <dd>
jackalmage@5934 3522 <ol>
jackalmage@5934 3523 <li> Run the flex layout algorithm <em>with</em> regards to pagination
jackalmage@5934 3524 (limiting the flex container's maximum line length to the space left
jackalmage@5934 3525 on the page) through <a href="#cross-sizing">Cross Sizing
jackalmage@5934 3526 Determination</a>.
jackalmage@5934 3527
jackalmage@5934 3528 <li> Lay out as many flex lines as possible (but at least one) until
jackalmage@5934 3529 there is no more room in the flex container in the cross dimension or
jackalmage@5934 3530 a forced break is encountered:
jackalmage@5934 3531 <ol>
jackalmage@5934 3532 <li> Lay out as many consecutive flex items as possible (but at least
jackalmage@5934 3533 one), starting from the first, until there is no more room on the
jackalmage@5934 3534 page or a forced break is encountered. Forced breaks <em>within</em>
jackalmage@5934 3535 flex items are ignored.
jackalmage@5934 3536
jackalmage@5934 3537 <li> If this is the first flex container fragment, this line contains
jackalmage@5934 3538 only a single flex item that is larger than the space left on the
jackalmage@5934 3539 page, and the flex container is not at the top of the page already,
jackalmage@5934 3540 move the flex container to the next page and restart flex container
jackalmage@5934 3541 layout entirely.
jackalmage@5934 3542
jackalmage@5934 3543 <li> If there are any flex items not laid out by the first step,
jackalmage@5934 3544 rerun the flex layout algorithm from <a href="#main-sizing">Main
jackalmage@5934 3545 Sizing Determination</a> through <a href="#cross-sizing">Cross
jackalmage@5934 3546 Sizing Determination</a> using only the items not laid out on a
jackalmage@5934 3547 previous line, and return to the previous step, starting from the
jackalmage@5934 3548 first item not already laid out.
jackalmage@5934 3549 </ol>
jackalmage@5934 3550
jackalmage@5934 3551 <li> If there are any flex items not laid out by the previous step,
jackalmage@5934 3552 rerun the flex layout algorithm from <a href="#line-sizing">Line
jackalmage@5934 3553 Sizing Determination</a> through <a href="#cross-sizing">Cross Sizing
jackalmage@5934 3554 Determination</a> with the next page's size and only the items not
jackalmage@5934 3555 already laid out, and return to the previous step, but starting from
jackalmage@5934 3556 the first item not already laid out.
jackalmage@5934 3557
jackalmage@5934 3558 <li> For each fragment of the flex container, continue the flex layout
jackalmage@5934 3559 algorithm from <a href="#main-alignment">Main-Axis Alignment</a> to
jackalmage@5934 3560 its finish.
jackalmage@5934 3561 </ol>
jackalmage@5934 3562
jackalmage@5934 3563 <p class=note> If a flex item does not entirely fit on a single page, it
fantasai@7228 3564 will <em>not</em> be paginated in <a
fantasai@7228 3565 href="#multi-line"><i>multi-line</i></a> column flex containers.
fantasai@7228 3566
fantasai@7228 3567 <dt><a href="#single-line"><i>Single-line</i></a> row flex container
jackalmage@5934 3568
jackalmage@5934 3569 <dd>
jackalmage@5934 3570 <ol>
jackalmage@5934 3571 <li> Run the entire flex layout algorithm (without regards to
jackalmage@5934 3572 pagination), except treat any ‘<a href="#align-self"><code
jackalmage@5934 3573 class=property>align-self</code></a>’ other than ‘<code
fantasai@6356 3574 class=css>start</code>’ or ‘<a href="#align-baseline"><code
jackalmage@5934 3575 class=css>baseline</code></a>’ as ‘<code
jackalmage@5934 3576 class=css>start</code>’.
jackalmage@5934 3577
jackalmage@5934 3578 <li> If an unbreakable item doesn't fit within the space left on the
jackalmage@5934 3579 page, and the flex container is not at the top of the page, move the
jackalmage@5934 3580 flex container to the next page and restart flex container layout
jackalmage@5934 3581 entirely.
jackalmage@5934 3582
jackalmage@5934 3583 <li> For each item, lay out as much of its contents as will fit in the
jackalmage@5934 3584 space left on the page, and fragment the remaining content onto the
jackalmage@5934 3585 next page, rerunning the flex layout algorithm from <a
jackalmage@5934 3586 href="#line-sizing">Line Length Determination</a> through <a
jackalmage@5934 3587 href="#main-alignment">Main-Axis Alignment</a> into the new page size
jackalmage@5934 3588 using <em>all</em> the contents (including items completed on previous
jackalmage@5934 3589 pages).
jackalmage@5934 3590 <p class=note> Any flex items that fit entirely into previous
jackalmage@5934 3591 fragments still take up space in the main axis in later fragments.
jackalmage@5934 3592
jackalmage@5934 3593 <li> For each fragment of the flex container, rerun the flex layout
jackalmage@5934 3594 algorithm from <a href="#cross-alignment">Cross-Axis Alignment</a> to
jackalmage@5934 3595 its finish. For all fragments besides the first, treat ‘<a
jackalmage@5934 3596 href="#align-self"><code class=property>align-self</code></a>’ and
jackalmage@5934 3597 ‘<a href="#align-content"><code
jackalmage@5934 3598 class=property>align-content</code></a>’ as being ‘<code
jackalmage@5934 3599 class=css>start</code>’ for all item fragments and lines.
jackalmage@5934 3600
jackalmage@5934 3601 <li> If any item, when aligned according to its original ‘<a
jackalmage@5934 3602 href="#align-self"><code class=property>align-self</code></a>’ value
jackalmage@5934 3603 into the combined cross size of all the flex container fragments,
jackalmage@5934 3604 would fit entirely within a single flex container fragment, it may be
jackalmage@5934 3605 shifted into that fragment and aligned appropriately.
jackalmage@5934 3606 </ol>
jackalmage@5934 3607
fantasai@7228 3608 <dt><a href="#multi-line"><i>Multi-line</i></a> row flex container
jackalmage@5934 3609
jackalmage@5934 3610 <dd>
jackalmage@5934 3611 <ol>
jackalmage@5934 3612 <li> Run the flex layout algorithm (without regards to pagination),
jackalmage@5934 3613 through <a href="#cross-sizing">Cross Sizing Determination</a>.
jackalmage@5934 3614
jackalmage@5934 3615 <li> Lay out as many flex lines as possible (but at least one),
jackalmage@5934 3616 starting from the first, until there is no more room on the page or a
jackalmage@5934 3617 forced break is encountered.
jackalmage@5934 3618 <p> If a line doesn't fit on the page, and the line is not at the top
jackalmage@5934 3619 of the page, move the line to the next page and restart the flex
jackalmage@5934 3620 layout algorithm entirely, using only the items in and following this
jackalmage@5934 3621 line.
jackalmage@5934 3622
jackalmage@5934 3623 <p> If a flex item itself causes a forced break, rerun the flex layout
jackalmage@5934 3624 algorithm from <a href="#main-sizing">Main Sizing Determination</a>
jackalmage@5934 3625 through <a href="#main-alignment">Main-Axis Alignment</a>, using only
jackalmage@5934 3626 the items on this and following lines, but with the item causing the
jackalmage@5934 3627 break automatically starting a new line in the <a
fantasai@5957 3628 href="#algo-line-break">line breaking step</a>, then continue with
fantasai@5957 3629 this step. Forced breaks <em>within</em> flex items are ignored.
jackalmage@5934 3630
jackalmage@5934 3631 <li> If there are any flex items not laid out by the previous step,
jackalmage@5934 3632 rerun the flex layout algorithm from <a href="#line-sizing">Line
jackalmage@5934 3633 Length Determination</a> through <a href="#main-alignment">Main-Axis
jackalmage@5934 3634 Alignment</a> with the next page's size and only the items not already
jackalmage@5934 3635 laid out. Return to the previous step, but starting from the first
jackalmage@5934 3636 line not already laid out.
jackalmage@5934 3637
jackalmage@5934 3638 <li> For each fragment of the flex container, continue the flex layout
jackalmage@5934 3639 algorithm from <a href="#cross-alignment">Cross Axis Alignment</a> to
jackalmage@5934 3640 its finish.
jackalmage@5934 3641 </ol>
jackalmage@5934 3642 </dl>
jackalmage@5934 3643 </div>
jackalmage@5934 3644
jackalmage@5934 3645 <h2 id=conformance><span class=secno>11. </span> Conformance</h2>
jackalmage@5934 3646
jackalmage@5934 3647 <h3 id=conventions><span class=secno>11.1. </span> Document conventions</h3>
jackalmage@5934 3648
jackalmage@5934 3649 <p>Conformance requirements are expressed with a combination of descriptive
jackalmage@5934 3650 assertions and RFC 2119 terminology. The key words “MUST”, “MUST
jackalmage@5934 3651 NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”,
jackalmage@5934 3652 “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the
jackalmage@5934 3653 normative parts of this document are to be interpreted as described in RFC
jackalmage@5934 3654 2119. However, for readability, these words do not appear in all uppercase
jackalmage@5934 3655 letters in this specification.
jackalmage@5934 3656
jackalmage@5934 3657 <p>All of the text of this specification is normative except sections
jackalmage@5934 3658 explicitly marked as non-normative, examples, and notes. <a
jackalmage@6092 3659 href="#RFC2119" rel=biblioentry>[RFC2119]<!--{{!RFC2119}}--></a>
jackalmage@5934 3660
jackalmage@5934 3661 <p>Examples in this specification are introduced with the words “for
jackalmage@5934 3662 example” or are set apart from the normative text with
jackalmage@5934 3663 <code>class="example"</code>, like this:
jackalmage@5934 3664
jackalmage@5934 3665 <div class=example>
jackalmage@5934 3666 <p>This is an example of an informative example.
jackalmage@5934 3667 </div>
jackalmage@5934 3668
jackalmage@5934 3669 <p>Informative notes begin with the word “Note” and are set apart from
jackalmage@5934 3670 the normative text with <code>class="note"</code>, like this:
jackalmage@5934 3671
jackalmage@5934 3672 <p class=note>Note, this is an informative note.
jackalmage@5934 3673
jackalmage@5934 3674 <h3 id=conformance-classes><span class=secno>11.2. </span> Conformance
jackalmage@5934 3675 classes</h3>
jackalmage@5934 3676
jackalmage@5934 3677 <p>Conformance to CSS Flexible Box Layout Module is defined for three
jackalmage@5934 3678 conformance classes:
jackalmage@5934 3679
jackalmage@5934 3680 <dl>
jackalmage@5934 3681 <dt><dfn id=style-sheet title="style sheet!!as conformance class">style
jackalmage@5934 3682 sheet</dfn>
jackalmage@5934 3683
jackalmage@5934 3684 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
jackalmage@5934 3685 style sheet</a>.
jackalmage@5934 3686
jackalmage@5934 3687 <dt><dfn id=renderer>renderer</dfn>
jackalmage@5934 3688
jackalmage@5934 3689 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
jackalmage@5934 3690 that interprets the semantics of a style sheet and renders documents that
jackalmage@5934 3691 use them.
jackalmage@5934 3692
jackalmage@5934 3693 <dt><dfn id=authoring-tool>authoring tool</dfn>
jackalmage@5934 3694
jackalmage@5934 3695 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
jackalmage@5934 3696 that writes a style sheet.
jackalmage@5934 3697 </dl>
jackalmage@5934 3698
jackalmage@5934 3699 <p>A style sheet is conformant to CSS Flexible Box Layout Module if all of
jackalmage@5934 3700 its statements that use syntax defined in this module are valid according
jackalmage@5934 3701 to the generic CSS grammar and the individual grammars of each feature
jackalmage@5934 3702 defined in this module.
jackalmage@5934 3703
jackalmage@5934 3704 <p>A renderer is conformant to CSS Flexible Box Layout Module if, in
jackalmage@5934 3705 addition to interpreting the style sheet as defined by the appropriate
jackalmage@5934 3706 specifications, it supports all the features defined by CSS Flexible Box
jackalmage@5934 3707 Layout Module by parsing them correctly and rendering the document
jackalmage@5934 3708 accordingly. However, the inability of a UA to correctly render a document
jackalmage@5934 3709 due to limitations of the device does not make the UA non-conformant. (For
jackalmage@5934 3710 example, a UA is not required to render color on a monochrome monitor.)
jackalmage@5934 3711
jackalmage@5934 3712 <p>An authoring tool is conformant to CSS Flexible Box Layout Module if it
jackalmage@5934 3713 writes style sheets that are syntactically correct according to the
jackalmage@5934 3714 generic CSS grammar and the individual grammars of each feature in this
jackalmage@5934 3715 module, and meet all other conformance requirements of style sheets as
jackalmage@5934 3716 described in this module.
jackalmage@5934 3717
jackalmage@5934 3718 <h3 id=partial><span class=secno>11.3. </span> Partial implementations</h3>
jackalmage@5934 3719
jackalmage@5934 3720 <p>So that authors can exploit the forward-compatible parsing rules to
jackalmage@5934 3721 assign fallback values, CSS renderers <strong>must</strong> treat as
jackalmage@5934 3722 invalid (and <a
jackalmage@5934 3723 href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore as
jackalmage@5934 3724 appropriate</a>) any at-rules, properties, property values, keywords, and
jackalmage@5934 3725 other syntactic constructs for which they have no usable level of support.
jackalmage@5934 3726 In particular, user agents <strong>must not</strong> selectively ignore
jackalmage@5934 3727 unsupported component values and honor supported values in a single
jackalmage@5934 3728 multi-value property declaration: if any value is considered invalid (as
jackalmage@5934 3729 unsupported values must be), CSS requires that the entire declaration be
jackalmage@5934 3730 ignored.
jackalmage@5934 3731
jackalmage@5934 3732 <h3 id=experimental><span class=secno>11.4. </span> Experimental
jackalmage@5934 3733 implementations</h3>
jackalmage@5934 3734
jackalmage@5934 3735 <p>To avoid clashes with future CSS features, the CSS2.1 specification
jackalmage@5934 3736 reserves a <a
jackalmage@5934 3737 href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed
jackalmage@5934 3738 syntax</a> for proprietary and experimental extensions to CSS.
jackalmage@5934 3739
jackalmage@5934 3740 <p>Prior to a specification reaching the Candidate Recommendation stage in
jackalmage@5934 3741 the W3C process, all implementations of a CSS feature are considered
jackalmage@5934 3742 experimental. The CSS Working Group recommends that implementations use a
jackalmage@5934 3743 vendor-prefixed syntax for such features, including those in W3C Working
jackalmage@5934 3744 Drafts. This avoids incompatibilities with future changes in the draft.
jackalmage@5934 3745
jackalmage@5934 3746 <h3 id=testing><span class=secno>11.5. </span> Non-experimental
jackalmage@5934 3747 implementations</h3>
jackalmage@5934 3748
jackalmage@5934 3749 <p>Once a specification reaches the Candidate Recommendation stage,
jackalmage@5934 3750 non-experimental implementations are possible, and implementers should
jackalmage@5934 3751 release an unprefixed implementation of any CR-level feature they can
jackalmage@5934 3752 demonstrate to be correctly implemented according to spec.
jackalmage@5934 3753
jackalmage@5934 3754 <p>To establish and maintain the interoperability of CSS across
jackalmage@5934 3755 implementations, the CSS Working Group requests that non-experimental CSS
jackalmage@5934 3756 renderers submit an implementation report (and, if necessary, the
jackalmage@5934 3757 testcases used for that implementation report) to the W3C before releasing
jackalmage@5934 3758 an unprefixed implementation of any CSS features. Testcases submitted to
jackalmage@5934 3759 W3C are subject to review and correction by the CSS Working Group.
jackalmage@5934 3760
jackalmage@5934 3761 <p>Further information on submitting testcases and implementation reports
jackalmage@5934 3762 can be found from on the CSS Working Group's website at <a
jackalmage@5934 3763 href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
jackalmage@5934 3764 Questions should be directed to the <a
jackalmage@5934 3765 href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a>
jackalmage@5934 3766 mailing list.
jackalmage@5934 3767
jackalmage@5934 3768 <h3 id=cr-exit-criteria><span class=secno>11.6. </span> CR exit criteria</h3>
jackalmage@5934 3769
jackalmage@5934 3770 <p> For this specification to be advanced to Proposed Recommendation, there
jackalmage@5934 3771 must be at least two independent, interoperable implementations of each
jackalmage@5934 3772 feature. Each feature may be implemented by a different set of products,
jackalmage@5934 3773 there is no requirement that all features be implemented by a single
jackalmage@5934 3774 product. For the purposes of this criterion, we define the following
jackalmage@5934 3775 terms:
jackalmage@5934 3776
jackalmage@5934 3777 <dl>
jackalmage@5934 3778 <dt>independent
jackalmage@5934 3779
jackalmage@5934 3780 <dd>each implementation must be developed by a different party and cannot
jackalmage@5934 3781 share, reuse, or derive from code used by another qualifying
jackalmage@5934 3782 implementation. Sections of code that have no bearing on the
jackalmage@5934 3783 implementation of this specification are exempt from this requirement.
jackalmage@5934 3784
jackalmage@5934 3785 <dt>interoperable
jackalmage@5934 3786
jackalmage@5934 3787 <dd>passing the respective test case(s) in the official CSS test suite,
jackalmage@5934 3788 or, if the implementation is not a Web browser, an equivalent test. Every
jackalmage@5934 3789 relevant test in the test suite should have an equivalent test created if
jackalmage@5934 3790 such a user agent (UA) is to be used to claim interoperability. In
jackalmage@5934 3791 addition if such a UA is to be used to claim interoperability, then there
jackalmage@5934 3792 must one or more additional UAs which can also pass those equivalent
jackalmage@5934 3793 tests in the same way for the purpose of interoperability. The equivalent
jackalmage@5934 3794 tests must be made publicly available for the purposes of peer review.
jackalmage@5934 3795
jackalmage@5934 3796 <dt>implementation
jackalmage@5934 3797
jackalmage@5934 3798 <dd>a user agent which:
jackalmage@5934 3799 <ol class=inline>
jackalmage@5934 3800 <li>implements the specification.
jackalmage@5934 3801
jackalmage@5934 3802 <li>is available to the general public. The implementation may be a
jackalmage@5934 3803 shipping product or other publicly available version (i.e., beta
jackalmage@5934 3804 version, preview release, or “nightly build”). Non-shipping product
jackalmage@5934 3805 releases must have implemented the feature(s) for a period of at least
jackalmage@5934 3806 one month in order to demonstrate stability.
jackalmage@5934 3807
jackalmage@5934 3808 <li>is not experimental (i.e., a version specifically designed to pass
jackalmage@5934 3809 the test suite and is not intended for normal usage going forward).
jackalmage@5934 3810 </ol>
jackalmage@5934 3811 </dl>
jackalmage@5934 3812
jackalmage@5934 3813 <p>The specification will remain Candidate Recommendation for at least six
jackalmage@5934 3814 months.
jackalmage@5934 3815
jackalmage@5934 3816 <hr title="Separator from footer">
jackalmage@5934 3817
jackalmage@5934 3818 <h2 class=no-num id=acknowledgments>Acknowledgments</h2>
jackalmage@5934 3819
fantasai@6340 3820 <p>Thanks for feedback and contributions to Erik Anderson, Tony Chang, Phil
fantasai@6340 3821 Cupp, Arron Eicholz, James Elmore, Andrew Fedoniouk, Brian Heuston,
fantasai@6340 3822 Shinichiro Hamaji, Daniel Holbert, Ben Horst, John Jansen, Brad Kemper,
fantasai@6340 3823 Kang-hao Lu, Markus Mielke, Robert O'Callahan, Christoph Päper, Ning
fantasai@6340 3824 Rogers, Peter Salas, Morten Stenshorne, Christian Stockwell, Ojan Vafai,
fantasai@6340 3825 Eugene Veselov, Boris Zbarsky.
jackalmage@5934 3826
jackalmage@5934 3827 <h2 class=no-num id=references>References</h2>
jackalmage@5934 3828
jackalmage@5934 3829 <h3 class=no-num id=normative>Normative references</h3>
jackalmage@5934 3830 <!--begin-normative-->
jackalmage@5934 3831 <!-- Sorted by label -->
jackalmage@5934 3832
jackalmage@5934 3833 <dl class=bibliography>
jackalmage@5934 3834 <dt style="display: none"><!-- keeps the doc valid if the DL is empty -->
jackalmage@5934 3835 <!---->
jackalmage@5934 3836
jackalmage@5934 3837 <dt id=CSS21>[CSS21]
jackalmage@5934 3838
jackalmage@5934 3839 <dd>Bert Bos; et al. <a
jackalmage@7178 3840 href="http://www.w3.org/TR/2011/REC-CSS2-20110607/"><cite>Cascading Style
jackalmage@5934 3841 Sheets Level 2 Revision 1 (CSS 2.1) Specification.</cite></a> 7 June
jackalmage@5934 3842 2011. W3C Recommendation. URL: <a
jackalmage@7178 3843 href="http://www.w3.org/TR/2011/REC-CSS2-20110607/">http://www.w3.org/TR/2011/REC-CSS2-20110607/</a>
jackalmage@6613 3844 </dd>
jackalmage@5934 3845 <!---->
jackalmage@5934 3846
jackalmage@5934 3847 <dt id=CSS3-BREAK>[CSS3-BREAK]
jackalmage@5934 3848
jackalmage@5934 3849 <dd>Rossen Atanassov; Elika J. Etemad. <a
jackalmage@6585 3850 href="http://www.w3.org/TR/2012/WD-css3-break-20120823/"><cite>CSS
jackalmage@6585 3851 Fragmentation Module Level 3.</cite></a> 23 August 2012. W3C Working
jackalmage@5934 3852 Draft. (Work in progress.) URL: <a
jackalmage@6585 3853 href="http://www.w3.org/TR/2012/WD-css3-break-20120823/">http://www.w3.org/TR/2012/WD-css3-break-20120823/</a>
jackalmage@6613 3854 </dd>
jackalmage@5934 3855 <!---->
jackalmage@5934 3856
jackalmage@5934 3857 <dt id=CSS3-WRITING-MODES>[CSS3-WRITING-MODES]
jackalmage@5934 3858
jackalmage@5934 3859 <dd>Elika J. Etemad; Koji Ishii. <a
jackalmage@7082 3860 href="http://www.w3.org/TR/2012/WD-css3-writing-modes-20121115/"><cite>CSS
jackalmage@7082 3861 Writing Modes Module Level 3.</cite></a> 15 November 2012. W3C Working
jackalmage@7082 3862 Draft. (Work in progress.) URL: <a
jackalmage@7082 3863 href="http://www.w3.org/TR/2012/WD-css3-writing-modes-20121115/">http://www.w3.org/TR/2012/WD-css3-writing-modes-20121115/</a>
jackalmage@6613 3864 </dd>
jackalmage@5934 3865 <!---->
jackalmage@5934 3866
jackalmage@5934 3867 <dt id=RFC2119>[RFC2119]
jackalmage@5934 3868
jackalmage@5934 3869 <dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key
jackalmage@5934 3870 words for use in RFCs to Indicate Requirement Levels.</cite></a> Internet
jackalmage@5934 3871 RFC 2119. URL: <a
jackalmage@5934 3872 href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
jackalmage@6613 3873 </dd>
jackalmage@5934 3874 <!---->
jackalmage@5934 3875 </dl>
jackalmage@5934 3876 <!--end-normative-->
jackalmage@5934 3877
jackalmage@5934 3878 <h3 class=no-num id=informative>Other references</h3>
jackalmage@5934 3879 <!--begin-informative-->
jackalmage@5934 3880 <!-- Sorted by label -->
jackalmage@5934 3881
jackalmage@5934 3882 <dl class=bibliography>
jackalmage@5934 3883 <dt style="display: none"><!-- keeps the doc valid if the DL is empty -->
jackalmage@5934 3884 <!---->
jackalmage@5934 3885
jackalmage@5934 3886 <dt id=CSS3UI>[CSS3UI]
jackalmage@5934 3887
jackalmage@5934 3888 <dd>Tantek Çelik. <a
jackalmage@5934 3889 href="http://www.w3.org/TR/2012/WD-css3-ui-20120117/"><cite>CSS Basic
jackalmage@5934 3890 User Interface Module Level 3 (CSS3 UI).</cite></a> 17 January 2012. W3C
jackalmage@5934 3891 Working Draft. (Work in progress.) URL: <a
jackalmage@5934 3892 href="http://www.w3.org/TR/2012/WD-css3-ui-20120117/">http://www.w3.org/TR/2012/WD-css3-ui-20120117/</a>
jackalmage@6613 3893 </dd>
jackalmage@5934 3894 <!---->
fantasai@6126 3895
fantasai@6126 3896 <dt id=CSS3VAL>[CSS3VAL]
fantasai@6126 3897
fantasai@6126 3898 <dd>Håkon Wium Lie; Tab Atkins; Elika J. Etemad. <a
fantasai@6709 3899 href="http://www.w3.org/TR/2012/CR-css3-values-20120828/"><cite>CSS
fantasai@6709 3900 Values and Units Module Level 3.</cite></a> 28 August 2012. W3C Candidate
fantasai@6709 3901 Recommendation. (Work in progress.) URL: <a
fantasai@6709 3902 href="http://www.w3.org/TR/2012/CR-css3-values-20120828/">http://www.w3.org/TR/2012/CR-css3-values-20120828/</a>
jackalmage@6613 3903 </dd>
fantasai@6126 3904 <!---->
fantasai@6290 3905
fantasai@6290 3906 <dt id=HTML40>[HTML40]
fantasai@6290 3907
fantasai@6290 3908 <dd>Ian Jacobs; David Raggett; Arnaud Le Hors. <a
fantasai@6290 3909 href="http://www.w3.org/TR/1998/REC-html40-19980424"><cite>HTML 4.0
fantasai@6290 3910 Specification.</cite></a> 24 April 1998. W3C Recommendation. URL: <a
fantasai@6290 3911 href="http://www.w3.org/TR/1998/REC-html40-19980424">http://www.w3.org/TR/1998/REC-html40-19980424</a>
jackalmage@6613 3912 </dd>
fantasai@6290 3913 <!---->
jackalmage@5934 3914 </dl>
jackalmage@5934 3915 <!--end-informative-->
jackalmage@5934 3916
fantasai@5958 3917 <h2 class=no-num id=changes>Changes</h2>
fantasai@5958 3918
fantasai@6250 3919 <p> The following significant changes were made since the <a
jackalmage@6823 3920 href="http://www.w3.org/TR/2012/CR-css3-flexbox-20120921/">21 September
jackalmage@6823 3921 2012 Candidate Recommendation</a>:
fantasai@5958 3922
fantasai@5958 3923 <ul>
jackalmage@7088 3924 <li> Absolutely positioned children of a flex container are no longer
jackalmage@6823 3925 called "flex items" (to avoid terminology confusion).
jackalmage@6925 3926
jackalmage@6925 3927 <li> Clarified that ‘<code class=property>float</code>’ still makes
jackalmage@6925 3928 the children of a flex container turn into block-level elements.
jackalmage@7088 3929
jackalmage@7330 3930 <li> Clarified that ‘<code class=property>overflow</code>’ applies to
jackalmage@7330 3931 flex containers.
jackalmage@7330 3932
jackalmage@7330 3933 <li> Clarified that ‘<code class=css>::first-line</code>’ and ‘<code
jackalmage@7330 3934 class=css>::first-letter</code>’ pseudo-elements do not apply to flex
jackalmage@7330 3935 containers (because they are not block containers).
jackalmage@7330 3936
jackalmage@7088 3937 <li> <a href="#algo-main-item">Allow intrinsic aspect ratios to inform the
jackalmage@7088 3938 main-size calculation.</a>
jackalmage@7089 3939
fantasai@7228 3940 <li> Correct an omission in the flex-line size determination, so a <a
fantasai@7228 3941 href="#single-line"><i>single-line</i></a> flexbox will size to its
fantasai@7228 3942 contents if it doesn't have a definite size.
jackalmage@7090 3943
jackalmage@7090 3944 <li> Clarify that ‘<a href="#align-content-stretch"><code
fantasai@7093 3945 class=css>stretch</code></a>’ checks for the <em>computed</em> value of
fantasai@7093 3946 the cross-size property being ‘<code class=css>auto</code>’, which
fantasai@7093 3947 means that percentage cross-sizes that behave as ‘<code
fantasai@7091 3948 class=css>auto</code>’ (because they don't resolve against definite
fantasai@7091 3949 sizes) aren't stretched.
fantasai@5958 3950 </ul>
fantasai@5958 3951
fantasai@6250 3952 <p>A <a
fantasai@6250 3953 href="http://dev.w3.org/csswg/css3-flexbox/issues-lc-2012">Disposition of
fantasai@6250 3954 Last Call Comments</a> is available.
fantasai@6250 3955
jackalmage@5934 3956 <h2 class=no-num id=property>Property index</h2>
jackalmage@5934 3957 <!--begin-properties-->
jackalmage@5934 3958
jackalmage@5934 3959 <table class=proptable>
jackalmage@5934 3960 <thead>
jackalmage@5934 3961 <tr>
jackalmage@5934 3962 <th>Property
jackalmage@5934 3963
jackalmage@5934 3964 <th>Values
jackalmage@5934 3965
jackalmage@5934 3966 <th>Initial
jackalmage@5934 3967
jackalmage@5934 3968 <th>Applies to
jackalmage@5934 3969
jackalmage@5934 3970 <th>Inh.
jackalmage@5934 3971
jackalmage@5934 3972 <th>Percentages
jackalmage@5934 3973
jackalmage@5934 3974 <th>Media
jackalmage@5934 3975
jackalmage@5934 3976 <tbody>
jackalmage@5934 3977 <tr>
jackalmage@5934 3978 <th><a class=property href="#align-content">align-content</a>
jackalmage@5934 3979
jackalmage@5934 3980 <td>flex-start | flex-end | center | space-between | space-around |
jackalmage@5934 3981 stretch
jackalmage@5934 3982
jackalmage@5934 3983 <td>stretch
jackalmage@5934 3984
jackalmage@5934 3985 <td>multi-line flex containers
jackalmage@5934 3986
jackalmage@5934 3987 <td>no
jackalmage@5934 3988
fantasai@6391 3989 <td>
jackalmage@5934 3990
jackalmage@5934 3991 <td>visual
jackalmage@5934 3992
jackalmage@5934 3993 <tr>
jackalmage@5934 3994 <th><a class=property href="#align-items">align-items</a>
jackalmage@5934 3995
jackalmage@5934 3996 <td>flex-start | flex-end | center | baseline | stretch
jackalmage@5934 3997
jackalmage@5934 3998 <td>stretch
jackalmage@5934 3999
jackalmage@5934 4000 <td>flex containers
jackalmage@5934 4001
jackalmage@5934 4002 <td>no
jackalmage@5934 4003
fantasai@6391 4004 <td>
jackalmage@5934 4005
jackalmage@5934 4006 <td>visual
jackalmage@5934 4007
jackalmage@5934 4008 <tr>
jackalmage@5934 4009 <th><a class=property href="#align-self">align-self</a>
jackalmage@5934 4010
jackalmage@5934 4011 <td>auto | flex-start | flex-end | center | baseline | stretch
jackalmage@5934 4012
jackalmage@5934 4013 <td>auto
jackalmage@5934 4014
jackalmage@5934 4015 <td>flex items
jackalmage@5934 4016
jackalmage@5934 4017 <td>no
jackalmage@5934 4018
fantasai@6391 4019 <td>
jackalmage@5934 4020
jackalmage@5934 4021 <td>visual
jackalmage@5934 4022
jackalmage@5934 4023 <tr>
jackalmage@7082 4024 <th><a class=property href="#flex">flex</a>
jackalmage@7082 4025
jackalmage@7082 4026 <td>none | [ &lt;&apos;flex-grow&apos;> &lt;&apos;flex-shrink&apos;>? ||
jackalmage@7082 4027 &lt;&apos;flex-basis&apos;> ]
jackalmage@7082 4028
jackalmage@7082 4029 <td>see individual properties
jackalmage@7082 4030
jackalmage@7082 4031 <td>flex items
jackalmage@7082 4032
jackalmage@7082 4033 <td>see individual properties
jackalmage@5934 4034
fantasai@6391 4035 <td>
fantasai@6391 4036
jackalmage@7082 4037 <td>visual
fantasai@6391 4038
fantasai@6391 4039 <tr>
fantasai@6391 4040 <th><a class=property href="#flex-basis-propdef">flex-basis</a>
fantasai@6391 4041
fantasai@6391 4042 <td>&lt;&apos;width&apos;>
fantasai@6391 4043
fantasai@6391 4044 <td>auto
fantasai@6391 4045
fantasai@6391 4046 <td>flex items
fantasai@6391 4047
fantasai@6391 4048 <td>no
fantasai@6391 4049
fantasai@6391 4050 <td>relative to the flex container's inner main size
fantasai@6391 4051
fantasai@6391 4052 <td>visual
fantasai@6391 4053
fantasai@6391 4054 <tr>
fantasai@6391 4055 <th><a class=property href="#flex-direction">flex-direction</a>
fantasai@6391 4056
fantasai@6391 4057 <td>row | row-reverse | column | column-reverse
fantasai@6391 4058
fantasai@6391 4059 <td>row
fantasai@6391 4060
fantasai@7194 4061 <td>flex containers
fantasai@6391 4062
fantasai@6391 4063 <td>no
fantasai@6391 4064
fantasai@6391 4065 <td>
fantasai@6391 4066
fantasai@6391 4067 <td>visual
fantasai@6391 4068
fantasai@6391 4069 <tr>
fantasai@6391 4070 <th><a class=property href="#flex-flow">flex-flow</a>
fantasai@6391 4071
fantasai@6391 4072 <td>&lt;‘flex-direction’> || &lt;‘flex-wrap’>
fantasai@6391 4073
fantasai@6391 4074 <td>see individual properties
fantasai@6391 4075
fantasai@7194 4076 <td>flex containers
fantasai@6391 4077
fantasai@6391 4078 <td>see individual properties
fantasai@6391 4079
fantasai@6391 4080 <td>
fantasai@6391 4081
fantasai@6391 4082 <td>visual
fantasai@6391 4083
fantasai@6391 4084 <tr>
fantasai@6391 4085 <th><a class=property href="#flex-grow">flex-grow</a>
fantasai@6391 4086
fantasai@6391 4087 <td>&lt;number>
fantasai@6391 4088
fantasai@6432 4089 <td>0
fantasai@6391 4090
fantasai@6391 4091 <td>flex items
fantasai@6391 4092
fantasai@6391 4093 <td>no
fantasai@6391 4094
fantasai@6391 4095 <td>
fantasai@6391 4096
fantasai@6391 4097 <td>visual
fantasai@6391 4098
fantasai@6391 4099 <tr>
fantasai@6391 4100 <th><a class=property href="#flex-shrink">flex-shrink</a>
fantasai@6391 4101
fantasai@6391 4102 <td>&lt;number>
fantasai@6391 4103
fantasai@6432 4104 <td>1
fantasai@6391 4105
fantasai@6391 4106 <td>flex items
fantasai@6391 4107
fantasai@6391 4108 <td>no
fantasai@6391 4109
fantasai@6391 4110 <td>
fantasai@6391 4111
fantasai@6391 4112 <td>visual
jackalmage@6092 4113
jackalmage@5934 4114 <tr>
jackalmage@7082 4115 <th><a class=property href="#flex-wrap">flex-wrap</a>
jackalmage@7082 4116
jackalmage@7082 4117 <td>nowrap | wrap | wrap-reverse
jackalmage@7082 4118
jackalmage@7082 4119 <td>nowrap
jackalmage@5934 4120
fantasai@7194 4121 <td>flex containers
jackalmage@5934 4122
jackalmage@5934 4123 <td>no
jackalmage@5934 4124
fantasai@6391 4125 <td>
jackalmage@5934 4126
jackalmage@5934 4127 <td>visual
jackalmage@5934 4128
jackalmage@5934 4129 <tr>
jackalmage@5934 4130 <th><a class=property href="#justify-content">justify-content</a>
jackalmage@5934 4131
jackalmage@5934 4132 <td>flex-start | flex-end | center | space-between | space-around
jackalmage@5934 4133
fantasai@5963 4134 <td>flex-start
jackalmage@5934 4135
jackalmage@5934 4136 <td>flex containers
jackalmage@5934 4137
jackalmage@5934 4138 <td>no
jackalmage@5934 4139
fantasai@6391 4140 <td>
jackalmage@5934 4141
jackalmage@5934 4142 <td>visual
jackalmage@5934 4143
jackalmage@5934 4144 <tr>
jackalmage@5934 4145 <th><a class=property href="#order">order</a>
jackalmage@5934 4146
fantasai@6295 4147 <td>&lt;integer>
jackalmage@5934 4148
jackalmage@5934 4149 <td>0
jackalmage@5934 4150
jackalmage@6823 4151 <td>flex items and absolutely-positioned flex container children
jackalmage@5934 4152
jackalmage@5934 4153 <td>no
jackalmage@5934 4154
fantasai@6391 4155 <td>
jackalmage@5934 4156
jackalmage@5934 4157 <td>visual
jackalmage@5934 4158 </table>
jackalmage@5934 4159 <!--end-properties-->
jackalmage@5934 4160
jackalmage@5934 4161 <h2 class=no-num id=index>Index</h2>
jackalmage@5934 4162 <!--begin-index-->
jackalmage@5934 4163
jackalmage@5934 4164 <ul class=indexlist>
jackalmage@5934 4165 <li>align-content, <a href="#align-content"
jackalmage@7082 4166 title="section 8.4."><strong>8.4.</strong></a>
jackalmage@5934 4167
jackalmage@5934 4168 <li>align-items, <a href="#align-items"
jackalmage@7082 4169 title="section 8.3."><strong>8.3.</strong></a>
jackalmage@5934 4170
jackalmage@5934 4171 <li>align-self, <a href="#align-self"
jackalmage@7082 4172 title="section 8.3."><strong>8.3.</strong></a>
jackalmage@5934 4173
fantasai@6356 4174 <li>align-self: auto, <a href="#align-self-auto"
jackalmage@7082 4175 title="section 8.3."><strong>8.3.</strong></a>
fantasai@6356 4176
jackalmage@5934 4177 <li>authoring tool, <a href="#authoring-tool"
jackalmage@7082 4178 title="section 11.2."><strong>11.2.</strong></a>
jackalmage@5934 4179
fantasai@6356 4180 <li>‘<a href="#align-baseline"><code class=css>baseline</code></a>’,
jackalmage@7082 4181 <a href="#align-baseline" title="section 8.3."><strong>8.3.</strong></a>
jackalmage@5934 4182
jackalmage@5934 4183 <li>‘<a href="#align-content-center"><code
fantasai@6356 4184 class=css>center</code></a>’, <a href="#align-center"
jackalmage@7082 4185 title="section 8.3."><strong>8.3.</strong></a>, <a
fantasai@6356 4186 href="#align-content-center"
jackalmage@7082 4187 title="section 8.4."><strong>8.4.</strong></a>, <a href="#justify-center"
jackalmage@7082 4188 title="section 8.2."><strong>8.2.</strong></a>
jackalmage@5934 4189
jackalmage@5934 4190 <li>collapsed, <a href="#collapsed-flex-item"
jackalmage@7082 4191 title="section 4.4."><strong>4.4.</strong></a>
jackalmage@5934 4192
jackalmage@5934 4193 <li>collapsed flex item, <a href="#collapsed-flex-item"
jackalmage@7082 4194 title="section 4.4."><strong>4.4.</strong></a>
jackalmage@5934 4195
jackalmage@5934 4196 <li>‘<a href="#flex-flow-column"><code class=css>column</code></a>’,
jackalmage@7082 4197 <a href="#flex-flow-column"
jackalmage@7082 4198 title="section 5.1."><strong>5.1.</strong></a>
jackalmage@5934 4199
jackalmage@5934 4200 <li>‘<a href="#flex-flow-column-reverse"><code
jackalmage@5934 4201 class=css>column-reverse</code></a>’, <a
jackalmage@5934 4202 href="#flex-flow-column-reverse"
jackalmage@7082 4203 title="section 5.1."><strong>5.1.</strong></a>
jackalmage@5934 4204
jackalmage@5934 4205 <li>cross axis, <a href="#cross-axis"
jackalmage@7082 4206 title="section 2."><strong>2.</strong></a>
jackalmage@5934 4207
jackalmage@6203 4208 <li>cross-axis baseline, <a href="#cross-axis-baseline"
jackalmage@7082 4209 title="section 8.5."><strong>8.5.</strong></a>
jackalmage@6203 4210
jackalmage@6162 4211 <li>cross dimension, <a href="#cross-dimension"
jackalmage@7082 4212 title="section 2."><strong>2.</strong></a>
jackalmage@6162 4213
jackalmage@5934 4214 <li>cross-end, <a href="#cross-end"
jackalmage@7082 4215 title="section 2."><strong>2.</strong></a>
jackalmage@5934 4216
jackalmage@5934 4217 <li>cross size, <a href="#cross-size"
jackalmage@7082 4218 title="section 2."><strong>2.</strong></a>
jackalmage@5934 4219
jackalmage@5934 4220 <li>cross size property, <a href="#cross-size-property"
jackalmage@7082 4221 title="section 2."><strong>2.</strong></a>
jackalmage@5934 4222
jackalmage@5934 4223 <li>cross-start, <a href="#cross-start"
jackalmage@7082 4224 title="section 2."><strong>2.</strong></a>
jackalmage@5934 4225
jackalmage@5934 4226 <li>definite, <a href="#definite-size"
jackalmage@7082 4227 title="section 9."><strong>9.</strong></a>
jackalmage@5934 4228
jackalmage@5934 4229 <li>definite size, <a href="#definite-size"
jackalmage@7082 4230 title="section 9."><strong>9.</strong></a>
jackalmage@7082 4231
fantasai@7248 4232 <li>flex, <a href="#flex" title="section 7.1."><strong>7.1.</strong></a>
jackalmage@5934 4233
fantasai@6141 4234 <li>‘<a href="#flex"><code class=css>flex</code></a>’, <a
jackalmage@7082 4235 href="#display-flex" title="section 3."><strong>3.</strong></a>
fantasai@6141 4236
fantasai@5943 4237 <li>flex base size, <a href="#flex-base-size"
jackalmage@7082 4238 title="section 9.2."><strong>9.2.</strong></a>
fantasai@5943 4239
jackalmage@5934 4240 <li>flex basis, <a href="#flex-basis"
jackalmage@7082 4241 title="section 7.1."><strong>7.1.</strong></a>
jackalmage@5934 4242
fantasai@6369 4243 <li>flex-basis, <a href="#flex-basis-propdef"
jackalmage@7082 4244 title="section 7.3.3."><strong>7.3.3.</strong></a>
jackalmage@5934 4245
fantasai@6356 4246 <li>flex-basis: auto, <a href="#flex-basis-auto"
jackalmage@7082 4247 title="section 7.3.3."><strong>7.3.3.</strong></a>
fantasai@6356 4248
jackalmage@5934 4249 <li>flex container, <a href="#flex-container"
jackalmage@7082 4250 title="section 3."><strong>3.</strong></a>
jackalmage@5934 4251
jackalmage@5934 4252 <li>flex-direction, <a href="#flex-direction"
jackalmage@7082 4253 title="section 5.1."><strong>5.1.</strong></a>
jackalmage@5934 4254
jackalmage@5934 4255 <li>‘<a href="#align-content-flex-end"><code
jackalmage@5934 4256 class=css>flex-end</code></a>’, <a href="#align-content-flex-end"
jackalmage@7082 4257 title="section 8.4."><strong>8.4.</strong></a>, <a href="#align-flex-end"
jackalmage@7082 4258 title="section 8.3."><strong>8.3.</strong></a>, <a
jackalmage@7082 4259 href="#justify-flex-end" title="section 8.2."><strong>8.2.</strong></a>
jackalmage@5934 4260
jackalmage@5934 4261 <li>flex-flow, <a href="#flex-flow"
jackalmage@7082 4262 title="section 5.3."><strong>5.3.</strong></a>
jackalmage@5934 4263
jackalmage@5934 4264 <li>flex formatting context, <a href="#flex-formatting-context"
jackalmage@7082 4265 title="section 3."><strong>3.</strong></a>
jackalmage@5934 4266
jackalmage@5934 4267 <li>flex-grow, <a href="#flex-grow"
jackalmage@7082 4268 title="section 7.3.1."><strong>7.3.1.</strong></a>
jackalmage@5934 4269
jackalmage@6613 4270 <li>flex grow factor, <a href="#flex-grow-factor"
jackalmage@7082 4271 title="section 7.1."><strong>7.1.</strong></a>
jackalmage@5934 4272
jackalmage@5934 4273 <li>flexible length, <a href="#flexible-length"
jackalmage@7082 4274 title="section 7.1."><strong>7.1.</strong></a>
jackalmage@5934 4275
jackalmage@5934 4276 <li>flexible length's, <a href="#flexible-length"
jackalmage@7082 4277 title="section 7.1."><strong>7.1.</strong></a>
jackalmage@5934 4278
jackalmage@5934 4279 <li>flex item, <a href="#flex-item"
jackalmage@7082 4280 title="section 4."><strong>4.</strong></a>
jackalmage@5934 4281
fantasai@6124 4282 <li>flex layout, <a href="#flex-layout"
jackalmage@7082 4283 title="section 1."><strong>1.</strong></a>
fantasai@6124 4284
jackalmage@5934 4285 <li>flex-shrink, <a href="#flex-shrink"
jackalmage@7082 4286 title="section 7.3.2."><strong>7.3.2.</strong></a>
jackalmage@5934 4287
jackalmage@6613 4288 <li>flex shrink factor, <a href="#flex-shrink-factor"
jackalmage@7082 4289 title="section 7.1."><strong>7.1.</strong></a>
jackalmage@6613 4290
jackalmage@5934 4291 <li>‘<a href="#align-content-flex-start"><code
jackalmage@5934 4292 class=css>flex-start</code></a>’, <a href="#align-content-flex-start"
jackalmage@7082 4293 title="section 8.4."><strong>8.4.</strong></a>, <a
jackalmage@7082 4294 href="#align-flex-start" title="section 8.3."><strong>8.3.</strong></a>,
jackalmage@7082 4295 <a href="#justify-flex-start"
jackalmage@7082 4296 title="section 8.2."><strong>8.2.</strong></a>
jackalmage@5934 4297
jackalmage@5934 4298 <li>flex-wrap, <a href="#flex-wrap"
jackalmage@7082 4299 title="section 5.2."><strong>5.2.</strong></a>
jackalmage@5934 4300
fantasai@5943 4301 <li>hypothetical cross size, <a href="#hypothetical-cross-size"
jackalmage@7082 4302 title="section 9.4."><strong>9.4.</strong></a>
fantasai@5943 4303
fantasai@5943 4304 <li>hypothetical main size, <a href="#hypothetical-main-size"
jackalmage@7082 4305 title="section 9.2."><strong>9.2.</strong></a>
fantasai@5943 4306
jackalmage@5934 4307 <li>indefinite, <a href="#indefinite-size"
jackalmage@7082 4308 title="section 9."><strong>9.</strong></a>
jackalmage@5934 4309
jackalmage@5934 4310 <li>indefinite size, <a href="#indefinite-size"
jackalmage@7082 4311 title="section 9."><strong>9.</strong></a>
jackalmage@5934 4312
jackalmage@6143 4313 <li>‘<a href="#display-inline-flex"><code
jackalmage@6143 4314 class=css>inline-flex</code></a>’, <a href="#display-inline-flex"
jackalmage@7082 4315 title="section 3."><strong>3.</strong></a>
jackalmage@6143 4316
jackalmage@5934 4317 <li>justify-content, <a href="#justify-content"
jackalmage@7082 4318 title="section 8.2."><strong>8.2.</strong></a>
jackalmage@5934 4319
jackalmage@5934 4320 <li>main axis, <a href="#main-axis"
jackalmage@7082 4321 title="section 2."><strong>2.</strong></a>
jackalmage@5934 4322
jackalmage@6203 4323 <li>main-axis baseline, <a href="#main-axis-baseline"
jackalmage@7082 4324 title="section 8.5."><strong>8.5.</strong></a>
jackalmage@6203 4325
fantasai@6134 4326 <li>main dimension, <a href="#main-dimension"
jackalmage@7082 4327 title="section 2."><strong>2.</strong></a>
jackalmage@7082 4328
jackalmage@7082 4329 <li>main-end, <a href="#main-end"
jackalmage@7082 4330 title="section 2."><strong>2.</strong></a>
jackalmage@5934 4331
jackalmage@5934 4332 <li>main size, <a href="#main-size"
jackalmage@7082 4333 title="section 2."><strong>2.</strong></a>
jackalmage@5934 4334
jackalmage@5934 4335 <li>main size property, <a href="#main-size-property"
jackalmage@7082 4336 title="section 2."><strong>2.</strong></a>
jackalmage@5934 4337
jackalmage@5934 4338 <li>main-start, <a href="#main-start"
jackalmage@7082 4339 title="section 2."><strong>2.</strong></a>
jackalmage@5934 4340
jackalmage@5934 4341 <li>multi-line, <a href="#multi-line"
jackalmage@7082 4342 title="section 6."><strong>6.</strong></a>
jackalmage@5934 4343
fantasai@6369 4344 <li>‘<a href="#flex-none"><code class=css>none</code></a>’, <a
jackalmage@7082 4345 href="#flex-none" title="section 7.1."><strong>7.1.</strong></a>
fantasai@6369 4346
jackalmage@5934 4347 <li>‘<a href="#flex-flow-nowrap"><code class=css>nowrap</code></a>’,
jackalmage@7082 4348 <a href="#flex-flow-nowrap"
jackalmage@7082 4349 title="section 5.2."><strong>5.2.</strong></a>
jackalmage@7082 4350
jackalmage@7082 4351 <li>order, <a href="#order" title="section 5.4."><strong>5.4.</strong></a>
jackalmage@5934 4352
jackalmage@6203 4353 <li>participates in baseline alignment, <a href="#baseline-participation"
jackalmage@7082 4354 title="section 8.3."><strong>8.3.</strong></a>
jackalmage@6203 4355
jackalmage@5934 4356 <li>renderer, <a href="#renderer"
jackalmage@7082 4357 title="section 11.2."><strong>11.2.</strong></a>
jackalmage@5934 4358
jackalmage@5934 4359 <li>‘<a href="#flex-flow-row"><code class=css>row</code></a>’, <a
jackalmage@7082 4360 href="#flex-flow-row" title="section 5.1."><strong>5.1.</strong></a>
jackalmage@5934 4361
jackalmage@5934 4362 <li>‘<a href="#flex-flow-row-reverse"><code
jackalmage@5934 4363 class=css>row-reverse</code></a>’, <a href="#flex-flow-row-reverse"
jackalmage@7082 4364 title="section 5.1."><strong>5.1.</strong></a>
jackalmage@5934 4365
fantasai@6713 4366 <li>scaled flex shrink factor, <a href="#scaled-flex-shrink-factor"
jackalmage@7082 4367 title="section 9.7."><strong>9.7.</strong></a>
fantasai@6713 4368
jackalmage@5934 4369 <li>single-line, <a href="#single-line"
jackalmage@7082 4370 title="section 6."><strong>6.</strong></a>
jackalmage@5934 4371
jackalmage@5934 4372 <li>‘<a href="#align-content-space-around"><code
jackalmage@5934 4373 class=css>space-around</code></a>’, <a
jackalmage@5934 4374 href="#align-content-space-around"
jackalmage@7082 4375 title="section 8.4."><strong>8.4.</strong></a>, <a
fantasai@6356 4376 href="#justify-space-around"
jackalmage@7082 4377 title="section 8.2."><strong>8.2.</strong></a>
jackalmage@5934 4378
jackalmage@5934 4379 <li>‘<a href="#align-content-space-between"><code
jackalmage@5934 4380 class=css>space-between</code></a>’, <a
jackalmage@5934 4381 href="#align-content-space-between"
jackalmage@7082 4382 title="section 8.4."><strong>8.4.</strong></a>, <a
fantasai@6356 4383 href="#justify-space-between"
jackalmage@7082 4384 title="section 8.2."><strong>8.2.</strong></a>
jackalmage@5934 4385
jackalmage@6317 4386 <li>static position, <a href="#flex-item-static-position"
jackalmage@7082 4387 title="section 4.1."><strong>4.1.</strong></a>
jackalmage@6317 4388
jackalmage@5934 4389 <li>‘<a href="#align-content-stretch"><code
jackalmage@5934 4390 class=css>stretch</code></a>’, <a href="#align-content-stretch"
jackalmage@7082 4391 title="section 8.4."><strong>8.4.</strong></a>, <a href="#align-stretch"
jackalmage@7082 4392 title="section 8.3."><strong>8.3.</strong></a>
jackalmage@5934 4393
jackalmage@5934 4394 <li>strut size, <a href="#strut-size"
jackalmage@7082 4395 title="section 9.4."><strong>9.4.</strong></a>
jackalmage@5934 4396
jackalmage@5934 4397 <li>style sheet
jackalmage@5934 4398 <ul>
jackalmage@5934 4399 <li>as conformance class, <a href="#style-sheet"
jackalmage@7082 4400 title="section 11.2."><strong>11.2.</strong></a>
jackalmage@5934 4401 </ul>
jackalmage@5934 4402
jackalmage@5934 4403 <li>‘<a href="#flex-flow-wrap"><code class=css>wrap</code></a>’, <a
jackalmage@7082 4404 href="#flex-flow-wrap" title="section 5.2."><strong>5.2.</strong></a>
jackalmage@5934 4405
jackalmage@5934 4406 <li>‘<a href="#flex-flow-wrap-reverse"><code
jackalmage@5934 4407 class=css>wrap-reverse</code></a>’, <a href="#flex-flow-wrap-reverse"
jackalmage@7082 4408 title="section 5.2."><strong>5.2.</strong></a>
jackalmage@5934 4409 </ul>
jackalmage@5934 4410 <!--end-index-->
jackalmage@5934 4411 </html>
jackalmage@6092 4412 <!-- Keep this comment at the end of the file
jackalmage@6092 4413 Local variables:
jackalmage@6092 4414 mode: sgml
jackalmage@6092 4415 sgml-declaration:"~/SGML/HTML4.decl"
jackalmage@6092 4416 sgml-default-doctype-name:"html"
jackalmage@6092 4417 sgml-minimize-attributes:t
jackalmage@6092 4418 sgml-nofill-elements:("pre" "style" "br")
jackalmage@6092 4419 sgml-live-element-indicator:t
jackalmage@6092 4420 sgml-omittag:nil
jackalmage@6092 4421 sgml-shorttag:nil
jackalmage@6092 4422 sgml-namecase-general:t
jackalmage@6092 4423 sgml-general-insert-case:lower
jackalmage@6092 4424 sgml-always-quote-attributes:t
jackalmage@6092 4425 sgml-indent-step:nil
jackalmage@6092 4426 sgml-indent-data:t
jackalmage@6092 4427 sgml-parent-document:nil
jackalmage@6092 4428 sgml-exposed-tags:nil
jackalmage@6092 4429 sgml-local-catalogs:nil
jackalmage@6092 4430 sgml-local-ecat-files:nil
jackalmage@6092 4431 End:
jackalmage@5934 4432 -->

mercurial