1. 序論
~INFORMATIVECSS 2.1 にて定義される~layout~mode — ~boxの~sizeと位置を,その同胞の~boxと, その先祖の~boxとの関係性に基づいて決定する~algo — には,次の4種がある: ◎ CSS 2.1 defined four layout modes — algorithms which determine the size and position of boxes based on their relationships with their sibling and ancestor boxes:
- 文書を~lay-outするために設計された塊~layout ◎ block layout, designed for laying out documents
- ~textを~lay-outするために設計された行内~layout ◎ inline layout, designed for laying out text
- ~~二次元~dataを~table状に~lay-outするために設計された~table~layout ◎ table layout, designed for laying out 2D data in a tabular format
- 文書~内の他の要素にさほど関わり無く,~~明確な位置決めにより~lay-outするために設計された positioned ~layout 【 `position$p:fixed や `position$p:absolute 等による ~layout 】 ◎ positioned layout, designed for very explicit positioning without much regard for other elements in the document
この~moduleは,新たな~layout~mode `~flex~layout@ を導入する。 それは,より複雑な~appや~web頁を~lay-outするために設計されたものである。 ◎ This module introduces a new layout mode, flex layout, which is designed for laying out more complex applications and webpages.
1.1. 概観
~INFORMATIVE~flex~layoutは、表面的には塊~layoutに類似する。 それは、[ `float$p や ~col ]などの,塊~layoutに利用できる[ より複雑な,~textや文書を~~主対象にする 多くの~prop ]は欠く一方で、~web~appや複雑な~web頁によく必要とされるような,種々の[ 空間の配分-法や内容の整列-法 ]のための,単純かつ強力な道具を得られる。 ~flex容器の内容は: ◎ Flex layout is superficially similar to block layout. It lacks many of the more complex text- or document-centric properties that can be used in block layout, such as floats and columns. In return it gains simple and powerful tools for distributing space and aligning content in ways that web apps and complex web pages often need. The contents of a flex container:
- どの ~flow方向 にも(左方, 右方, 下方, あるいは上方へも!)~lay-outできる ◎ can be laid out in any flow direction (leftwards, rightwards, downwards, or even upwards!)
- それらの陳列-順序を~style層にて, 逆順にしたり, 配置替えできる(すなわち,~sourceや発話の順序とは独立に,視覚的~順序を与えられる) ◎ can have their display order reversed or rearranged at the style layer (i.e., visual order can be independent of source and speech order)
- 単方向の軸( `主-軸$ )沿いに一次元的に~lay-outしたり, 第二の軸( `交叉-軸$ )沿いに, 複数の~lineに渡るように 折返すことができる。 ◎ can be laid out linearly along a single (main) axis or wrapped into multiple lines along a secondary (cross) axis
- それらの~sizeは`可用な空間$に応じて “~flex” (伸縮可能)になれる。 ◎ can “flex” their sizes to respond to the available space
- それらを,それらの容器に対して, あるいは互いどうしを`交叉-軸$沿いに整列させられる。 【 整列 — この訳の中の語 “~~整列” はすべて, “ソート( `sort^en )” ではなく “揃え( `align^en )” の方を意味する。】 ◎ can be aligned with respect to their container or each other on the secondary (cross)
- 容器の`交叉size$は保全しつつ、`主-軸$沿いに,動的に 畳んだり( `collapse^en ), その逆にできる。 ◎ can be dynamically collapsed or uncollapsed along the main axis while preserving the container’s cross size
ここに、各~駒が[ ~~見出し, 写真, 説明, 購入ボタン ]を備えている,ある目録の例を示す。 ~layoutの中の各~~区画は、駒の説明の長さに関係なく,どれも同じ総~sizeを持ち、~~区画の中では,写真が~textの上に~~位置し, 購入ボタンは下端に整列させたいとする。 この設計の多くの側面は、~flex~layoutにより,容易に実現できる: ◎ Here’s an example of a catalog where each item has a title, a photo, a description, and a purchase button. The designer’s intention is that each entry has the same overall size, that the photo be above the text, and that the purchase buttons aligned at the bottom, regardless of the length of the item’s description. Flex layout makes many aspects of this design easy:
- 目録では,一連の駒を 何本かの~rowに渡って横方向に~lay-outした上で、同じ~rowの中では その中の各~駒の縦幅が等しくなるように,~flex~layoutを利用する。 各~~~区画は、それ自身が 1 本の~colをなす~flex容器になり,その内容を縦方向に~lay-outする。 ◎ The catalog uses flex layout to lay out rows of items horizontally, and to ensure that items within a row are all equal-height. Each entry is then itself a column flex container, laying out its contents vertically.
- 各~~区画の中では,~source文書~内容の論理的~順序【 “文書順” 】は[ ~~見出し, 説明, 写真 ]の順にされる。 これは,発話や非~CSS~browserにおいても意味のある順序付けを供する一方で、より視覚的~呈示においては、 `order$p を利用して 内容の後方に在る画像を上端に引き上げ, `align-self$p を利用して それを横方向の中央に~~位置させることで,より注目を引くものにできる。 ◎ Within each entry, the source document content is ordered logically with the title first, followed by the description and the photo. This provides a sensible ordering for speech rendering and in non-CSS browsers. For a more compelling visual presentation, however, order is used to pull the image up from later in the content to the top, and align-self is used to center it horizontally.
- 購入ボタンに対する上側の`~auto_v~margin$により、どの~~項目~boxの中でも,駒の説明の縦幅に関係なく,ボタンを下端に押しやれる。 ◎ An auto margin above the purchase button forces it to the bottom within each entry box, regardless of the height of that item’s description.
#deals { `display$p:flex; /* ~flex~layoutにより,一連の駒は 縦幅が等しくされる ◎ Flex layout so items have equal height */ `flex-flow$p:row_wrap; /* 一連の駒を,複数~lineに渡って折返す ◎ Allow items to wrap into multiple lines */ } .sale-item { `display$p:flex; /* 各~駒の内容も,~flex~layoutを利用して~lay-outする ◎ Lay out each item using flex layout */ `flex-flow$p:column; /* 駒の内容は縦方向に~lay-outする ◎ Lay out item’s contents vertically */ } .sale-item > img { `order$p:-1; /* 画像を(視覚的~順序で)他の内容より前に~~移動する ◎ Shift image before other content (in visual order) */ `align-self$p:center; /* 画像を交叉~~方向(横方向)の中央に据える ◎ Center the image cross-wise (horizontally) */ } .sale-item > button { `margin-top$p:auto; /* 上端の`~auto_v~margin$によりボタンは下端へ押しやられる ◎ Auto top margin pushes button to bottom */ }`overview-example-code^dgm
1.2. ~module間の相互作用
この~moduleは、新たな[ `塊level$, `行内level$ ]の`表示~型$を追加し,新たな種類の整形~文脈を その~layoutを制御する~propと伴に定義することにより、 `CSS21$r による `display$p ~propの定義を拡張する。 この~moduleにて定義される どの~propも, `first-line$pe / `first-letter$pe 疑似要素には適用されない。 ◎ This module extends the definition of the display property [CSS21], adding a new block-level and new inline-level display type, and defining a new type of formatting context along with properties to control its layout. None of the properties defined in this module apply to the ::first-line or ::first-letter pseudo-elements.
CSS Box Alignment Module は、ここに導入する`整列~prop$( `justify-content$p, `align-items$p, `align-self$p, `align-content$p )の定義を拡張して,それらに取って代わる。 ◎ The CSS Box Alignment Module extends and supercedes the definitions of the alignment properties (justify-content, align-items, align-self, align-content) introduced here.
2. ~flex~layoutの~box~modelとその各種用語
`~flex容器@ とは、[ `display$p ~propの算出値が[ `flex$v:d または `inline-flex$v:d ]になる要素 ]により生成される~boxである。 ~flex容器の`~flow内$にある各~子は, `~flex駒@ と呼ばれ、~flex~layout~modelの下で~lay-outされる。 ◎ A flex container is the box generated by an element with a computed display of flex or inline-flex. In-flow children of a flex container are called flex items and are laid out using the flex layout model.
~layoutの計算は、 [ 塊/行内 ]~flow方向 に重きが置かれた[ 塊/行内 ]~layoutとは異なり,~flex~layoutでは `~flex方向@ に重きが置かれる。 ~flex~layoutについて述べ易くするため、この節では~flex~flowに相対的な用語を定義する。 `flex-flow$p 値と`書字mode$は、これらの用語が,どのように物理的な[ 方向(上端/右端/下端/左端), 軸(縦/横), ~size(横幅/縦幅) ]に対応付けられるかを決定する。 ◎ Unlike block and inline layout, whose layout calculations are biased to the block and inline flow directions, flex layout is biased to the flex directions. To make it easier to talk about flex layout, this section defines a set of flex flow–relative terms. The flex-flow value and the writing mode determine how these terms map to physical directions (top/right/bottom/left), axes (vertical/horizontal), and sizes (width/height).
- 主-軸
- 主~次元
- ~flex容器の `主-軸@ とは、`~flex駒$がその軸~沿いに~lay-outされ, `主~次元@ に延伸する,首たる軸である。 ◎ The main axis of a flex container is the primary axis along which flex items are laid out. It extends in the main dimension.
- 【 この仕様の “~~次元( `dimension^en )” は、もっぱら,縦横いずれかの軸~方向の計量を意味する。 】
- 主-始端
- 主-終端
- 一連の`~flex駒$は, `主-始端@ 側から `主-終端@ 側へ向けて 容器~内に配置される。 ◎ The flex items are placed within the container starting on the main-start side and going toward the main-end side.
- 主size
- 主size~prop
- [ `~flex容器$/`~flex駒$ ]の[ 横幅, 縦幅 ]のうち,`主~次元$に属する方が,その `主size@ になる。 その~boxの `主size~prop@ は、[ `width$p, `height$p ]のうち,`主~次元$に属する方の~propを指す。 ◎ The width or height of a flex container or flex item, whichever is in the main dimension, is that box’s main size. Its main size property is thus either its width or height property, whichever is in the main dimension.\
- 同様に,[ `最小-主size~prop@ / `最大-主size~prop@ ]は、[[ `min-width$p, `min-height$p ] / [ `max-width$p, `max-height$p ]]のうち,`主~次元$に属する方の~propを指し、[ `最大-主size@ / `最小-主size@ ]を決定する。 ◎ Similarly, its min and max main size properties are its min-width/max-width or min-height/max-height properties, whichever is in the main dimension, and determine its min/max main size.
- 交叉-軸
- 交叉~次元
- `主-軸$に垂直な軸は `交叉-軸@ と呼ばれ, `交叉~次元@ に延伸する。 ◎ The axis perpendicular to the main axis is called the cross axis. It extends in the cross dimension.
- 【 この訳では、 “cross” の対訳に “~~交差” ではなく “~~交叉” を用いる。 “~~叉” の方が視覚的イメージに合うこと, および “~~交差” は “intersect” の対訳に利用される場合も多いので。 】
- 交叉-始端
- 交叉-終端
- それぞれが一連の駒により埋められる,一連の ~flex~line は、~flex容器の `交叉-始端@ 側から `交叉-終端@ 側に向けて,容器~内に配置される ◎ Flex lines are filled with items and placed into the container starting on the cross-start side of the flex container and going toward the cross-end side.
- 交叉size
- 交叉size~prop
- [ `~flex容器$/`~flex駒$ ]の[ 横幅, 縦幅 ]のうち,`交叉~次元$に属する方が,その `交叉size@ になる。 その~boxの `交叉size~prop@ は、[ `width$p, `height$p ]のうち,`交叉~次元$に属する方の~propを指す。 ◎ The width or height of a flex container or flex item, whichever is in the cross dimension, is that box’s cross size. Its cross size property is thus either its width or height property, whichever is in the cross dimension.
- 同様に,[ `最小-交叉size~prop@ / `最大-交叉size~prop@ ]は、[[ `min-width$p, `min-height$p ] / [ `max-width$p, `max-height$p ]]のうち,`交叉~次元$に属する方の~propを指し、[ `最大-交叉size@ / `最小-交叉size@ ]を決定する。 ◎ Similarly, its min and max cross size properties are its min-width/max-width or min-height/max-height properties, whichever is in the cross dimension, and determine its min/max cross size
この仕様に利用される,~sizingに関する追加の用語は、 CSS 内在的&外在的~sizing 仕様にて定義される。 `CSS-SIZING-3$r ◎ Additional sizing terminology used in this specification is defined in CSS Intrinsic and Extrinsic Sizing. [CSS-SIZING-3]
3. ~flex容器: `display^p 値 `flex^v, `inline-flex^v
◎名 `display$p ◎新値 `flex$v:d | `inline-flex$v:d ◎表終- `flex@v:d
- この値は、要素に`~flex容器$~boxを生成させる — `~flow~layout$内に配置されたときには、`塊level$になるような。 ◎ This value causes an element to generate a flex container box that is block-level when placed in flow layout.
- `inline-flex@v:d
- この値は、要素に`~flex容器$~boxを生成させる — `~flow~layout$内に配置されたときには、`行内level$になるような。 ◎ This value causes an element to generate a flex container box that is inline-level when placed in flow layout.
`~flex容器$は、その内容に対し,新たな `~flex整形~文脈@ を確立する。 これは、その内容の~layoutおいては,塊~layoutに代えて~flex~layoutが利用されることを除き,塊~整形~文脈を確立することと同じになる: 例えば、`浮動体$が~flex容器~内に侵入することはなく,~flex容器の~marginとその内容の~marginとの間も相殺されることはない。 `~flex容器$は、自身の内容~用の包含塊を, 塊~容器と正確に同じ様に 形成する `CSS21$r 。 `overflow$p ~propは、`~flex容器$にも適用される。 ◎ A flex container establishes a new flex formatting context for its contents. This is the same as establishing a block formatting context, except that flex layout is used instead of block layout. For example, floats do not intrude into the flex container, and the flex container’s margins do not collapse with the margins of its contents. Flex containers form a containing block for their contents exactly like block containers do. [CSS21] The overflow property applies to flex containers.
~flex容器は`塊~容器$ではないので、塊~layoutを前提に設計された一部の~propは,~flex~layoutの文脈~下では適用されない。 特に: ◎ Flex containers are not block containers, and so some properties that were designed with the assumption of block layout don’t apply in the context of flex layout. In particular:
- `float$p は、`~flex駒$を浮動させたり,それを`~flow外$にすることはない。 `clear$p も~flex駒に対する`~clearance$を作成しない。 ◎ float and clear do not create floating or clearance of flex item, and do not take it out-of-flow.
- `vertical-align$p は、~flex駒に対しては 効果はない。 ◎ vertical-align has no effect on a flex item.
-
疑似要素[ `first-line$pe / `first-letter$pe ]は、`~flex容器$には適用されない。 `~flex容器$は、[ `整形される最初の行l$や, 最初の字l ]を先祖に供与しない。 ◎ the ::first-line and ::first-letter pseudo-elements do not apply to flex containers, and flex containers do not contribute a first formatted line or first letter to their ancestors.
要素に指定された `display$p が `inline-flex$v:d である場合、その `display$p ~propの算出値は,一定の状況下で `flex$v:d になる — CSS 2.1 の 9.7 節 の表は、次の行を追加するように改正される:
指定値 | 算出値 |
---|---|
`inline-flex$v:d | `flex$v:d |
4. ~flex駒
大雑把に言えば、`~flex容器$の`~flex駒$とは,その`~flow内$にある内容を表現している~boxである。 ◎ Loosely speaking, the flex items of a flex container are boxes representing its in-flow contents.
`~flex容器$の`~flow内$にある各~子は,`~flex駒$になり、各[ `~flex容器$内の連続している子が成す,`~text連なり$ ]は,`匿名$かつ`塊~容器$である`~flex駒$で包装される。 ただし,そのような`~text連なり$が 空白 (すなわち, `white-space$p ~propに影響され得る文字 【 文書~空白~文字】 )のみからなる場合、描画されない(対応する`~text~node$は `display$p:none にされていたかのように)。 ◎ Each in-flow child of a flex container becomes a flex item, and each contiguous sequence of child text runs is wrapped in an anonymous block container flex item. However, if the entire sequence of child text runs contains only white space (i.e. characters that can be affected by the white-space property) it is instead not rendered (just as if its text nodes were display:none).
~flex駒のいくつかの例: ◎ Examples of flex items:
<div style="`display$p:flex"> <!-- ~flex駒:子~塊 ◎ flex item: block child --> <div id="item1">block</div> <!-- ~flex駒: 浮動された要素 — その効果は無視される ◎ flex item: floated element; floating is ignored --> <div id="item2" style="`float$p:left;">float</div> <!-- ~flex駒: 行内~内容を囲う匿名~塊~box ◎ flex item: anonymous block box around inline content --> anonymous item 3 <!-- ~flex駒: 行内の子 ◎ flex item: inline child --> <span> item 4 <!-- ~flex駒は塊の周囲で分割されることはない ◎ flex items do not split around blocks --> <q style="display: block" id=not-an-item>item 4</q> item 4 </span> </div>
要素~間の空白は、消え去ることに注意: 要素たちの狭間の~textは,自前の匿名~flex駒~内で 包装されるが、それでも空白のみが~flex駒を成すことはない。 ◎ Note that the inter-element white space disappears: it does not become its own flex item, even though the inter-element text does get wrapped in an anonymous flex item.
匿名~駒の~boxには、~style規則をあてがう要素がないため,~styleをあてがえないことに注意。 しかしながら、その内容は,~flex容器から~styleを継承する(~font設定群など)。 ◎ Note also that the anonymous item’s box is unstyleable, since there is no element to assign style rules to. Its contents will however inherit styles (such as font settings) from the flex container.
`~flex駒$は、その内容~用に`独立な整形~文脈を確立する$。 しかしながら、~flex駒~自体は,`塊level$の~boxではなく, `~flex-level@ の~boxになる: それらは、塊~整形~文脈ではなく,容器の~flex整形~文脈に関与する。 ◎ A flex item establishes an independent formatting context for its contents. However, flex items themselves are flex-level boxes, not block-level boxes: they participate in their container’s flex formatting context, not in a block formatting context.
注記: この仕様を読む~web頁~作者【 以下,単に “作者” 】は、以下に述べる~box生成と静的位置についての詳細を読み飛ばして,先に進んでもよい。 ◎ Note: Authors reading this spec may want to skip past the following box-generation and static position details.
`~flex駒$の `display$p 値は`塊~化$される: `~flex容器$を生成している要素の`~flow内$にある子に指定された `display$p 値が`行内level$を表す場合、それは,`塊level$を表す等価な値に算出される。 (この種の `display^p 値の変換についての詳細は、 CSS2.1 の 9.7 節 `CSS21$r, および CSS Display `CSS3-DISPLAY$r を見よ。) ◎ The display value of a flex item is blockified: if the specified display of an in-flow child of an element generating a flex container is an inline-level value, it computes to its block-level equivalent. (See CSS2.1§9.7 [CSS21] and CSS Display [CSS3-DISPLAY] for details on this type of display value conversion.)
注記: `display$p の値のうち,一部のものは、通常は,元の~boxを囲う匿名~boxの作成を誘発する。 そのような~boxが`~flex駒$であった場合、最初に`塊~化$されるので,匿名~boxの作成は起こらない。 例えば,連続する二つの[ `display$p:table-cell にされた子~要素 ]が与えられた下では、その二つが単独の匿名~table~boxに包装されることはなく,別々の `display$p:block にされた`~flex駒$になる。 ◎ Note: Some values of display normally trigger the creation of anonymous boxes around the original box. If such a box is a flex item, it is blockified first, and so anonymous box creation will not happen. For example, two contiguous flex items with display: table-cell will become two separate display: block flex items, instead of being wrapped into a single anonymous table.
`display$p:table にされた~flex駒の事例では、~table包装boxは,`~flex駒$になり, `order$p, `align-self$p ~propも適用される。 ~caption~boxもあれば、その内容は~table包装boxの最小-内容~size, 最大-内容~sizeの計算に供与される。 しかしながら,[ `width$p, `height$p ]と同様、 `flex$p の各種 下位propは,次に従うように~table~boxに適用される: `~flex駒$ の最終的な~sizeは、[[ ~table包装boxの各~辺と~table~boxの各~内容~辺との合間の距離 ]が[ ~table~boxの ~borderと~padding区画の全部 ]を成していて, ~table~boxは`~flex駒$であった ]かのように,~layoutを遂行することにより計算される。 ◎ In the case of flex items with display: table, the table wrapper box becomes the flex item, and the order and align-self properties apply to it. The contents of any caption boxes contribute to the calculation of the table wrapper box’s min-content and max-content sizes. However, like width and height, the flex longhands apply to the table box as follows: the flex item’s final size is calculated by performing layout as if the distance between the table wrapper box’s edges and the table box’s content edges were all part of the table box’s border+padding area, and the table box were the flex item.
4.1. 絶対位置された子 ~flex
`~flex容器$(以下,この節では単に %容器 と記す)の子のうち,`絶対位置され$たもの(以下,単に %子 と記す)は、`~flow外$にあるので,~flex~layoutに関与することはない。 ◎ As it is out-of-flow, an absolutely-positioned child of a flex container does not participate in flex layout.
%子 の`静的位置$は、[ %子 と %容器 のいずれも,[ それらの使用~sizeによる固定~sizeの~boxである ]と見做す下で、 %子 を[ それが %容器 の中の唯一の`~flex駒$であった ]かのように位置させる ]ことにより,決定される。 この目的においては、~marginに対する `auto^v は, 0 に扱われる。 ◎ The static position of an absolutely-positioned child of a flex container is determined such that the child is positioned as if it were the sole flex item in the flex container, assuming both the child and the flex container were fixed-size boxes of their used size. For this purpose, auto margins are treated as zero.
注記: 言い換えれば、 %子 の`静的位置~用の矩形$は, %容器 の内容~boxを与える。 ここで, `静的位置~用の矩形@ とは、 %子 ~boxの静的位置~用の~offsetを決定するときに利用される`整列~容器$である。 ◎ In other words, the static-position rectangle of an absolutely-positioned child of a flex container is the flex container’s content box, where the static-position rectangle is the alignment container used to determine the static-position offsets of an absolutely-positioned box.
(塊~layoutにおいては、静的位置~用の矩形は CSS2.1 の`静的位置$にて述べられている “仮の~box( `hypothetical box^en )” の位置に対応する。 CSS2.1 の下では,`整列~prop$は無いため、`静的位置~用の矩形$の中での 絶対位置された~boxの整列には,常に[ `塊-始端$/`行内-始端$ ]が利用される。 この定義は、最終的には, `CSS-POSITION-3$r ~moduleに移行されることに注意。) ◎ (In block layout the static position rectangle corresponds to the position of the “hypothetical box” described in CSS2.1§10.3.7. Since it has no alignment properties, CSS2.1 always uses a block-start inline-start alignment of the absolutely-positioned box within the static-position rectangle. Note that this definition will eventually move to the CSS Positioning module.)
このことから、例えば, %子 に `align-self$p:center を設定した場合、 %子 に対する `auto^v による~offsetは, %容器 の`交叉-軸$において中央~寄せにすることになる。 ◎ The effect of this is that if you set, for example, align-self: center; on an absolutely-positioned child of a flex container, auto offsets on the child will center it in the flex container’s cross axis.
しかしながら、 絶対位置された~boxは, “固定~size” と見なされるので、値 `stretch$v:ais は, `flex-start$v:ais と同じに扱われる。 ◎ However, since the absolutely-positioned box is considered to be “fixed-size”, a value of stretch is treated the same as flex-start.
4.2. ~flex駒の~marginと~padding
隣接する 2 個の`~flex駒$の~marginは`相殺-$されない。 ◎ The margins of adjacent flex items do not collapse.
`~flex駒$ %駒 上の百分率による[ ~margin/~padding ]は、 %駒 の`包含塊$の`行内~size$を基準に解決される — `塊~box$のときと同様に。 例えば,横書き`書字mode$の下では、[ 左端, 右端, 上端, 下端 ]のいずれも,百分率は包含塊の横幅を基準に解決される。 ◎ Percentage margins and paddings on flex items, like those on block boxes, are resolved against the inline size of their containing block, e.g. left/right/top/bottom percentages all resolve against their containing block’s width in horizontal writing modes.
自動~marginは、対応する次元の余った空間を吸収するように拡幅される。 これを利用して、~flex駒に対し,互いを整列させたり, 隣接するものを離れた所へ押出すことができる。 `~auto_v~margin$による整列-法を見よ。 ◎ Auto margins expand to absorb extra space in the corresponding dimension. They can be used for alignment, or to push adjacent flex items apart. See Aligning with auto margins.
4.3. ~flex駒の z ~~方向の順序付け
`~flex駒$は、次の二点を除いて,行内~塊 `CSS21$r と正確に同じ様に塗られる:
- そのままの文書順に代わって, `order$p による`改変文書順$が利用される。
- `position$p が `static^v であっても、[ `auto^v 以外の `z-index$p 値 ]により,積層~文脈が作成される( `position$p が `relative^v であったときと正確に同じに挙動する)。
注記: ~flex駒の子孫は、駒の外側に位置させられても,駒により確立される積層~文脈に関与する。 ◎ Note: Descendants that are positioned outside a flex item still participate in any stacking context established by the flex item.
4.4. 畳まれる駒
~flex駒~上にて `visibility$p:collapse を指定することにより,~flex駒は `畳まれ@ 、[ `table-row^v や `table-column^v 上の `visibility$p:collapse ]と似た効果を生産する: 畳まれた~flex駒は,描画~対象からは まるごと外されるが、~flex~lineの交叉sizeを安定させるため, “支柱(概念的な突っ支い棒)” だけ居残るようにされる。 従って,~flex容器の~flex~lineが一本だけの場合、駒が畳まれるかどうかが動的に~~変化しても,`~flex容器$の`主size$は変化し得るが,`交叉size$には効果を及ぼさず、頁の~layoutの残りの部分を “揺らがす” ことはないことが保証される。 一方で,複数~lineを伴う~flex容器の交叉sizeは、[ ~flex~lineの折返しが,駒を畳んだ後にも 再び行われる† ]ので,変化し得る。 ◎ Specifying visibility:collapse on a flex item causes it to become a collapsed flex item, producing an effect similar to visibility:collapse on a table-row or table-column: the collapsed flex item is removed from rendering entirely, but leaves behind a "strut" that keeps the flex line’s cross-size stable. Thus, if a flex container has only one flex line, dynamically collapsing or uncollapsing items may change the flex container’s main size, but is guaranteed to have no effect on its cross size and won’t cause the rest of the page’s layout to "wobble". Flex line wrapping is re-done after collapsing, however, so the cross-size of a flex container with multiple lines might or might not change.
【 “畳む”( `collapse^en する) — ~marginの~~相殺( `collapse^en )とは ある意味~~似て異なる(一般英語としては同じ概念であろうが)。 】【† すなわち,駒が畳まれることにより、次の~lineに折返された後続の駒が,駒と同じ~lineに繰り上げられる。 】
畳まれた~flex駒は描画されないが, 整形~構造 には現れる。 従って, `display$p:none `CSS21$r にされた駒と異なり、整形~構造の下で~boxの出現に依存する効果( `counter^en の増加, あるいは~animationや遷移効果【 CSS Animation, CSS Transition 】の実行, 等々)は、依然として,畳まれた駒~上でも演算される。 ◎ Though collapsed flex items aren’t rendered, they do appear in the formatting structure. Therefore, unlike on display:none items [CSS21], effects that depend on a box appearing in the formatting structure (like incrementing counters or running animations and transitions) still operate on collapsed items.
次の例では、左に位置する~sidebarが,その内容を収めるように~sizeされる。 ~navi~sidebarの部品を — その最も幅広な駒 ( “Architecture” )が畳まれる区分に入っているとしても,~sidebarの横幅に影響しないように — 動的に隠すために, `visibility$p:collapse が利用される。 ◎ In the following example, a sidebar is sized to fit its content. visibility: collapse is used to dynamically hide parts of a navigation sidebar without affecting its width, even though the widest item (“Architecture”) is in a collapsed section.
@media (`min-width$d:60em) { /* (既定の~text~sizeに比して)十分な部屋があるときだけ, 2 本の~colで~layoutする◎ two column layout only when enough room (relative to default text size) */ div { `display$p:flex; } #main { `flex$p:1; /* 残りの空間すべては#main
が占める ◎ Main takes up all remaining space */ `order$p:1; /* ~navi(nav
)の後ろ(右側)に配置する ◎ Place it after (to the right of) the navigation */ `min-width$p:12em; /* 主~内容~区画の~sizingを最適化する ◎ Optimize main content area sizing */ } } /* `visibility$p:collapse が働くよう,~menu項目には~flex~layoutを利用する ◎ menu items use flex layout so that visibility:collapse will work */ nav > ul > li { `display$p:flex; `flex-flow$p:column; } /* 操作中でない下位~menuは,動的に畳まれる ◎ dynamically collapse submenus when not targetted */ nav > ul > li:not(:target):not(:hover) > ul { `visibility$p:collapse; }
</header> <div> <article id="main"> Interesting Stuff to Read </article> <nav> <ul> <li id="nav-about"><a href="#nav-about">About</a> … <li id="nav-projects"><a href="#nav-projects">Projects</a> <ul> <li><a href="…">Art</a> <li><a href="…">Architecture</a> <li><a href="…">Music</a> </ul> <li id="nav-interact"><a href="#nav-interact">Interact</a> … </ul> </nav> </div> <footer> …
支柱~sizeを算出するためには、最初に,すべての駒は畳まれないものとした下で ~flex~layoutが遂行され,次に畳まれる各~駒が[ 駒の元の~lineの元の交叉sizeを保守するような支柱 ]に置換された上で、~flex~layoutが再実行される。 `visibility$p:collapse が,どのように~flex~layoutに作用するかについての規範的な定義は、`~flex~layout~algo$を見よ。 ◎ To compute the size of the strut, flex layout is first performed with all items uncollapsed, and then re-run with each collapsed item replaced by a strut that maintains the original cross-size of the item’s original line. See the Flex Layout Algorithm for the normative definition of how visibility:collapse interacts with flex layout.
注記: ~flex駒~上における `visibility$p:collapse の利用は、最も高価な手続きである ~flex~layout~algoを,~~部分的に繰り返し再実行させることになる。 作者には、畳まれるかどうかが動的に~~変化しない駒を隠す際には、 `display$p:none を利用し続けることが推奨される。 その方が~layout~engineにとってはより効率的になるので。 (しかしながら, `visibility$p の変化-時には,手続きの必要な部分のみ繰り返されるので、動的な場合には,依然として `visibility$p:collapse が推奨される。) ◎ Note: Using visibility:collapse on any flex items will cause the flex layout algorithm to repeat partway through, re-running the most expensive steps. It’s recommended that authors continue to use display:none to hide items if the items will not be dynamically collapsed and uncollapsed, as that is more efficient for the layout engine. (Since only part of the steps need to be repeated when visibility is changed, however, 'visibility: collapse' is still recommended for dynamic cases.)
4.5. ~flex駒の自動的な最小~size
注記: `自動的~最小~size$を表現する `~autoS$v ~keywordは、[ `min-width$p / `min-height$p ]~propの新たな初期値である。 この~keywordは、この仕様にて以前に定義されていたが,今や `CSS-SIZING-3$r ~moduleにて定義される。 ◎ Note: The auto keyword, representing an automatic minimum size, is the new initial value of the min-width and min-height properties. The keyword was previously defined in this specification, but is now defined in the CSS Sizing module.
`~flex駒$ %駒 用に,より適度な既定の`最小~size$を供するため、`主-軸$における %駒 の`自動的~最小~size$の使用値は,[ %駒 は`~scroll容器$でないならば `内容に基づく最小~size$ / ~scroll容器であるならば 通例通り 0 ]になるとする。 ◎ To provide a more reasonable default minimum size for flex items, the used value of a main axis automatic minimum size on a flex item that is not a scroll container is a content-based minimum size; for scroll containers the automatic minimum size is zero, as usual.
`内容に基づく最小~size@ は、次で与えられる:
- [ %駒 は`指定d~size$を縦横とも有さない ]~AND[ %縦横比 ~NEQ ε ]ならば ⇒ `min^op( %駒 の`内容~size示唆$, %駒 の`転換~size示唆$ )
- 他の場合 ⇒ `min^op( %駒 の`内容~size示唆$, %駒 の`指定d~size示唆$ )
ここで:
- %縦横比 は、 %駒 が内在的~縦横比を有するならば[ `主-軸$~size ~DIV `交叉-軸$~size ]を表すそれ / ~ELSE_ ε とする。
- [ `min^op(…) / `max^op(…) ]は、各~引数の[ 最小/最大 ]値とる関数であり、引数のうち ε を値にとるものは,無視するものとする。
- 記号 ε は、値が[ 定義されない/不定である ]ことを表す,特別な値である(他のどの値とも異なる)。
これらは、以下の計算にも利用される。
◎ In general, the content-based minimum size of a flex item is the smaller of its content size suggestion and its specified size suggestion. However, if the box has an aspect ratio and no specified size, its content-based minimum size is the smaller of its content size suggestion and its transferred size suggestion. If the box has neither a specified size suggestion nor an aspect ratio, its content-based minimum size is the content size suggestion.%駒 の[ `内容~size示唆$, `指定d~size示唆$, `転換~size示唆$ ]は、以下に定義される — これらには、`内容に基づく最小~size$が作者から供された拘束に干渉しないように,関連する[ 最小-/最大-/選好 ]~size~propも織り込まれる:
- [ %主size / %最大-主size / %最小-主size ]は、 %駒 の[ `主size~prop$ / `最大-主size~prop$ /`最小-主size~prop$ ]の算出値を表すとする。
- [ %交叉size / %最大-交叉size / %最小-交叉size ]は、 %駒 の[ `交叉size~prop$ / `最大-交叉size~prop$ /`最小-交叉size~prop$ ]の算出値を表すとする。
- これらはそれぞれ、算出値が`確定的$でない場合は, ε を値にとるとする。
- `指定d~size示唆@
- [ %主size ~NEQ ε ]ならば ⇒ `min^op( %主size, %最大-主size ) ◎ If the item’s computed main size property is definite, then the specified size suggestion is that size (clamped by its max main size property if it’s definite).\
- ~ELSE_ ε ◎ It is otherwise undefined.
- `転換~size示唆@
- [ %縦横比 ~NEQ ε ]~AND[ %交叉size ~NEQ ε ]ならば ⇒ `max^op( `min^op( %交叉size, %最大-交叉size ), %最小-交叉size ) ~MUL %縦横比 ◎ If the item has an intrinsic aspect ratio and its computed cross size property is definite, then the transferred size suggestion is that size (clamped by its min and max cross size properties if they are definite), converted through the aspect ratio.\
- ~ELSE_ ε ◎ It is otherwise undefined.
- `内容~size示唆@
-
`主-軸$における %駒 の`最小-内容~size$を %s とするとき:
- %縦横比 ~NEQ ε ならば、 %s を,次で与える値に置換する ⇒ `max^op( `min^op( %s ~DIV %縦横比, %最大-交叉size ), %最小-交叉size ) ~MUL %縦横比
- 結果の値は、 `min^op( %s, %最大-主size ) で与えられる。
~boxの内在的~size(例: 要素の`最小-内容~size$)を計算する目的においては、`内容に基づく最小~size$は,当の軸における~boxの~sizeを不定にする(例えば~boxの `width$p ~propが`確定的$な~sizeを指定していても)。 このことは、この~sizeを基準に計算される百分率が`~autoとして挙動する$ことを意味することに注意。 ◎ For the purpose of calculating an intrinsic size of the box (e.g. the box’s min-content size), a content-based minimum size causes the box’s size in that axis to become indefinite (even if e.g. its width property specifies a definite size). Note this means that percentages calculated against this size will behave as auto.
いずれにせよ,これは、一部の事例において百分率を再度~解決するために,追加の~layoutを要することもあるが、この値は,駒の中の百分率~sizeを解決できなくするものではない( `CSS-SIZING-3$r に定義される値[ `min-content$v, `max-content$v, `fit-content^v ]と同様に)。 ◎ Nonetheless, although this may require an additional layout pass to re-resolve percentages in some cases, this value (like the min-content, max-content, and fit-content values defined in [CSS-SIZING-3]) does not prevent the resolution of percentage sizes within the item.
大抵の場合、内容に基づく最小~sizeは適切であり,[ 内容が重合する/容器の外側に溢れる ]ことはないようにするが、一部の事例ではそうならない: ◎ Note that while a content-based minimum size is often appropriate, and helps prevent content from overlapping or spilling outside its container, in some cases it is not:
特に,文書の~~主要な内容~区画に~flex~sizingを利用する場合、~font~sizeに相対的な,最小の横幅( `min-width$p:12em など)を明示的に設定した方がよい。 最小~横幅が内容に基づく場合、巨大な[ ~tableや画像 ]があるときに,内容~区画~全体の~sizeを~overflowする地帯にまで伸張させ、~text行lを無用に~~長く, 読みづらくさせることになる。 ◎ In particular, if flex sizing is being used for a major content area of a document, it is better to set an explicit font-relative minimum width such as min-width: 12em. A content-based minimum width could result in a large table or large image stretching the size of the entire content area into an overflow zone, and thereby making lines of text gratuitously long and hard to read.
多量の内容を伴う駒に内容に基づく~sizingを利用した場合、~layout~engineは,その最小~sizeを見出す前に その内容すべてを走査しなければならなくなる。 作者が明示的な最小~sizeを設定しておけば、これは不要になる。 (駒の内容が少量であれば、その走査は自明なので,処理能の懸念はない) ◎ Note also, when content-based sizing is used on an item with large amounts of content, the layout engine must traverse all of this content before finding its minimum size, whereas if the author sets an explicit minimum, this is not necessary. (For items with small amounts of content, however, this traversal is trivial and therefore not a performance concern.)
5. 順序付けと方位
~flex容器の内容は、任意の方向, 任意の順序で~lay-outできる。 これにより、作者は,以前までは `float$p, `clear$p ~propの併用による~hackなど,複雑, あるいは不安定な手法を要していた効果も、自明に得られるようになる。 この機能性は `flex-direction$p, `flex-wrap$p, `order$p ~propを通して公開される。 ◎ The contents of a flex container can be laid out in any direction and in any order. This allows an author to trivially achieve effects that would previously have required complex or fragile methods, such as hacks using the float and clear properties. This functionality is exposed through the flex-direction, flex-wrap, and order properties.
注記: ~flex~layoutによる並替えの能力は,意図的に ~~描画(視覚的な具現化法)にのみ 影響するようにされており、発話~順序や, ~source順序に基づく~naviは,そのままにされる。 これにより,作者は、[ 非~CSS~UA, あるいは 発話や逐次的~naviなどの一次元的~model ]のための~source順序には触れずに,視覚的~呈示を操作できるようになる。 この,~accessibilityを改善する分岐の用例については、 並替えと~accessibility, ~flex~layoutの概観 を見よ。 ◎ Note: The reordering capabilities of flex layout intentionally affect only the visual rendering, leaving speech order and navigation based on the source order. This allows authors to manipulate the visual presentation while leaving the source order intact for non-CSS UAs and for linear models such as speech and sequential navigation. See Reordering and Accessibility and the Flex Layout Overview for examples that use this dichotomy to improve accessibility.
作者は、 `flex-flow$p/`flex-direction$p に対する `*-reverse^v 値を,~source順序付けを正すための代用として 利用しては~MUST_NOT。 文書の~accessibilityを損ないかねないので。 ◎ Authors must not use order or the *-reverse values of flex-flow/flex-direction as a substitute for correct source ordering, as that can ruin the accessibility of the document.
5.1. ~flexの~flow方向: `flex-direction^p ~prop
◎名 `flex-direction@p ◎値 `row$v:fd | `row-reverse$v:fd | `column$v:fd | `column-reverse$v:fd ◎初 `row$v:fd ◎適 `~flex容器$ ◎継 されない ◎百 受容しない ◎算 指定値 ◎順 文法に従う ◎ア 離散的 ◎表終`flex-direction$p ~propは、~flex容器の`主-軸$の方向を設定することにより,`~flex駒$が~flex容器の中で どのように配置されるかを指定する。 これは、一連の~flex駒が~lay-outされていく方向を決定する: ◎ The flex-direction property specifies how flex items are placed in the flex container, by setting the direction of the flex container’s main axis. This determines the direction in which flex items are laid out.
- `row@v:fd
- ~flex容器の`主-軸$は、現在の`書字mode$の`行内-軸$と同じ方位になるようにされる。 `主-始端$/`主-終端$ の方向は、現在の`書字mode$の[ `行内-始端$/`行内-終端$ ]方向に等価になる。 ◎ The flex container’s main axis has the same orientation as the inline axis of the current writing mode. The main-start and main-end directions are equivalent to the inline-start and inline-end directions, respectively, of the current writing mode.
- `row-reverse@v:fd
- `主-始端$と`主-終端$ の方向が入換わることを除き, `row$v:fd と同じ。 ◎ Same as row, except the main-start and main-end directions are swapped.
- `column@v:fd
- ~flex容器の`主-軸$は、現在の`書字mode$の`塊-軸$と同じ方位になるようにされる。 `主-始端$/`主-終端$ の方向は、現在の`書字mode$の `塊-始端$/`塊-終端$ の方向に等価になる。 ◎ The flex container’s main axis has the same orientation as the block axis of the current writing mode. The main-start and main-end directions are equivalent to the block-start and block-end directions, respectively, of the current writing mode.
- `column-reverse@v:fd
- `主-始端$と`主-終端$ の方向が入換わることを除き, `column$v:fd と同じ。 ◎ Same as column, except the main-start and main-end directions are swapped.
注記: `row-reverse^v / `column-reverse^v 値は、~boxの順序付けを “逆順” にするものではない — `writing-mode$p, `direction$p `CSS3-WRITING-MODES$r と同様に,それらは~flowの方向のみを変化させる。 塗り, 発話, 逐次的~navi の順序は影響されない。 ◎ Note: The reverse values do not reverse box ordering: like writing-mode and direction [CSS3-WRITING-MODES], they only change the direction of flow. Painting order, speech order, and sequential navigation orders are not affected.
5.2. ~flex~lineの折返し: `flex-wrap^p ~prop
◎名 `flex-wrap@p ◎値 `nowrap$v:fw | `wrap$v:fw | `wrap-reverse$v:fw ◎初 `nowrap$v:fw ◎適 `~flex容器$ ◎継 されない ◎百 受容しない ◎算 指定値 ◎順 文法に従う ◎ア 離散的 ◎表終`flex-wrap$p ~propは、次の 2 つを制御する:
- ~flex容器は[ `単-~line$, `複-~line$ ]のいずれになるか。
- ~flex容器の`交叉-軸$の向き — これは、~flex容器~内で新たな~lineが堆積されていく方向(順方向か逆方向か)を決定する。
- `nowrap@v:fw
- ~flex容器は`単-~line$になる。 ◎ The flex container is single-line.
- `交叉-軸$の向きは、 `wrap$v:fw のときと同じになる。 ◎ ↓↓
- `wrap@v:fw
- ~flex容器は`複-~line$になる。 ◎ The flex container is multi-line.
- `交叉-軸$の向きは、順方向 — すなわち、`交叉-始端$は[ 現在の`書字mode$の[ `行内-始端$, `塊-始端$ ]のうち`交叉-軸$に属する方 ]になり,`交叉-終端$はその反対側になる。 ◎ ↓↓
- `wrap-reverse@v:fw
- ~flex容器は`複-~line$になる。 ◎ Same as wrap.
- `交叉-軸$の向きは、逆方向 — すなわち、[ `交叉-始端$, `交叉-終端$ ]は `wrap$v:fw のときと入換わる。 ◎ For the values that are not wrap-reverse, the cross-start direction is equivalent to either the inline-start or block-start direction of the current writing mode (whichever is in the cross axis) and the cross-end direction is the opposite direction of cross-start. When flex-wrap is wrap-reverse, the cross-start and cross-end directions are swapped.
5.3. ~flexの~flow方向と折返し: `flex-flow^p 略式~prop
◎名 `flex-flow@p ◎値 <‘`flex-direction$p’> || <‘`flex-wrap$p’> ◎初 個々の~propを見よ ◎適 個々の~propを見よ ◎継 個々の~propを見よ ◎百 個々の~propを見よ ◎算 個々の~propを見よ ◎順 文法に従う ◎ア 個々の~propを見よ ◎表終`flex-flow$p ~propは,[ `flex-direction$p, `flex-wrap$p ]~propを設定するための略式~propであり, ~flex容器の[ 主-軸, 交叉-軸 ]を同時に定義する。 ◎ The flex-flow property is a shorthand for setting the flex-direction and flex-wrap properties, which together define the flex container’s main and cross axes.
英語~文書( `left-to-right^en, 横書き書字mode)の下での妥当な~flowの例: ◎ Some examples of valid flows in an English (left-to-right, horizontal writing mode) document:
- `flex-flow$p:row
-
初期値。 主-軸は行内, 折返しなし。 (駒たちは,容器に収まるように縮短されるか, または~overflowする。) ◎ Initial value. Main-axis is inline, no wrapping. (Items will either shrink to fit or overflow.)
`flex-flow1^dgm - `flex-flow$p:column_wrap
-
主-軸は塊~方向(上端から下端へ)になり, 一連の~lineは行内~方向(右方)に折返される。 ◎ Main-axis is block-direction (top to bottom) and lines wrap in the inline direction (rightwards).
`flex-flow2^dgm - `flex-flow$p:row-reverse_wrap-reverse
-
主-軸は行内~方向の反対(右端から左端へ)。 新たな~lineは上方に折返される。 ◎ Main-axis is the opposite of inline direction (right to left). New lines wrap upwards.
`flex-flow3^dgm
注記: `flex-flow$p 方向は`書字mode$に感応する。 縦書き日本語の下では、 `row$v:fd ~flex容器は,例えば次の様に その内容を上端から下端へ~lay-outする。 ◎ Note that the flex-flow directions are writing mode sensitive. In vertical Japanese, for example, a row flex container lays out its contents from top to bottom, as seen in this example:
- 横書き(英語)
-
`flex-flow$p:___row_wrap; `writing-mode$p:horizontal-tb;
`flex-flow-english^dgm - 縦書き(日本語)
-
`flex-flow$p:___row_wrap; `writing-mode$p:vertical-rl;
`flex-flow-japanese^dgm
5.4. 陳列-順序: `order^p ~prop
`~flex駒$は,既定では、それらが~source文書に現れるのと同じ順序で,陳列され, ~lay-outされる。 `order$p ~propを,この順序付けの変更に利用できる。 ◎ Flex items are, by default, displayed and laid out in the same order as they appear in the source document. The order property can be used to change this ordering.
◎名 `order@p ◎値 `integer$t ◎初 `0^v ◎適 `~flex駒$ ◎ flex items ◎継 されない ◎百 受容しない ◎算 指定値 ◎順 文法に従う ◎ア `整数として$ ◎表終`order$p ~propは、一連の`~flex駒$を序数が付与されたいくつかの~groupに仕分けることを通して,~flex容器の中に~flex駒たちが現れる順序を制御する。 それは、`~flex駒$がどの~groupに属するかを表す序数を指定する,単独の `integer$t を値にとる。 ◎ The order property controls the order in which flex items appear within the flex container, by assigning them to ordinal groups. It takes a single <integer> value, which specifies which ordinal group the flex item belongs to.
~flex容器は,その内容を序数が最低の~groupから順に~lay-outする。 この順序のことを `改変文書順@† と呼ぶ。 同じ序数の~groupに属する一連の駒が~lay-outされる順序は,~source文書に現れる順序に従う。 これは、 塗り順序 `CSS21$r にも,一連の~flex駒が~source文書~内で並替えられていたかのように影響する。 `~flex容器$の子のうち,絶対位置されたものは、~flex駒に相対的な塗り順序を決定する目的においては, `order$p:0 と扱われる。 ◎ A flex container lays out its content in order-modified document order, starting from the lowest numbered ordinal group and going up. Items with the same ordinal group are laid out in the order they appear in the source document. This also affects the painting order [CSS21], exactly as if the flex items were reordered in the source document. Absolutely-positioned children of a flex container are treated as having order: 0 for the purpose of determining their painting order relative to flex items.
【† 原文による呼称は “order-modified document order”( “`order^p により改変された文書~順序” )であるが、いかにも長くなるので,ここでは略して和訳している。 】
次の図に,単純な~tab化された~UIを示す。 作動中の~pane用の~tabは,常に最初に来るようにされる: ◎ The following figure shows a simple tabbed interface, where the tab for the active pane is always first:
これは,次の~CSSで実装できる(関連する~codeのみを示す): ◎ This could be implemented with the following CSS (showing only the relevant code):
.tabs {
`display$p:flex;
}
.tabs > .current {
`order$p:-1; /*
既定の値 0 を下回る値
◎
Lower than the default of 0
*/
}
将来~仕様により 特に指定されない限り、この~propの効果は,`~flex駒$でない~boxにはない。 ◎ Unless otherwise specified by a future specification, this property has no effect on boxes that are not flex items.
5.4.1. 並替えと~accessibility
`order$p ~propは、非~視覚的~媒体( 発話 など)の順序付けには影響しない。 同様に, `order$p は、逐次的~navi~modeの下での既定の走査~順序(一連の~linkに渡る巡回など — 例えば `tabindex$a `HTML5$r など)にも,影響しない。 ◎ The order property does not affect ordering in non-visual media (such as speech). Likewise, order does not affect the default traversal order of sequential navigation modes (such as cycling through links, see e.g. tabindex [HTML5]).
作者は、もっぱら視覚的であって, 論理的でないような 内容の並替えに限って, `order$p を利用し~MUST。 論理的に並替えるために `order$p を利用するような~stylesheetは、適合でない。 ◎ Authors must use order only for visual, not logical, reordering of content. Style sheets that use order to perform logical reordering are non-conforming.
注記: これは、視覚的~順序を誂えるために `order$p を利用しつつ(視覚的~~認識は二次元であり, 一次元的ではないので、欲される視覚的~順序が常に論理的~順序に一致するとは限らない)、概して内容を一次元的に呈示する 非~視覚的~媒体や非~CSS~UAが,~sourceの論理的~順序に依拠できるようにするためである。 ◎ Note: This is so that non-visual media and non-CSS UAs, which typically present content linearly, can rely on a logical source order, while order is used to tailor the visual order. (Since visual perception is two-dimensional and non-linear, the desired visual order is not always logical.)
多くの~web頁は 似た様な~~形に~markupされている — 上端に~header, 下端に~footerがあって,中段に内容~区画と 1 本か 2 本の追加の~colがある様なものなど。 一般に、~~主~内容は,追加の~colより前の, 頁の~source~codeの最初に来ることが望ましい。 しかしながら,これを得ることは、[ 追加の~colが左に, 内容~区画が右に~~位置するような単純なものも含め,共通的な多くの設計 ]においては,困難である。 これは,年月に渡り 様々な仕方で取組まれており、追加の~colが 2 本~在るものは,しばしば “Holy Grail Layout” ( “聖なる~layout” )と称されている。 `order$p は これを自明にする。 例えば次の様な,頁の~code, および欲される~layoutがあるとする: ◎ Many web pages have a similar shape in the markup, with a header on top, a footer on bottom, and then a content area and one or two additional columns in the middle. Generally, it’s desirable that the content come first in the page’s source code, before the additional columns. However, this makes many common designs, such as simply having the additional columns on the left and the content area on the right, difficult to achieve. This has been addressed in many ways over the years, often going by the name "Holy Grail Layout" when there are two additional columns. order makes this trivial. For example, take the following sketch of a page’s code and desired layout:
<!DOCTYPE html> <header>...</header> <main> <article>...</article> <nav>...</nav> <aside>...</aside> </main> <footer>...</footer>
この~layoutは,~flex~layoutにより容易に得られる: ◎ This layout can be easily achieved with flex layout:
main { `display$p:flex; } main > article { `order$p:2; `min-width$p:12em; `flex$p:1; } main > nav { `order$p:1; `width$p:200px; } main > aside { `order$p:3; `width$p:200px; }
追加の特典として、一連の~colは,既定で 縦幅が等しく揃えられるようになり、主~内容は,~screenを埋める必要に応じた幅にされる。 加えて,媒体~queryと組合せることにより、狭い~screen幅の下では,すべてを縦方向に~layoutするように切替えることも可能になる: ◎ As an added bonus, the columns will all be equal-height by default, and the main content will be as wide as necessary to fill the screen. Additionally, this can then be combined with media queries to switch to an all-vertical layout on narrow screens:
@media all and (`max-width$p:600px) { /* 3 本の~colには狭過ぎるときの~support ◎ Too narrow to support three columns */ main { `flex-flow$p:column; } main > article, main > nav, main > aside { /* 文書順に戻す ◎ Return them to document order */ `order$p:0; `width$p:auto; } }
( より気の利いた折返しを得るための,複-~line ~flex容器の更なる利用は、読者への演習として残しておく。 ) ◎ (Further use of multi-line flex containers to achieve even more intelligent wrapping left as an exercise for the reader.)
作者が意図する順序付けを,すべての呈示~modeにわたって保全するため、著作~toolは( WYSIWYG ~editorや~webに基づく著作~援助その他も含め), `order$p を利用して並替えることなく,下層の文書~sourceを並替えることが要求される — 作者から,(発話や~navi順序を決定する)下層の文書~順序と視覚的~順序は 違えるべき と明示的に指示された場合は別として。 ◎ In order to preserve the author’s intended ordering in all presentation modes, authoring tools—including WYSIWYG editors as well as Web-based authoring aids—must reorder the underlying document source and not use order to perform reordering unless the author has explicitly indicated that the underlying document order (which determines speech and navigation order) should be out-of-sync with the visual order.
例えば、[ ~drag-and-dropによる~flex駒の並替え ]と[ ~screen~sizeのある範囲ごとに~layoutを別々に~~用意するような媒体~queryの取扱い ]の両者を提供する~toolもある。 ◎ For example, a tool might offer both drag-and-drop reordering of flex items as well as handling of media queries for alternate layouts per screen size range.
ほとんどの場合、どの~screen~sizeに対しても,並替えは~navi/発話 の順序にも同じように影響するべきであり、~toolは,~drag-and-dropによる視覚的~並替えに合わせて DOM 層における並替えを遂行する。 しかしながら、作者が~screen~sizeごとに異なる視覚的~順序付けを求める事例もある。 ~toolは、媒体~queryと `order$p を併用して,この機能性を提供することもできる — 最~小の~screen~sizeに対する順序付けは,(論理的な呈示~順序にほぼ近い)下層の DOM 順序に基づかせつつ、他の~size範囲に対しては, `order$p を利用して視覚的な呈示~順序を決定するなど。 ◎ Since most of the time, reordering should affect all screen ranges as well as navigation and speech order, the tool would perform drag-and-drop reordering at the DOM layer. In some cases, however, the author may want different visual orderings per screen size. The tool could offer this functionality by using order together with media queries, but also tie the smallest screen size’s ordering to the underlying DOM order (since this is most likely to be a logical linear presentation order) while using order to determine the visual presentation order in other size ranges.
上述のようにする~toolであれば,適合的であろうが、~drag-and-dropによる並替えを取扱うときに `order$p のみを利用する~toolは,(その方が実装は~~簡単かもしれないが)適合的でないことになる。 ◎ This tool would be conformant, whereas a tool that only ever used order to handle drag-and-drop reordering (however convenient it might be to implement it that way) would be non-conformant.
注記: [ ~browser, ~access可能にする技術, 拡張 ]も含め,~UAは、空間的~navi特色機能を提供してよい。 この節は、そのような空間的~navi~modeにおける要素の順序付けを `order$p ~propも加味して決定することを制止するものではない — ~~実際、そのような特色機能が働くためには必要と見なされている。 が、考慮する必要がある~CSS~propは, `order$p のみに限られない(それは、首たる~propですらない)。 きちんと実装された空間的~navi特色機能は、~CSSの~layout特色機能のうち,空間的な関係性を改変するものすべてを考慮する必要がある。 ◎ Note: User agents, including browsers, accessible technology, and extensions, may offer spatial navigation features. This section does not preclude respecting the order property when determining element ordering in such spatial navigation modes; indeed it would need to be considered for such a feature to work. But order is not the only (or even the primary) CSS property that would need to be considered for such a spatial navigation feature. A well-implemented spatial navigation feature would need to consider all the layout features of CSS that modify spatial relationships.
6. ~flex~line
`~flex容器$内の一連の`~flex駒$は、一連の `~flex~line@ ( “行” )の中へ,~lay-outされ, 整列される — ~layout~algoにおいては,仮の容器が ~group分けと整列に利用される。 ~flex容器は、 `flex-wrap$p ~propに依存して,`単-~line$にも`複-~line$にもなり得る。 ◎ Flex items in a flex container are laid out and aligned within flex lines, hypothetical containers used for grouping and alignment by the layout algorithm. A flex container can be either single-line or multi-line, depending on the flex-wrap property:
- `単-~line@ `~flex容器$(すなわち, `flex-wrap$p が `nowrap^v にされたもの)は、そのすべての子を,それらの内容が~overflowするかどうかに関わらず, 単独の~line内に~lay-outする。 ◎ A single-line flex container (i.e. one with flex-wrap: nowrap) lays out all of its children in a single line, even if that would cause its contents to overflow.
- `複-~line@ `~flex容器$(すなわち, `flex-wrap$p が[ `wrap^v / `wrap-reverse^v ]にされたもの)は、その一連の`~flex駒$を,既存の~lineに収めるには幅が広過ぎるときには,~textが改行で折返されるのと同様に, 複数の~lineに分断する†。 追加の一連の~lineが作成される際には、 `flex-wrap$p ~propに則って,それらは~flex容器の中で `交叉-軸$沿いに堆積されていく。 ~flex容器~自身が完全に空でない限り、どの~lineも, 1 個以上の`~flex駒$を包含する。 【† 1 本の~lineに収まるときでも、後述されるように,単-~lineと異なる扱いになる。】 ◎ A multi-line flex container (i.e. one with flex-wrap: wrap or flex-wrap: wrap-reverse) breaks its flex items across multiple lines, similar to how text is broken onto a new line when it gets too wide to fit on the existing line. When additional lines are created, they are stacked in the flex container along the cross axis according to the flex-wrap property. Every line contains at least one flex item, unless the flex container itself is completely empty.
次の例に,横方向に収まり切らず 複数~lineに折返される, 4 個のボタンを示す: ◎ This example shows four buttons that do not fit side-by-side horizontally, and therefore will wrap into multiple lines.
#flex { `display$p:flex; `flex-flow$p:row_wrap; `width$p:300px; } .item { `width$p:80px; }
<div id="flex"> <div class="item">1</div> <div class="item">2</div> <div class="item">3</div> <div class="item">4</div> </div>
容器は 300px 幅なので、単独の~lineには 3 個までの駒しか収まらない。 それらは 240px を占め,残りの空間に 60px が残される。 `flex-flow$p ~propの値には,`複-~line$ ~flex容器を指定する, `wrap$v:fw ~keywordが現れているので、~flex容器は,最後の駒を包含するための追加の~lineを作成することになる。 ◎ Since the container is 300px wide, only three of the items fit onto a single line. They take up 240px, with 60px left over of remaining space. Because the flex-flow property specifies a multi-line flex container (due to the wrap keyword appearing in its value), the flex container will create an additional line to contain the last item.
内容が一連の~lineに分断されたなら,各~lineは独立に~lay-outされる。 `~flex可能な長さ$, および `justify-content$p, `align-self$p ~propは、個別の~lineごとにその一連の駒に対し~~適用される。 ◎ Once content is broken into lines, each line is laid out independently; flexible lengths and the justify-content and align-self properties only consider the items on a single line at a time.
`複-~line$ ~flex容器においては(~lineが 1 本だけであっても)、各~lineの`交叉size$は,その~line上の一連の`~flex駒$を( `align-self$p による整列の後で)包含するために必要な最小の~sizeになり、一連の~lineは, `align-content$p ~propにより ~flex容器~内で整列される。 `単-~line$ ~flex容器においては、その~lineの`交叉size$は ~flex容器の`交叉size$になり, `align-content$p の効果はない。 ~lineの`主size$は,~flex容器の内容~boxの`主size$と常に同じになる。 ◎ In a multi-line flex container (even one with only a single line), the cross size of each line is the minimum size necessary to contain the flex items on the line (after alignment due to align-self), and the lines are aligned within the flex container with the align-content property. In a single-line flex container, the cross size of the line is the cross size of the flex container, and align-content has no effect. The main size of a line is always the same as the main size of the flex container’s content box.
すべての~flex駒に `flex$p:auto が与えられていることを除いて,前と同じにされている例を、次に示す。 最初の~lineには残りの空間が 60px あり, そのすべての駒に同じ~flex性が備わるので、~line上の 3 個の駒それぞれは,余った横幅から 20px ずつ受取る結果, 100px 幅になる。 残る 1 個の駒はそれのみで~lineを占め,その~lineの横幅~全体, すなわち 300px まで伸張されることになる。 ◎ Here’s the same example as the previous, except that the flex items have all been given flex: auto. The first line has 60px of remaining space, and all of the items have the same flexibility, so each of the three items on that line will receive 20px of extra width, each ending up 100px wide. The remaining item is on a line of its own and will stretch to the entire width of the line, i.e. 300px.
7. ~flex性
~flex~layoutには、一連の`~flex駒$を “~flex” にして、`主~次元$において`可用な空間$を埋めるために,それらの横幅/縦幅を改めることを可能にする能を定義する側面がある。 これは, `flex$p ~propを通して行われる。 ~flex容器は、自身を埋めるように,その駒たちに自由空間を(`~flex伸長-係数$に比例する分だけ)配分するか、または,自身を~overflowしないように駒たちを(各~駒の`~flex縮短-係数$に比例する分だけ)縮短する。 ◎ The defining aspect of flex layout is the ability to make the flex items “flex”, altering their width/height to fill the available space in the main dimension. This is done with the flex property. A flex container distributes free space to its items (proportional to their flex grow factor) to fill the container, or shrinks them (proportional to their flex shrink factor) to prevent overflow.
`~flex駒$は、[ `flex-grow$p, `flex-shrink$p ]いずれの値も 0 ならば `全部的に~flex不能@ とされ,そうでないならば `~flex可能@ とされる。 ◎ A flex item is fully inflexible if both its flex-grow and flex-shrink values are zero, and flexible otherwise.
7.1. `flex^p 略式~prop
◎名 `flex@p ◎値 `none$v:f | [ <‘`flex-grow$p’> <‘`flex-shrink$p’>? || <‘`flex-basis$p’> ] ◎初 `0 1 auto^v ◎適 `~flex駒$ ◎継 されない ◎百 個々の~propを見よ ◎算 個々の~propを見よ ◎順 文法に従う ◎ア 個々の~propを見よ ◎表終`flex$p ~propは、次の成分からなる `~flex可能な長さ@ を指定する:
- `~flex伸長-係数$, `~flex縮短-係数$ — これらは、 `~flex係数@ と総称される。
- `~flex基底s$
~boxが`~flex駒$である場合、その`主size$の決定には,`主size~prop$の代わりに `flex$p にあたる。 ~boxが`~flex駒$でない場合、 `flex$p の効果はない。
◎ The flex property specifies the components of a flexible length: the flex factors (grow and shrink) and the flex basis. When a box is a flex item, flex is consulted instead of the main size property to determine the main size of the box. If a box is not a flex item, flex has no effect.- <‘`flex-grow$p’>
- この `number^t 成分は、 `flex-grow$p 下位propを設定して, `~flex伸長-係数@ を指定する。 それは、~flex容器の中で正の自由空間が配分される際に, `~flex駒$が他の一連の`~flex駒$に比して どれだけ伸長することになるのかを決定する。 省略されたときは、 `1^v に設定される。 ◎ This <number> component sets flex-grow longhand and specifies the flex grow factor, which determines how much the flex item will grow relative to the rest of the flex items in the flex container when positive free space is distributed. When omitted, it is set to 1.
-
0 〜 1 の合間の~flex値には、ある特別な挙動がある: 同じ~line上にある駒たちの~flex値の総和が 1 に満たない場合、それらが占める自由空間は 100% に満たなくなる。 ◎ Flex values between 0 and 1 have a somewhat special behavior: when the sum of the flex values on the line is less than 1, they will take up less than 100% of the free space.
駒の `flex-grow$p 値は、実質的に自由空間の比例分を要請する — 値 `1^v は “自由空間 の 100%” を意味する。 ある~line上の駒たちが要請している自由空間が,合計で 100% を超える場合、互いの比を保ちながら正確に 100% を利用し尽くすように,振り分け直される — 一方で 100% を下回る場合(それぞれが `flex-grow$p:.25 にされた 3 個の駒がある場合など)、各~駒は正確に要請した分だけ取得する(各~駒は自由空間の 25% を取得し,残る 25% は埋められない)。 自由空間がどう配分されるかの正確な詳細は、 ~flex可能な長さの解決-法 を見よ。 ◎ An item’s flex-grow value is effectively a request for some proportion of the free space, with 1 meaning “100% of the free space”; then if the items on the line are requesting more than 100% in total, the requests are rebalanced to keep the same ratio but use up exactly 100% of it. However, if the items request less than the full amount (such as three items that are each flex-grow: .25) then they’ll each get exactly what they request (25% of the free space to each, with the final 25% left unfilled). See §9.7 Resolving Flexible Lengths for the exact details of how free space is distributed.
この~patternは、 `flex-grow$p が 0 に近づくときの挙動を連続的にするために要求される(すなわち、駒は自由空間をまったく占めなくなることが求められる)。 さもなければ、駒は `flex-grow$p が `0^v にどこまで近づこうが — `1^v のときと同じく — 自由空間すべてを占め, 0 に十分~近くなった所で,いきなり,まったく占めなくなる。 この挙動があれば、 `flex-grow$p が `1^v から下へ縮短するに伴い[ 駒が占める自由空間は、次第に減り, 0 の所で無くなる ]ように滑らかに遷移することになる。 ◎ This pattern is required for continuous behavior as flex-grow approaches zero (which means the item wants none of the free space). Without this, a flex-grow: 1 item would take all of the free space; but so would a flex-grow: 0.1 item, and a flex-grow: 0.01 item, etc., until finally the value is small enough to underflow to zero and the item suddenly takes up none of the free space. With this behavior, the item instead gradually takes less of the free space as flex-grow shrinks below 1, smoothly transitioning to taking none of the free space at zero.
作者は、この “部分的に埋める” 挙動が特定的に欲されない限り, 1 以上の値を貫き続けるべきである。 例えば `1^v, `2^v を利用する方が `.33^v, `.67^v を利用するより,通例的に良い — その方が、駒が追加-/除去されたり, ~lineが折返されたときにも,意図される挙動が保たれると見込まれるので。 ◎ Unless this “partial fill” behavior is specifically what’s desired, authors should stick to values ≥ 1; for example, using 1 and 2 is usually better than using .33 and .67, as they’re more likely to behave as intended if items are added, removed, or line-wrapped.
- <‘`flex-shrink$p’>
- この `number^t 成分は、 `flex-shrink$p 下位propを設定して, `~flex縮短-係数@ を指定する。 それは、~flex容器の中で負の自由空間が配分される際に, `~flex駒$が他の一連の`~flex駒$に比して どれだけ縮短することになるのかを決定する。 省略されたときは、 `1^v に設定される。 負の自由空間を配分する際には、`~flex縮短-係数$は,`~flex基底s$で乗算される。 ◎ This <number> component sets flex-shrink longhand and specifies the flex shrink factor, which determines how much the flex item will shrink relative to the rest of the flex items in the flex container when negative free space is distributed. When omitted, it is set to 1.
- 注記: 負の空間を配分する際には、`~flex縮短-係数$は,`~flex基底~size$で乗算されることに注意。 これにより、負の空間は,駒が縮短できる量に比例するように配分され、例えば,大きい駒が~~相当に縮短されない限り,小さい駒が 0 まで縮短されないようにする。 ◎ Note: The flex shrink factor is multiplied by the flex base size when distributing negative space. This distributes negative space in proportion to how much the item is able to shrink, so that e.g. a small item won’t shrink to zero before a larger item has been noticeably reduced.
- <‘`flex-basis$p’>
- この成分は、 `flex-basis$p 下位propを設定して, `~flex基底s@ を指定する。 それは、一連の~flex係数に則って自由空間が配分される前の,`~flex駒$の初期`主size$を与える。 ◎ This component sets the flex-basis longhand, which specifies the flex basis: the initial main size of the flex item, before free space is distributed according to the flex factors.
-
この成分は、 `width$p, `height$p ~propと同じ値を受容する(ただし, `auto$v:fb の扱いは異なる)ことに加えて,~keyword `content$v:fb も受容する: ◎ <‘flex-basis’> accepts the same values as the width and height properties (except that auto is treated differently) plus the content keyword:
- `auto@v:fb
- ~flex駒にこの~keywordが指定された場合、 `flex-basis$p の使用値は,`主size~prop$の値から~~取得される。 その値も `~autoS$v である場合の使用値は, `content$v:fb になる。 ◎ When specified on a flex item, the auto keyword retrieves the value of the main size property as the used flex-basis. If that value is itself auto, then the used value is content.
- `content@v:fb
- `~flex駒$の内容に基づく自動的~size( 詳細は`~flex~layout~algo$を見よ )を指示する(概して,`最大-内容~size$に等価になるが、[ 縦横比, 内在的~sizing拘束, 直交~flow ]を取扱うための調整も伴う)。 ◎ Indicates an automatic size based on the flex item’s content. (It is typically equivalent to the max-content size, but with adjustments to handle aspect ratios, intrinsic sizing constraints, and orthogonal flows; see details in §9 Flex Layout Algorithm.)
- 注記: この値は、この仕様の初期~releaseには無かったものであり,一部の古い実装では~supportされない。 等価な効果は、`主size~prop$ に `~autoS$v をあてがった上で, `auto^v を利用して得られる。 ◎ Note: This value was not present in the initial release of Flexible Box Layout, and thus some older implementations will not support it. The equivalent effect can be achieved by using auto together with a main size (width or height) of auto.
- <‘`width$p’>
- 他のすべての値に対しては、 `width$p, `height$p に対するときと同じ仕方で解決される。 ◎ For all other values, flex-basis is resolved the same way as for width and height.
- `flex$p 略式~propから省略された場合の指定値は、 `0^v になる。 ◎ When omitted from the flex shorthand, its specified value is 0.
- `none@v:f
- ~keyword `none$v:f は,`0 0 auto^v に展開される。 ◎ The keyword none expands to 0 0 auto.
`flex$p の個々の成分の初期値による値は、 `flex$p:0_1_auto に等価になる。 ◎ The initial values of the flex components are equivalent to flex: 0 1 auto.
注記: `flex$p 略式~propから省略されたときの, `flex-grow$p, `flex-basis$p の初期値は、いずれも,それらの個別の下位propの既定~値とは異なる。 これは、最も共通的な事例に,`flex$p 略式~propがより良く適応できるようにするために、そのようにされている。 ◎ Note: The initial values of flex-grow and flex-basis are different from their defaults when omitted in the flex shorthand. This is so that the flex shorthand can better accommodate the most common cases.
[ 2 個の~flex係数 ]が前置されていない,単位の無い 0 は、~flex係数として解釈され~MUST。 誤解釈や無効な宣言を避けるため、作者は,単位を伴う 0 <‘`flex-basis$p’> 成分を指定するか, あるいは その前に 2 個の~flex係数を置か~MUST。 ◎ A unitless zero that is not already preceded by two flex factors must be interpreted as a flex factor. To avoid misinterpretation or invalid declarations, authors must specify a zero <‘flex-basis’> component with a unit or precede it by two flex factors.
7.1.1. 基本的な `flex^p 値
~INFORMATIVE以下に、最も共通的に欲される効果を表現する, 4 種の `flex$p 値による効果を要約する: ◎ The list below summarizes the effects of the four flex values that represent most commonly-desired effects:
- `flex$p:initial
- `flex$p:0_1_auto に等価(これが初期値)。 駒を,その `width$p / `height$p ~propに基づいて~sizeする。 (駒の`主size~prop$が `~autoS$v に算出される場合、これは,その駒をその内容に基づいて~sizeすることになる。) 正の自由空間があるときは,~flex駒を~flex不能にする一方で、空間が足りないときは,その最小~sizeへの縮短-を許容する。 整列~能や `~auto_v~margin$を利用すれば、一連の~flex駒を`主-軸$沿いに整列させられる。 ◎ Equivalent to flex: 0 1 auto. (This is the initial value.) Sizes the item based on the width/height properties. (If the item’s main size property computes to auto, this will size the flex item based on its contents.) Makes the flex item inflexible when there is positive free space, but allows it to shrink to its minimum size when there is insufficient space. The alignment abilities or auto margins can be used to align flex items along the main axis.
- `flex$p:auto
- `flex$p:1_1_auto に等価。 駒を,その `width$p / `height$p ~propに基づいて駒を~sizeしつつ、`主-軸$沿いの自由空間を吸収させるために,それらを全部的に~flex可能にする。 どの駒も, `flex$p が[ `auto^v, `initial^v, `none^v ]のいずれかである場合、それらの駒が~sizeされた後の正の自由空間は, `flex$p:auto を伴う駒に均等に配分されることになる。 ◎ Equivalent to flex: 1 1 auto. Sizes the item based on the width/height properties, but makes them fully flexible, so that they absorb any free space along the main axis. If all items are either flex: auto, flex: initial, or flex: none, any positive free space after the items have been sized will be distributed evenly to the items with flex: auto.
- `flex$p:none
- `flex$p:0_0_auto に等価。 この値は、 `width$p / `height$p ~propに則って駒を~sizeしつつ,~flex駒を`全部的に~flex不能$にする。 これは、~overflowが生じる状況~下でも 一連の~flex駒に対する縮短-が許容されないことを除いて, `initial$v と同様になる。 ◎ Equivalent to flex: 0 0 auto. This value sizes the item according to the width/height properties, but makes the flex item fully inflexible. This is similar to initial, except that flex items are not allowed to shrink, even in overflow situations.
- `flex$p: `positive-number^t
- flex: `positive-number^t `1 0^v に等価。 ~flex駒を~flex可能にして,`~flex基底s$を 0 に設定する。 その結果、駒は,指定された比例分による[ ~flex容器の中の自由空間 ]を受取る。 ~flex容器の中のすべての駒が この~patternを利用している下での,それらの~sizeは、~flex係数に指定された値に比例するようになる。 ◎ Equivalent to flex: <positive-number> 1 0. Makes the flex item flexible and sets the flex basis to zero, resulting in an item that receives the specified proportion of the free space in the flex container. If all items in the flex container use this pattern, their sizes will be proportional to the specified flex factor.
既定では、~flex駒がその内容の最小~size(単語や固定~sizeの要素の最大の長さ)を下回るまで縮短することはない。 この挙動を変えるには、 `min-width$p や `min-height$p ~propを設定する( ~flex駒の自動的な最小~size 節を見よ)。 ◎ By default, flex items won’t shrink below their minimum content size (the length of the longest word or fixed-size element). To change this, set the min-width or min-height property. (See §4.5 Automatic Minimum Size of Flex Items.)
7.2. ~flex性の各~成分
~flex性の個々の成分は,下位propにより独立に制御できる。 ◎ Individual components of flexibility can be controlled by independent longhand properties.
作者には、 `flex$p 略式~propを利用して ~flex性を制御することが奨励される — その各種~下位propを直に利用するのでなく。 この略式~propは、`共通的な用途$に適応するように,未指定の成分を正しく再設定するので。 ◎ Authors are encouraged to control flexibility using the flex shorthand rather than with its longhand properties directly, as the shorthand correctly resets any unspecified components to accommodate common uses.
7.2.1 `flex-grow^p ~prop
◎名 `flex-grow@p ◎値 `number$t ◎初 `0^v ◎適 `~flex駒$ ◎継 されない ◎百 受容しない ◎算 指定値 ◎順 文法に従う ◎ア `実数として$ ◎表終作者には、 `flex-grow$p を直に利用せずに, `flex$p 略式~propを利用して ~flex性を制御することが奨励される。 この略式~propは、`共通的な用途$に適応するように,未指定の成分を正しく再設定するので。 ◎ Authors are encouraged to control flexibility using the flex shorthand rather than with flex-grow directly, as the shorthand correctly resets any unspecified components to accommodate common uses.
- `number$t
- `flex-grow$p ~propは、`~flex伸長-係数$を 供された `number^t に設定する。 負~数は無効。 ◎ The flex-grow property sets the flex grow factor to the provided <number>. Negative numbers are invalid.
7.2.2 `flex-shrink^p ~prop
◎名 `flex-shrink@p ◎値 `number$t ◎初 `1^v ◎適 `~flex駒$ ◎継 されない ◎百 受容しない ◎算 指定値 ◎順 文法に従う ◎ア `実数として$ ◎表終作者には、 `flex-shrink$p を直に利用せずに, `flex$p 略式~propを利用して ~flex性を制御することが奨励される。 この略式~propは、`共通的な用途$に適応するように,未指定の成分を正しく再設定するので。 ◎ Authors are encouraged to control flexibility using the flex shorthand rather than with flex-shrink directly, as the shorthand correctly resets any unspecified components to accommodate common uses.
- `number$t
- `flex-shrink$p ~propは、`~flex縮短-係数$を 供された `number^t に設定する。 負~数は無効。 ◎ The flex-shrink property sets the flex shrink factor to the provided <number>. Negative numbers are invalid.
7.2.3 `flex-basis^p ~prop
◎名 `flex-basis@p ◎値 `content$v:fb | <‘`width$p’> ◎初 `auto$v:fb ◎適 `~flex駒$ ◎継 されない ◎百 `~flex容器$の内縁 `主size$に相対的 ◎ relative to the flex container’s inner main size ◎算 指定値 — ただし,長さは絶対化される。 ◎ as specified, with lengths made absolute ◎順 文法に従う ◎ア ~keyword値に対しては離散的。 他の場合は `長さ, 百分率, または calc 式として$ ◎ discrete for keywords, otherwise as length, percentage, or calc ◎表終作者には、 `flex-basis$p を直に利用せずに, `flex$p 略式~propを利用して ~flex性を制御することが奨励される。 この略式~propは、`共通的な用途$に適応するように,未指定の成分を正しく再設定するので。 ◎ Authors are encouraged to control flexibility using the flex shorthand rather than with flex-basis directly, as the shorthand correctly resets any unspecified components to accommodate common uses.
`flex-basis$p ~propは、`~flex基底s$を設定する。 それは `width$p / `height$p ~propと同じ範囲の値に加えて,値 `content$v:fb も受容する。 ◎ The flex-basis property sets the flex basis. It accepts the same values as the width and height property, plus content.
上に定義された `auto$v:fb, `content$v:fb 以外のすべての値に対しては、横書き書字modeの下では, `flex-basis$p は `width$p と同じ仕方で解決される `CSS21$r 。 ただし、値が `width$p 用の `~autoS$v に解決される場合は,代わりに `flex-basis$p 用の `content$v:fb に解決される。 例えば、 `flex-basis$p に対する百分率~値は,~flex駒の包含塊(すなわち,その~flex容器)を基準に解決され、包含塊の~sizeが`不定$である場合の `flex-basis$p の使用値は, `content$v:fb になる。 別の~~帰結として、 `box-sizing$p など 他から指定されない限り, `flex-basis$p は内容~boxの~sizeを決定する。 ◎ For all values other than auto and content (defined above), flex-basis is resolved the same way as width in horizontal writing modes [CSS21], except that if a value would resolve to auto for width, it instead resolves to content for flex-basis. For example, percentage values of flex-basis are resolved against the flex item’s containing block (i.e. its flex container); and if that containing block’s size is indefinite, the used value for flex-basis is content. As another corollary, flex-basis determines the size of the content box, unless otherwise specified such as by box-sizing [CSS3UI].
8. 整列
~flex容器の内容がそれらの~flex処理を終えて,すべての~flex駒について 両~次元とも【~flex~sizeを】決着させたなら、それらは,~flex容器~内で整列できるようになる。 ◎ After a flex container’s contents have finished their flexing and the dimensions of all flex items are finalized, they can then be aligned within the flex container.
`margin$p ~propを,塊~layoutの下で~marginが行えるものに類似しつつ, より強力な方式で駒を整列させるために利用できる。 `~flex駒$はまた、 Box Alignment 仕様 `CSS-ALIGN-3$r による`整列~prop$も~~尊守する — これにより,`主-軸$, `交叉-軸$ いずれについても、~keywordに基づく駒の整列は容易に可能になる。 これらの~propは、[ CSS 2.1 の下では非常に困難であった,縦横 両~方向の中央~寄せ ]なども含む,共通的にある型の整列を自明なものにする。 ◎ The margin properties can be used to align items in a manner similar to, but more powerful than, what margins can do in block layout. Flex items also respect the alignment properties from CSS Box Alignment, which allow easy keyword-based alignment of items in both the main axis and cross axis. These properties make many common types of alignment trivial, including some things that were very difficult in CSS 2.1, like horizontal and vertical centering.
注記: この節に述べる各種~整列~propは, Box Alignment 仕様に定義されているが、仕様の策定を遅らせないため,この仕様では、規範的な依存関係は作成せずに,関連する部分の定義を ここに再現する。 これらの~propは、 Box Alignment Level 3 が策定を終え, 他の~layout~mode用の効果を定義するまでは、~flex~layoutにのみ適用される。 加えて、Box Alignment ~moduleに定義される新たな値は,~flex~layoutにも適用される — 言い換えれば、 Box Alignment ~moduleが完了した時点で,ここでの定義に取って代わることになる。 ◎ Note: While the alignment properties are defined in CSS Box Alignment [CSS-ALIGN-3], Flexible Box Layout reproduces the definitions of the relevant ones here so as to not create a normative dependency that may slow down advancement of the spec. These properties apply only to flex layout until CSS Box Alignment Level 3 is finished and defines their effect for other layout modes. Additionally, any new values defined in the Box Alignment module will apply to Flexible Box Layout; in otherwords, the Box Alignment module, once completed, will supercede the definitions here.
8.1. `auto^v ~marginによる整列-法
この節は参考である。 ~marginが~flex駒にどのように影響するかについての規範的な定義は、 `~flex~layout~algo$ 節にて与えられる。 ◎ This section is non-normative. The normative definition of how margins affect flex items is in the Flex Layout Algorithm section.
~flex駒~上の自動( `auto^en )~marginの効果は、塊~flowの下での自動~marginととてもよく似る: ◎ Auto margins on flex items have an effect very similar to auto margins in block flow:
- ~flex基底s, ~flex可能な長さの計算を行う間は, 自動~marginは `0^v に扱われる。 ◎ During calculations of flex bases and flexible lengths, auto margins are treated as 0.
- `justify-content$p, `align-self$p による整列に先立って, 正の自由空間は、その次元に属する自動~marginに配分される。 ◎ Prior to alignment via justify-content and align-self, any positive free space is distributed to auto margins in that dimension.
- ~overflowする一連の~boxは、それらの`終端$方向の 自動~margin, ~overflow を無視する。 ◎ Overflowing boxes ignore their auto margins and overflow in the end direction.
注記: 自由空間が自動~marginに配分される場合、各種 `整列~prop$による,その次元に対する効果はなくなる。 ~flex処理の後に残される自由空間すべては、~marginにより奪われることになるので。 ◎ Note: If free space is distributed to auto margins, the alignment properties will have no effect in that dimension because the margins will have stolen all the free space left over after flexing.
`auto^v ~marginの用途の一つに、一連の~flex駒を,主-軸の中で 別々の “一連の~group” に分けることが挙げられる。 これを利用して、共通的な~UI~pattern — 左端に整列されるものと, 右端に整列されるものに分けられた,いくつかの~actionからなる単独の~bar — を再現する例を次に示す: ◎ One use of auto margins in the main axis is to separate flex items into distinct "groups". The following example shows how to use this to reproduce a common UI pattern - a single bar of actions with some aligned on the left and others aligned on the right.
nav > ul { `display$p:flex; } nav > ul > #login { `margin-left$p:auto; }
<nav> <ul> <li><a href=/about>About</a> <li><a href=/projects>Projects</a> <li><a href=/interact>Interact</a> <li id="login"><a href=/login>Login</a> </ul> </nav>
~overflowが生じる状況~下で、`~auto_v~margin$を利用した場合と, 整列~prop を利用した場合との間の,交叉-軸~沿いの整列の相違を下の図に示す: ◎ The figure below illustrates the difference in cross-axis alignment in overflow situations between using auto margins and using the alignment properties.
8.2. 主-軸~沿いの整列: `justify-content^p ~prop
◎名 `justify-content@p ◎値 `flex-start$v:j | `flex-end$v:j | `center$v:j | `space-between$v:j | `space-around$v:j ◎初 `flex-start$v:j ◎適 `~flex容器$ ◎継 されない ◎百 受容しない ◎算 指定値 ◎順 文法に従う ◎ア 離散的 ◎表終`justify-content$p ~propは、~flex容器の現在の~lineの`主-軸$沿いに,`~flex駒$を整列する。 これは、~flex可能な長さおよび`~auto_v~margin$が解決された後に行われる。 これは概して、~line上の`~flex駒$すべてについて,それぞれが[ ~flex不能, または ~flex可能であるが その最大~sizeに到達している ]ときの,残されて余った 自由空間の配分を補助する。 それはまた、~lineを~overflowする駒の整列について、ある程度の制御を~~供する。 ◎ The justify-content property aligns flex items along the main axis of the current line of the flex container. This is done after any flexible lengths and any auto margins have been resolved. Typically it helps distribute extra free space leftover when either all the flex items on a line are inflexible, or are flexible but have reached their maximum size. It also exerts some control over the alignment of items when they overflow the line.
- `flex-start@v:j
- `~flex駒$は~lineの始端に寄せるように収納される: ~line上の最初の`~flex駒$の`主-始端$ ~margin辺は,~lineの`主-始端$辺に接合され、後続の各`~flex駒$は,先行する駒に接合される。 ◎ Flex items are packed toward the start of the line. The main-start margin edge of the first flex item on the line is placed flush with the main-start edge of the line, and each subsequent flex item is placed flush with the preceding item.
- `flex-end@v:j
- `~flex駒$は~lineの終端に寄せるように収納される: ~line上の最後の`~flex駒$の`主-始端$ ~margin辺は,~lineの`主-終端$辺に接合され、先行する各`~flex駒$は,後続の駒に接合される。 ◎ Flex items are packed toward the end of the line. The main-end margin edge of the last flex item is placed flush with the main-end edge of the line, and each preceding flex item is placed flush with the subsequent item.
- `center@v:j
- `~flex駒$は~lineの中央に寄せるように収納される: ~line上の一連の`~flex駒$は、互いに接合された上で、[ ~lineの`主-始端$辺と~line上の最初の駒との間 ], および[ ~lineの`主-終端$辺と~line上の最後の駒との間 ]の空間が等量になるように,~lineの中央に寄せるように整列される。 (残された自由空間が負の場合、`~flex駒$は両~方向に等しく~overflowすることになる。) ◎ Flex items are packed toward the center of the line. The flex items on the line are placed flush with each other and aligned in the center of the line, with equal amounts of space between the main-start edge of the line and the first item on the line and between the main-end edge of the line and the last item on the line. (If the leftover free-space is negative, the flex items will overflow equally in both directions.)
- `space-between@v:j
- `~flex駒$は~line内に均等に分布される: 残された自由空間が負の場合,あるいは ~line上に在る`~flex駒$ が 1 個だけの場合、この値の効果は `flex-start$v:j と一致する。 他の場合、~line上の[ 最初/最後 ]の`~flex駒$の[ `主-始端$/`主-終端$ ]~margin辺が,~lineの[ `主-始端$/`主-終端$ ]辺に接合され、~line上の残りの`~flex駒$については,隣接する 2 つの駒の間隔がすべて一致するように,自由空間が配分される。 ◎ Flex items are evenly distributed in the line. If the leftover free-space is negative or there is only a single flex item on the line, this value is identical to flex-start. Otherwise, the main-start margin edge of the first flex item on the line is placed flush with the main-start edge of the line, the main-end margin edge of the last flex item on the line is placed flush with the main-end edge of the line, and the remaining flex items on the line are distributed so that the spacing between any two adjacent items is the same.
- `space-around@v:j
- 一連の`~flex駒$は、両端には半分~sizeの空間を伴う様に,~line内に均等に分布される: 残された自由空間が負であるか, または ~line上に在る`~flex駒$が 1 個だけの場合、この値の効果は `center$v:j と一致する。 他の場合、~line上の隣接するどの 2 つの`~flex駒$の間隔も同じ~sizeになり,その半分~sizeが[ ~line上の[ 最初/最後 ]の`~flex駒$と[ `~flex容器$辺 ]との間隔 ]に一致するように、自由空間が配分される。 ◎ Flex items are evenly distributed in the line, with half-size spaces on either end. If the leftover free-space is negative or there is only a single flex item on the line, this value is identical to center. Otherwise, the flex items on the line are distributed such that the spacing between any two adjacent flex items on the line is the same, and the spacing between the first/last flex items and the flex container edges is half the size of the spacing between flex items.
8.3. 交叉-軸~沿いの整列: `align-items^p と `align-self^p ~prop
◎名 `align-items@p ◎値 `flex-start$v:ais | `flex-end$v:ais | `center$v:ais | `baseline$v:ais | `stretch$v:ais ◎初 `stretch$v:ais ◎適 `~flex容器$ ◎継 されない ◎百 受容しない ◎算 指定値 ◎順 文法に従う ◎ア 離散的 ◎表終 ◎名 `align-self@p ◎値 `auto$v:as | `flex-start$v:ais | `flex-end$v:ais | `center$v:ais | `baseline$v:ais | `stretch$v:ais ◎初 `auto$v:as ◎適 `~flex駒$ ◎継 されない ◎百 受容しない ◎算 指定値 ◎順 文法に従う ◎ア 離散的 ◎表終~flex容器の~lineの中の一連の`~flex駒$は、方向が垂直にされることを除いて `justify-content$p と同様に,~lineの`交叉-軸$~~方向に整列させることができる。 `align-items$p は、匿名`~flex駒$も含め,~flex容器のすべての`~flex駒$用の既定の整列を設定する。 `align-self$p は、この既定の整列を,個々の`~flex駒$について上書きできるようにする。 (匿名~flex駒に対しては、 `align-self$p は,それに結び付けられている~flex容器~上の `align-items$p の値に常に合致する。) ◎ Flex items can be aligned in the cross axis of the current line of the flex container, similar to justify-content but in the perpendicular direction. align-items sets the default alignment for all of the flex container’s items, including anonymous flex items. align-self allows this default alignment to be overridden for individual flex items. (For anonymous flex items, align-self always matches the value of align-items on their associated flex container.)
`~flex駒$の交叉-軸~marginが両側とも `auto^v である場合、 `align-self$p の効果はない。 ◎ If either of the flex item’s cross-axis margins are auto, align-self has no effect.
各種~値の意味は、次で与えられる: ◎ Values have the following meanings:
- `auto@v:as
- `交叉-軸$の整列~制御を,親~box上の `align-items$p の値に委ねる。 (これが `align-self$p の初期値。) ◎ Defers cross-axis alignment control to the value of align-items on the parent box. (This is the initial value of align-self.)
- `flex-start@v:ais
- `~flex駒$の`交叉-始端$ ~margin辺は,~lineの`交叉-始端$辺に接合される。 ◎ The cross-start margin edge of the flex item is placed flush with the cross-start edge of the line.
- `flex-end@v:ais
- `~flex駒$の`交叉-終端$ ~margin辺は,~lineの`交叉-終端$辺に接合される。 ◎ The cross-end margin edge of the flex item is placed flush with the cross-end edge of the line.
- `center@v:ais
- `~flex駒$の~margin~boxは,~line内の`交叉-軸$の中で中央~寄せにされる。 ( ~flex~lineの`交叉size$が`~flex駒$のそれより小さい場合、 それは両~方向に等しく~overflowすることになる。 ) ◎ The flex item’s margin box is centered in the cross axis within the line. (If the cross size of the flex line is less than that of the flex item, it will overflow equally in both directions.)
- `baseline@v:ais
- `~flex駒$は `基底線~整列に関与-@ する — すなわち、~line上の,関与しているすべての`~flex駒$は、それらの基底線が互いに整列するように, かつ それらのうち[[[ 自身の[ 基底線と[ `交叉-始端$ ~margin辺 ]]の間の距離 ]が最~大になる駒 ]が,~lineの`交叉-始端$ 辺に接合される ]ように,整列される。 整列する軸に基底線を持たない`~flex駒$の基底線は、その~border~boxから`合成-$されるとする。 ◎ The flex item participates in baseline alignment: all participating flex items on the line are aligned such that their baselines align, and the item with the largest distance between its baseline and its cross-start margin edge is placed flush against the cross-start edge of the line. If the item does not have a baseline in the necessary axis, then one is synthesized from the flex item’s border box.
- `stretch@v:ais
- `交叉size~prop$が `~autoS$v に算出され, かつ 交叉-軸~marginの両側とも非 `auto^v の場合、`~flex駒$は `伸張-@ される。 その場合の使用値は,[ `min-height$p / `min-width$p / `max-height$p / `max-width$p ]により課される拘束の下で,[ その駒の~margin~boxの`交叉size$が,その~lineと同じ~sizeに可能な限り近くされる ]ような長さになる。 ◎ If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched. Its used value is the length necessary to make the cross size of the item’s margin box as close to the same size as the line as possible, while still respecting the constraints imposed by min-height/min-width/max-height/max-width.
- 注記: ~flex容器の縦幅が拘束されている場合、この値により,`~flex駒$の内容が駒を~overflowさせ得る。 ◎ Note: If the flex container’s height is constrained this value may cause the contents of the flex item to overflow the item.
- `~flex駒$の`交叉-始端$~margin辺は,その~lineの`交叉-始端$辺に接合される。 ◎ The cross-start margin edge of the flex item is placed flush with the cross-start edge of the line.
8.4. 一連の~flex~lineの収納-法: `align-content^p ~prop
◎名 `align-content@p ◎値 `flex-start$v:ac | `flex-end$v:ac | `center$v:ac | `space-between$v:ac | `space-around$v:ac | `stretch$v:ac ◎初 `stretch$v:ac ◎適 `複-~line$ `~flex容器$ ◎継 されない ◎百 受容しない ◎算 指定値 ◎順 文法に従う ◎ア 離散的 ◎表終`align-content$p ~propは、`交叉-軸$に余った空間があるときに,~flex容器の一連の~lineを~flex容器の中で整列する — `justify-content$p が個々の駒を`主-軸$の中で整列するときと同様に。 この~propは,`単-~line$ ~flex容器に対しては 効果はないことに注意。 各種~値の意味は,次で与えられる: ◎ The align-content property aligns a flex container’s lines within the flex container when there is extra space in the cross-axis, similar to how justify-content aligns individual items within the main-axis. Note, this property has no effect on a single-line flex container. Values have the following meanings:
- `flex-start@v:ac
- 一連の~lineは,~flex容器の始端に寄せるように収納される: ~flex容器の中の最初の~lineの`交叉-始端$辺は,~flex容器の`交叉-始端$辺に接合され、後続の各~lineは,先行する~lineに接合される。 ◎ Lines are packed toward the start of the flex container. The cross-start edge of the first line in the flex container is placed flush with the cross-start edge of the flex container, and each subsequent line is placed flush with the preceding line.
- `flex-end@v:ac
- 一連の~lineは,~flex容器の終端に寄せるように収納される: ~flex容器の中の最後の~lineの`交叉-終端$辺は,~flex容器の`交叉-終端$辺に接合され、後続の各~lineは,先行する~lineに接合される。 ◎ Lines are packed toward the end of the flex container. The cross-end edge of the last line is placed flush with the cross-end edge of the flex container, and each preceding line is placed flush with the subsequent line.
- `center@v:ac
- 一連の~lineは,~flex容器の中央に寄せるように収納される: ~flex容器の中の一連の~lineは、互いに接合された上で,~flex容器の中央に整列される —[ ~flex容器の`交叉-始端$内容~辺と ~flex容器の最初の~lineとの合間, ], および[ ~flex容器の`交叉-終端$内容~辺と ~flex容器の最後の~lineとの合間 ]の空間が等量になるように(残された自由空間が負の場合,一連の~lineは両~方向に等しく~overflowすることになる)。 ◎ Lines are packed toward the center of the flex container. The lines in the flex container are placed flush with each other and aligned in the center of the flex container, with equal amounts of space between the cross-start content edge of the flex container and the first line in the flex container, and between the cross-end content edge of the flex container and the last line in the flex container. (If the leftover free-space is negative, the lines will overflow equally in both directions.)
- `space-between@v:ac
- 一連の~lineは、~flex容器の中で均等に分布される: 残された自由空間が負の場合, または ~flex容器~内の~flex~lineが 1 本だけの場合、この値の効果は, `flex-start$v:ac と一致する。 他の場合、~flex容器の中の[ 最初/最後 ]の~lineの[ `交叉-始端$/`交叉-終端$ ]辺が,~flex容器の[ `交叉-始端$/`交叉-終端$ ]内容~辺に接合され,~flex容器の中の残りの~lineについては,隣接するどの 2 本の~lineの間隔も同じになるように、自由空間が配分される。 ◎ Lines are evenly distributed in the flex container. If the leftover free-space is negative or there is only a single flex line in the flex container, this value is identical to flex-start. Otherwise, the cross-start edge of the first line in the flex container is placed flush with the cross-start content edge of the flex container, the cross-end edge of the last line in the flex container is placed flush with the cross-end content edge of the flex container, and the remaining lines in the flex container are distributed so that the spacing between any two adjacent lines is the same.
- `space-around@v:ac
- 一連の`~flex駒$は、両端には半分~sizeの空間を伴う様に,~flex容器の中で均等に分布される: 残された自由空間が負である場合、この値の効果は `center$v:ac と一致する。 他の場合、~flex容器の中の一連の~lineは[ 隣接するどの 2 本の~lineの間隔も同じ~sizeになり,その半分~sizeが[[ 最初/最後 ]の~lineと[ `~flex容器$辺 ]との間隔 ]になるように、自由空間が配分される。 ◎ Lines are evenly distributed in the flex container, with half-size spaces on either end. If the leftover free-space is negative this value is identical to center. Otherwise, the lines in the flex container are distributed such that the spacing between any two adjacent lines is the same, and the spacing between the first/last lines and the flex container edges is half the size of the spacing between flex lines.
- `stretch@v:ac
- 一連の~lineは、残りの空間を占めるように伸張される: 残された自由空間が負の場合,この値の効果は `flex-start$v:ac に一致する。 他の場合、自由空間は,すべての~lineの合間が等しくになるように分割された上で それらの交叉sizeを増大させる。 ◎ Lines stretch to take up the remaining space. If the leftover free-space is negative, this value is identical to flex-start. Otherwise, the free-space is split equally between all of the lines, increasing their cross size.
注記: `複-~line$~flex容器のみが、`交叉-軸$~~方向に自由空間を持ち,一連の~lineは その中で整列されることになる。 `単-~line$~flex容器における唯一の~lineは,空間を埋めるために自動的に伸張されるので。 ◎ Note: Only multi-line flex containers ever have free space in the cross-axis for lines to be aligned in, because in a single-line flex container the sole line automatically stretches to fill the space.
8.5. ~flex容器の基底線
`~flex容器$自身 — 以下,単に %容器 と記す — を`基底線~整列に関与-$させるためには(例: %容器 が,外縁の`~flex容器$内の`~flex駒$であるとき)、自身の内容を最も良く表現するような基底線の位置を %容器 に提出させる必要がある。 この~~目的において, %容器 の`基底線~集合$は、( `order$p による並替えの後, かつ `flex-direction$p も織り込んだ上で,)以下に従って決定される基底線 %整列~基底線 から`生成される$ — 以下 “/” は同順とする: ◎ In order for a flex container to itself participate in baseline alignment (e.g. when the flex container is itself a flex item in an outer flex container), it needs to submit the position of the baselines that will best represent its contents. To this end, the baselines of a flex container are determined as follows (after reordering with order, and taking flex-direction into account):
- `主-軸 基底線~集合@ 【主-軸に平行な基底線~集合】 ◎ first/last main-axis baseline set
-
%容器 の[ `行内-軸$と`主-軸$ ]が合致する場合、 %容器 の[ 最初/最後 ]の`主-軸 基底線~集合$は,次に従って決定される: ◎ When the inline axis of the flex container matches its main axis, its baselines are determined as follows:
-
%容器 内に次をいずれも満たすような`~flex駒$は在るならば:
-
[ 最始端/最終端 ]の`~flex~line$に配置される
【 “最始端” / “最終端” は、おそらく~layout後の位置を意味する。 したがって,原文には記述がないが、 `flex-wrap$p により指定される堆積~方向も織り込まれることになるはず。 】
- `基底線~整列に関与-$する
そのような駒たちが共有する`整列~基底線$が %整列~基底線 を与える。
◎ If any of the flex items on the flex container’s startmost/endmost flex line participate in baseline alignment, the flex container’s first/last main-axis baseline set is generated from the shared alignment baseline of those flex items. -
-
他の場合, %容器 内に`~flex駒$はあるならば、[ それらのうち[ 最始端/最終端 ]の駒 ] %駒 が[ %容器 の`主-軸$に平行な`整列~基底線$ ]を:
- 持つならば、それが %整列~基底線 を与える。
- 持たないならば、 %駒 の~border~boxから`合成-$される`整列~基底線$が %整列~基底線 を与える。
- 他の場合, %容器 は[ 最初/最後 ]の`基底線~集合$を持たない — この場合 ⇒ %容器 が属する`整列~文脈$の規則に則って`合成-$した結果が %整列~基底線 を与える。 ◎ Otherwise, the flex container has no first/last main-axis baseline set, and one is synthesized if needed according to the rules of its alignment context.
-
- `交叉-軸 基底線~集合@ 【交叉-軸に平行な基底線~集合】 ◎ first/last cross-axis baseline set
-
%容器 の[ `行内-軸$と`交叉-軸$ ]が合致する場合、 %容器 の[ 最初/最後 ]の`交叉-軸 基底線~集合$は、次に従って決定される: ◎ When the inline axis of the flex container matches its cross axis, its baselines are determined as follows:
-
%容器 内に`~flex駒$はあるならば、[ それらのうち[ 最始端/最終端 ]の駒 ] %駒 が[ %容器 の`交叉-軸$に平行な`整列~基底線$ ]を:
- 持つならば、それが %整列~基底線 を与える。
- 持たないならば、 %駒 の~border~boxから`合成-$される`整列~基底線$が %整列~基底線 を与える。
- 他の場合, %容器 は[ 最初/最後 ]の`基底線~集合$を持たない — この場合 ⇒ %容器 が属する`整列~文脈$の規則に則って`合成-$した結果が %整列~基底線 を与える。 ◎ Otherwise, the flex container has no first/last cross-axis baseline set, and one is synthesized if needed according to the rules of its alignment context.
-
上述の規則に則って基底線を計算する際に,基底線を供与している~boxの `overflow$p が~scrollを許容する値にされている場合、その基底線を決定する目的においては,その~boxは初期~scroll位置にあるものと扱われ~MUST。 ◎ When calculating the baseline according to the above rules, if the box contributing a baseline has an overflow value that allows scrolling, the box must be treated as being in its initial scroll position for the purpose of determining its baseline.
~table~cellの基底線の決定 の際には、行l~boxや `table-row^v `CSS21$r のときとちょうど同じ様に,~flex容器が基底線を供する。 ◎ When determining the baseline of a table cell, a flex container provides a baseline just as a line box or table-row does. [CSS21]
基底線についての詳細は、 CSS Writing Modes 3 の 基底線 — 序論, および CSS Alingment Module の 基底線~整列の詳細 各~節を見よ。 ◎ See CSS Writing Modes 3 §4.1 Introduction to Baselines and CSS Box Alignment 3 §9 Baseline Alignment Details for more information on baselines.
9. ~flex~layout~algo
この節には、~flex容器とその内容の正確な~layoutの挙動について詳細を述べる,規範的な~algoが含められている。 ~algoは,可読性と理論的簡潔さを最適化するように書かれているので、効率的とは限らない。 実装は,実際の~algoに何を利用してもよいが、ここに述べる~algoと同じ結果を生産し~MUST。 ◎ This section contains normative algorithms detailing the exact layout behavior of a flex container and its contents. The algorithms here are written to optimize readability and theoretical simplicity, and may not necessarily be the most efficient. Implementations may use whatever actual algorithms they wish, but must produce the same results as the algorithms described here.
注記: この節は、~~主に実装者~向けに意図されている。 ~web頁~作者にとっては、一般に,個々の~propの記述にて十分になるべきであり、~CSS~layoutについての深い詳細を理解する強い~~動機がない限り,この節を読む必要はない。 ◎ Note: This section is mainly intended for implementors. Authors writing web pages should generally be served well by the individual property descriptions, and do not need to read this section unless they have a deep-seated urge to understand arcane details of CSS layout.
以下の下位~節にて,~flex容器とその内容を~lay-outするための~algoを定義する。 ◎ The following sections define the algorithm for laying out a flex container and its contents.
注記: ~flex~layoutは、論理~文書順ではなく `改変文書順$の下で,`~flex駒$たちに対し働く。 ◎ Note: Flex layout works with the flex items in order-modified document order, not their original document order.
【 以下の~algoの中の, ~IF, ~ELSE 等の記号の意味や定義の詳細は,~SYMBOL_DEF_REFを~~参照。 】
【 以下に現れる[ “内縁( `inner^en )〜~size” / “外縁( `outer^en )〜~size” ]は、`~boxの寸法$にて定義される~boxの[ 内容~辺 / ~margin辺 ]が成す区画の~sizeを指す。 これは、 `box-sizing$p ~propからも影響され得る。 】
9.1. 初期設定
- ~flex駒 節の記述に従って, 一連の匿名~flex駒を生成する。 ◎ Generate anonymous flex items as described in §4 Flex Items.
9.2. ~line長さの決定
-
( [ 主, 交叉 ]沿いのそれぞれについて,一連の~flex駒に可用な空間を決定する ) ◎ Determine the available main and cross space for the flex items.\
`~flex容器$ %容器 の内容に`可用な空間$は、それぞれの次元について,次に従って与えられる: ◎ For each dimension,\
- ~IF[ %容器 の内容~boxの~sizeは、その次元において`確定的$である ] ⇒ その~size。 ◎ if that dimension of the flex container’s content box is a definite size, use that;\
- ~ELIF[ %容器 の内容~boxは、その次元において[ `最小-内容 拘束$または`最大-内容 拘束$ ]の下で~sizeされている ] ⇒ その拘束として与えられる。 ◎ if that dimension of the flex container is being sized under a min or max-content constraint, the available space in that dimension is that constraint;\
-
~ELSE ⇒ その次元において、 %容器 に`可用な空間$から %容器 の[ ~margin + ~border + ~padding ]の分を減算した結果の値。 この値は無限にもなり得る。 ◎ otherwise, subtract the flex container’s margin, border, and padding from the space available to the flex container in that dimension and use that value. This might result in an infinite value.
例えば,[ `~autoS$v に~sizeされていて, `浮動-$している`~flex容器$ ]の中の~flex駒に`可用な空間$は【横組の下では】: ◎ For example, the available space to a flex item in a floated auto-sized flex container is:
- 横~次元においては: ( `~flex容器$の包含塊の横幅 ) − ( `~flex容器$の横~次元の[ ~margin + ~border + ~padding ] ) ◎ the width of the flex container’s containing block minus the flex container’s margin, border, and padding in the horizontal dimension
- 縦~次元においては:無限 ◎ infinite in the vertical dimension
-
( ~flex駒の`~flex基底~size$を決定する )
各 `~flex駒$ %駒 の `~flex基底~size@ は、次の手続きの結果で与えられる:
◎ Determine the flex base size and hypothetical main size of each item:- ~IF[ %駒 の使用`~flex基底s$は`確定的$である ] ⇒ ~RET その~size ◎ If the item has a definite used flex basis, that’s the flex base size.
-
~IF[ %駒 は次のいずれも満たす ]…: ◎ If the flex item has ...
- 内在的~縦横比を有する ◎ an intrinsic aspect ratio,
- 使用`~flex基底s$ ~EQ `content$v:fb ◎ a used flex basis of content, and
- `交叉size$は`確定的$である ◎ a definite cross size,
…ならば ⇒ ~RET %駒 の内縁 `交叉size$に %駒 の内在的~縦横比で乗除算して,主~次元に換算した結果 ◎ then the flex base size is calculated from its inner cross size and the flex item’s intrinsic aspect ratio.
-
~IF[ %駒 の使用`~flex基底s$ ~EQ `content$v:fb ]~OR[ %駒 の使用`~flex基底s$は %駒 に`可用な空間$に依存する ]: ◎ ↓
- ~IF[ ~flex容器は[ `最小-内容 拘束$または`最大-内容 拘束$ ]の下で~sizeされている(例えば 自動的~table~layout `CSS21$r を遂行するとき) ] ⇒ ~RET %駒 をその拘束の下で~sizeした結果の, %駒 の`主size$ ◎ If the used flex basis is content or depends on its available space, and the flex container is being sized under a min-content or max-content constraint (e.g. when performing automatic table layout [CSS21]), size the item under that constraint. The flex base size is the item’s resulting main size.
-
~ELSE(すなわち, %駒 に可用な主sizeは無限であり, %駒 の`行内-軸$は`主-軸$に平行である) ⇒ ~RET [ %駒 を直交~flow下にある~box用の規則 `CSS3-WRITING-MODES$r ]を利用して~lay-outした結果の, %駒 の最大-内容 `主size$ ◎ Otherwise, if the used flex basis is content or depends on its available space, the available main size is infinite, and the flex item’s inline axis is parallel to the main axis, lay the item out using the rules for a box in an orthogonal flow [CSS3-WRITING-MODES]. The flex base size is the item’s max-content main size.
注記: この事例は,例えば、横書き`書字mode$の英語~文書が包含している~col~flex容器が,縦書き日本語`~flex駒$を包含しているときに生じる。 ◎ Note: This case occurs, for example, in an English document (horizontal writing mode) containing a column flex container containing a vertical Japanese (vertical writing mode) flex item.
-
%駒 の使用`~flex基底s$を %駒 の`主size$に利用する下で, %駒 を`可用な空間$の中で~sizeする — ここで:
- `~flex基底s$に対する値 `content$v:fb は `max-content$v と見なす
- `主size$を決定する際に`交叉size$が必要であり(例えば %駒 の`主size$が %駒 の塊-軸に沿うとき), かつ[ %駒 の交叉sizeが `auto$v:fb であって,`確定的$でない ]ならば、 %駒 の`交叉size$には `fit-content^v を利用する
~RET ~sizeした結果の %駒 の`主size$
◎ Otherwise, size the item into the available space using its used flex basis in place of its main size, treating a value of content as max-content. If a cross size is needed to determine the main size (e.g. when the flex item’s main size is in its block axis) and the flex item’s cross size is auto and not definite, in this calculation use fit-content as the flex item’s cross size. The flex base size is the item’s resulting main size.
`~flex基底~size$を決定するときは、 %駒 の[ `最小-主size$, `最大-主size$ ]は無視される(切詰めは生じない)。 加えて、 `box-sizing$p を適用するときに内容~boxの~sizeを 0 以上に切上げる計算も無視される。 (例えば、駒に[ ~size 0, 正の~padding, `box-sizing$p:border-box ]が指定されている場合、駒の外縁`~flex基底~size$は 0 になる結果,その内縁`~flex基底~size$は負になる。) ◎ When determining the flex base size, the item’s min and max main sizes are ignored (no clamping occurs). Furthermore, the sizing calculations that floor the content box size at zero when applying box-sizing are also ignored. (For example, an item with a specified size of zero, positive padding, and box-sizing: border-box will have an outer flex base size of zero—and hence a negative inner flex base size.)
-
( ~flex駒の`仮の主size$を決定する )
各 `~flex駒$ %駒 の `仮の主size@ は、次で与えられる ⇒ %駒 の`~flex基底~size$を %駒 の使用[ `最小-主size$, `最大-主size$ ]に則って(および,内容~boxの~sizeは 0 以上に切上げるように)切詰めた結果
◎ The hypothetical main size is the item’s flex base size clamped according to its used min and max main sizes (and flooring the content box size at zero). -
( ~flex容器の`主size$を決定する )
`~flex容器$の`主size$を、それが関与する整形~文脈の規則を利用して決定する — この算出にあたっては、~flex駒に対する `auto^v ~marginは `0^v とみなすとする。
◎ Determine the main size of the flex container using the rules of the formatting context in which it participates. For this computation, auto margins on flex items are treated as 0.
9.3. 主sizeの決定
-
一連の~flex~lineの中に,~flex駒を収集する : ◎ Collect flex items into flex lines:
- ~flex容器は`単-~line$ならば
- すべての~flex駒を単独の~flex~lineに収集する ◎ If the flex container is single-line, collect all the flex items into a single flex line.
- ~flex容器は`複-~line$ならば
- まだ未収集の最初の駒から順に,連続する駒を,[ 収集される 次の 駒が,~flex容器の内縁 主sizeに収まらないような最初のものになる ]まで, または[ 強制分断に遭遇する( ~flex~layoutの断片化 節を見よ) ]まで、順次 収集していく。 ただし,いきなり最初の未収集の駒が収まり切らないようであれば、単に,それのみを~~現在の~lineに収集する。 ◎ Otherwise, starting from the first uncollected item, collect consecutive items one by one until the first time that the next collected item would not fit into the flex container’s inner main size (or until a forced break is encountered, see §10 Fragmenting Flex Layout). If the very first uncollected item wouldn’t fit, collect just it into the line.
- この段においては、~flex駒の~sizeは,その外縁 `仮の主size$とする。 ◎ For this step, the size of a flex item is its outer hypothetical main size.
- すべての~flex駒が,一連の~flex~lineに収集されるまで、上を繰り返す。 ◎ Repeat until all flex items have been collected into flex lines.
- 注記: “可能な限り収集する” ことにより、~size 0 の~flex駒は,最後の非 0 ~sizeの駒が~lineを正確に “埋尽くして” いたとしても,前の~lineの終端に収集されることになる。 ◎ Note that the "collect as many" line will collect zero-sized flex items onto the end of the previous line even if the last non-zero item exactly "filled up" the line.
- ~flex可能な長さを解決-して( 9.7 節)、すべての~flex駒について,その使用`主size$を見出す。 ◎ Resolve the flexible lengths of all the flex items to find their used main size. See §9.7 Resolving Flexible Lengths.
9.4. 交叉sizeの決定
-
( 駒の`仮の交叉size$を決定する )
各~駒の `仮の交叉size@ を、[ `~autoS$v は `fit-content^v であると見なした下で,`可用な空間$において使用`主size$による~layoutを遂行する ]ことにより,決定する
◎ Determine the hypothetical cross size of each item by performing layout with the used main size and the available space, treating auto as fit-content. -
( 各~flex~lineの交叉sizeを計算する ): ◎ Calculate the cross size of each flex line.
- ~IF[ ~flex容器は`単-~line$である ]~AND[ ~flex容器の`交叉size$は`確定的$である ] ⇒ ~flex~lineの`交叉size$ ~SET `~flex容器$の内縁 `交叉size$ ◎ If the flex container is single-line and has a definite cross size, the cross size of the flex line is the flex container’s inner cross size.
-
~IF[ `~flex容器$は`複-~line$である ]: ◎ Otherwise, for each flex line:
-
~EACH( `~flex~line$ %~line ) に対し:
- ( %交叉size, %上面~size, %下面~size ) ~LET ( 0, 0, 0 )
-
%~line 内の ~EACH( `~flex駒$ %駒 ) に対し:
-
~IF[ %駒 は次をすべて満たす ]…:
- 行内-軸は主-軸に平行である
- `align-self$p は `baseline$v:ais
- 交叉-軸~marginは両側とも非 `auto^v
…ならば:
- %上面~size ~SET `max^op( %上面~size, %駒 の基底線と %駒 の仮の外縁 交叉-始端~辺との合間の距離 )
- %下面~size ~SET `max^op( %下面~size, %駒 の基底線と %駒 の仮の外縁 交叉-終端~辺との合間の距離 )
- ~ELSE ⇒ %交叉size ~SET `max^op( %交叉size, %駒 の外縁 `仮の交叉size$ )
-
- %~line の使用~交叉size は次で与えられる ⇒ `max^op( %交叉size, ( %上面~size ~PLUS %下面~size ) ) ◎ The used cross-size of the flex line is the largest of the numbers found in the previous two steps and zero.
-
- ~IF[ ~flex容器は`単-~line$である ] ⇒ その~lineの~交叉sizeを 容器の算出d[ `最小-交叉size$, `最大-交叉size$ ]で切詰める。 CSS 2.1 による `min/max-width/height^p の定義が より一般に適用される場合、この挙動は自動的に `fall out^en することに注意【?】。 ◎ If the flex container is single-line, then clamp the line’s cross-size to be within the container’s computed min and max cross sizes. Note that if CSS 2.1’s definition of min/max-width/height applied more generally, this behavior would fall out automatically.
-
( `align-content^p:stretch を取扱う ) ◎ Handle 'align-content: stretch'.\
~IF[ ~flex容器は次をすべて満たす ]…:
- 交叉sizeは`確定的$である
- `align-content$p は `stretch$v:ac
- 内縁 交叉size ~GT 一連の~flex~lineの交叉sizeの総和
…ならば ⇒ 各~flex~lineの交叉sizeを,次が満たされるように等量に増大させる ⇒ すべての~flex~lineの交叉sizeの総和 ~EQ ~flex容器の内縁 交叉size ◎ increase the cross size of each flex line by equal amounts such that the sum of their cross sizes exactly equals the flex container’s inner cross size.
-
( `visibility^p:collapse にされている駒を`畳む$ ) ◎ Collapse visibility:collapse items.\
~IF[ `visibility$p:collapse にされている~flex駒はある ]: ◎ If any flex items have visibility: collapse,\
- そのような ~EACH ( %駒 )に対し ⇒ %駒 の `支柱~size@ ~SET %駒 が属する~lineの交叉size ◎ note the cross size of the line they’re in as the item’s strut size, and\
-
~layoutを最初から再開始する — この 2 周目の~layout回においては: ◎ restart layout from the beginning. ◎ In this second layout round,\
- 駒を一連の~lineに収集する段においては ⇒ `畳まれ$た駒の`主size$は, 0 として扱う ◎ when collecting items into lines, treat the collapsed items as having zero main size.\
- 前項の段から 各~lineの交叉sizeを計算する段までは ⇒ `畳まれ$た駒については,まるごと( `display$p:none であったかのように)無視する ◎ For the rest of the algorithm following that step, ignore the collapsed items entirely (as if they were display:none) except that\
- 前項より後の段においては ⇒ 各~lineの交叉sizeを[ その~line内の`畳まれ$た すべての駒の中で最~大の支柱~size ]以上になる様に切り上げる。 ◎ after calculating the cross size of the lines, if any line’s cross size is less than the largest strut size among all the collapsed items in the line, set its cross size to that strut size.
2 周目の~layout回においては,この段は飛ばす。 ◎ Skip this step in the second layout round.
-
( 各~flex駒の使用~交叉sizeを決定する ) ◎ Determine the used cross size\
~EACH( `~flex駒$ %駒 ) に対し: ◎ of each flex item.\
-
~IF[ %駒 は次をすべて満たす ]…:
- `align-self$p:stretch にされている
- `交叉size~prop$の算出値は `~autoS$v
- 交叉-軸~marginは両側とも非 `auto^v
…ならば ⇒ %駒 の使用(外縁)交叉size ~SET [ %駒 が属する~flex~lineの使用~交叉size ]を %駒 の使用[ `最小-交叉size$, `最大-交叉size$ ]に則って切詰めた結果
◎ If a flex item has align-self: stretch, its computed cross size property is auto, and neither of its cross-axis margins are auto, the used outer cross size is the used cross size of its flex line, clamped according to the item’s used min and max cross sizes.\ - ~ELSE ⇒ %駒 の使用~交叉size ~SET %駒 の`仮の交叉size$ ◎ Otherwise, the used cross size is the item’s hypothetical cross size.
- ~IF[ %駒 は `align-self$p:stretch にされている ] ⇒ ~sizeが百分率の子を解決できるようにするため、前~段で得られた使用~sizeを %駒 の確定的な交叉sizeとみなす下で, %駒 の内容の~layoutをやり直す ◎ If the flex item has align-self: stretch, redo layout for its contents, treating this used size as its definite cross size so that percentage-sized children can be resolved.
注記: この段は %駒 の`主size$には影響しない。 それが内在的~縦横比を有していたとしても。 ◎ Note that this step does not affect the main size of the flex item, even if it has an intrinsic aspect ratio.
-
9.5. 主-軸~沿いの整列
-
( 自由空間を配分する ) ◎ Distribute any remaining free space.\
~EACH( ~flex~line %~line ) に対し: ◎ For each flex line:
- %自由空間 ~LET `max^op( %~line の自由空間, 0 ) ◎ ↓
- ~IF[ %~line の主-軸~marginは両側とも `auto^v ] ⇒ 両側の~margin ~SET %自由空間 ~DIV 2 ◎ If the remaining free space is positive and at least one main-axis margin on this line is auto, distribute the free space equally among these margins.\ ◎ Otherwise, set all auto margins to zero.
- ~ELIF[ %~line の主-軸~marginは片側だけ `auto^v ] ⇒ その~~側の~margin ~SET %自由空間 ◎ ↑
- %~line 内の一連の駒を, `justify-content$p に従って主-軸~沿いに整列させる ◎ Align the items along the main-axis per justify-content.
9.6. 交叉-軸~沿いの整列
-
( 交叉-軸 `auto^v ~marginを解決する )
この段における[ 始端 / 終端 ]は、`交叉-軸$における[ `始端$/`終端$ ]を指すとする。
~EACH( ~flex駒 %駒 ) に対し:
◎ Resolve cross-axis auto margins.\- ~IF[ %駒 の交叉-軸~marginは両側とも非 `auto^v ] ⇒ ~CONTINUE ◎ If a flex item has auto cross-axis margins:
- %交叉size ~LET %駒 が属する~flex~lineの交叉size ◎ ↓
- %差分~size ~LET %交叉size − [ `auto^v ~marginは 0 とみなす下での, %駒 の外縁 交叉size ] ◎ ↓
- ~IF[ %差分~size ~GT 0 ] ⇒ %駒 の[ 始端, 終端 ]~marginのうち `auto^v にされている各側に, %差分~size を等量に配分する ◎ If its outer cross size (treating those auto margins as zero) is less than the cross size of its flex line, distribute the difference in those sizes equally to the auto margins.
- ~ELIF[ %駒 の始端~margin は `auto^v ] ⇒ %駒 の始端~margin ~SET 0 ◎ Otherwise, if the block-start or inline-start margin (whichever is in the cross axis) is auto, set it to zero.\
-
%駒 の終端~marginを [ %駒 の外縁 交叉size ~EQ %交叉size ]になるように設定する
【 原文の記述は、前~段の条件が満たされる場合に限り,この段を行うようにも読め、はっきりしない。 】
◎ Set the opposite margin so that the outer cross size of the item equals the cross size of its flex line.
-
( %駒 を交叉-軸~沿いに整列する )
~EACH( ~flex駒 %駒 ) に対し ⇒ ~IF[ %駒 の交叉-軸~marginは両側とも非 `auto^v ] ⇒ %駒 の `align-self$p に従って, %駒 を交叉-軸~沿いに整列する
◎ Align all flex items along the cross-axis per align-self, if neither of the item’s cross-axis margins are auto. -
( ~flex容器の使用~交叉sizeを決定する ) ◎ Determine the flex container’s used cross size:
~flex容器の使用~交叉size ~SET[ `交叉size~prop$の~sizeは `確定的$ならば それ / ~ELSE_ 一連の~flex~lineの交叉sizeの総和 ]を,`~flex容器$の使用[ `最小-交叉size$, `最大-交叉size$ ]で切詰めた結果 ] ◎ If the cross size property is a definite size, use that, clamped by the used min and max cross sizes of the flex container. ◎ Otherwise, use the sum of the flex lines' cross sizes, clamped by the used min and max cross sizes of the flex container.
-
( すべての~flex~lineを整列する )
~flex容器~内のすべての~flex~lineを,容器の `align-content$p に従って整列する
◎ Align all flex lines per align-content.
9.7. ~flex可能な長さの解決-法
所与の~flex~line上の一連の`~flex駒$(以下,単に “駒” )の~flex可能な長さを,以下に従って解決する。 この~algoにおいては:
- 各~駒の(仮の) `使用~主~size^i は、初期~時は 駒の`仮の主size$に設定されているとする。 各~駒の(実の)使用~主~size — すなわち,駒の`主size~prop$の使用値 — は、この~algoを終えた時点における駒の `使用~主~size^i で与えられる。
- 各~駒は、初期~時は未~凍結とされ,以下のある時点で凍結されることになる。 駒の `使用~主~size^i は、凍結された時点で確定される。
- %容器~size ~LET ~flex容器の内縁 `主size$ ◎ ↓
- %伸縮~mode ~LET [ 各 駒の外縁 `使用~主~size^i の総和 ~LT %容器~size ならば `伸長-^i / ~ELSE_ `縮短-^i ] ⇒ 以下における “駒の `~flex係数^i” は、 %伸縮~mode に応じて[ `伸長-^i ならば 駒の`~flex伸長-係数$ / `縮短-^i ならば 駒の`~flex縮短-係数$ ]を表すとする ◎ Determine the used flex factor. Sum the outer hypothetical main sizes of all items on the line. If the sum is less than the flex container’s inner main size, use the flex grow factor for the rest of this algorithm; otherwise, use the flex shrink factor.
-
( ~flex不能な駒を~sizeする )
次のいずれかを満たすような ~EACH ( %駒 ) を凍結する: ◎ Size inflexible items. Freeze, setting its target main size to its hypothetical main size…
- %駒 の `~flex係数^i ~EQ 0 ◎ any item that has a flex factor of zero
- [ %伸縮~mode ~EQ `伸長-^i ]~AND[ %駒 の`~flex基底~size$ ~GT %駒 の `使用~主~size^i ] ◎ if using the flex grow factor: any item that has a flex base size greater than its hypothetical main size
- [ %伸縮~mode ~EQ `縮短-^i ]~AND[ %駒 の`~flex基底~size$ ~LT %駒 の `使用~主~size^i ] ◎ if using the flex shrink factor: any item that has a flex base size smaller than its hypothetical main size
-
以下において, `残りの自由空間を計算-^i するときは、次を返すとする ⇒ %容器~size − ( すべての駒の,その時点における `外縁~size^i の総和 )
ここで, %駒 の `外縁~size^i は、次で与えられる ⇒ %駒 は未~凍結ならば %駒 の外縁`~flex基底~size$ / ~ELSE_ %駒 の外縁 `使用~主~size^i
◎ Calculate initial free space. Sum the outer sizes of all items on the line, and subtract this from the flex container’s inner main size. For frozen items, use their outer target main size; for other items, use their outer flex base size. - %初期~自由空間 ~LET `残りの自由空間を計算-^i した結果 ◎ ↑
-
~WHILE[ 未~凍結なる駒はある ]: ◎ Loop: ◎ Check for flexible items. If all the flex items on the line are frozen, free space has been distributed; exit this loop.
- %残りの自由空間 ~LET `残りの自由空間を計算-^i した結果 ◎ Calculate the remaining free space as for initial free space, above.\
- %~flex係数の総和 ~LET 未~凍結なるすべての駒の `~flex係数^i の総和 ◎ If the sum of the unfrozen flex items’ flex factors\
-
~IF[ %~flex係数の総和 ~LT 1 ]:
- %上限 ~LET %初期~自由空間 × %~flex係数の総和
- ~IF[ %残りの自由空間 の絶対値 ~GT %上限 の絶対値 ] ⇒ %残りの自由空間 ~SET %上限
-
( ~flex係数に比例するように自由空間を配分する ) ◎ Distribute free space proportional to the flex factors.
~IF[ %残りの自由空間 ~NEQ 0 ]: ◎ If the remaining free space is zero ◎ Do nothing.
- ~IF[ %伸縮~mode ~EQ `伸長-^i ] ⇒ 未~凍結なる ~EACH ( %駒 ) に対し ⇒ %駒 の `使用~主~size^i ~SET %駒 の`~flex基底~size$ ~PLUS ( %残りの自由空間 ~MUL ( ( %駒 の `~flex係数^i ) ~DIV %~flex係数の総和 )) ◎ If using the flex grow factor ◎ Find the ratio of the item’s flex grow factor to the sum of the flex grow factors of all unfrozen items on the line. Set the item’s target main size to its flex base size plus a fraction of the remaining free space proportional to the ratio.
-
~ELSE( %伸縮~mode ~EQ `縮短-^i ):
この段においては、各 駒は `拡縮済み~flex縮短-係数@i を持つ。
- 未~凍結なる ~EACH ( %駒 ) に対し ⇒ %駒 の `拡縮済み~flex縮短-係数^i ~SET ( %駒 の `~flex係数^i ) ~MUL ( %駒 の内縁`~flex基底~size$ )
- %係数の総和 ~LET 未~凍結なる すべての %駒 の `拡縮済み~flex縮短-係数^i の総和
- 未~凍結なる ~EACH ( %駒 ) に対し ⇒ %駒 の `使用~主~size^i ~SET ( %駒 の`~flex基底~size$ ) ~MINUS ( ( %残りの自由空間 の絶対値 ) ~MUL ( ( %駒 の `拡縮済み~flex縮短-係数^i ) ~DIV %係数の総和 ))
注記: これにより、駒の内縁 `主size$は,一時的に負になり得るが,次の段で正される。
◎ If using the flex shrink factor ◎ For every unfrozen item on the line, multiply its flex shrink factor by its inner flex base size, and note this as its scaled flex shrink factor. Find the ratio of the item’s scaled flex shrink factor to the sum of the scaled flex shrink factors of all unfrozen items on the line. Set the item’s target main size to its flex base size minus a fraction of the absolute value of the remaining free space proportional to the ratio. Note this may result in a negative inner main size; it will be corrected in the next step. ◎ Otherwise ◎ Do nothing.
-
( 最小-/最大- 違反を補正する )
未~凍結なる ~EACH ( %駒 ) に対し ⇒ %駒 の `使用~主~size^i ~SET `使用~主~size^i を %駒 の使用[ `最小-主size$, `最大-主size$ ]で — %駒 の内容~boxの~sizeは 0 以上に切上げるように — 切詰めた結果
これにより, %使用~主size が[ 増えた駒は “最小-違反” / 減った駒は “最大-違反” ]とされる。
◎ Fix min/max violations. Clamp each non-frozen item’s target main size by its used min and max main sizes and floor its content-box size at zero. If the item’s target main size was made smaller by this, it’s a max violation. If the item’s target main size was made larger by this, it’s a min violation. -
( ~flexが効き過ぎている駒を凍結する )
未~凍結なる駒のうち,[ 前~段による切詰め量の総和(減った量は負とみなす)に応じて[ 0 ならば すべて / 正ならば 最小-違反とされたもの / 負ならば 最大-違反とされたもの ]を凍結する
◎ Freeze over-flexed items. The total violation is the sum of the adjustments from the previous step ∑(clamped size - unclamped size). If the total violation is: • Zero •• Freeze all items. • Positive •• Freeze all the items with min violations. • Negative •• Freeze all the items with max violations. • Return to the start of this loop. • Set each item’s used main size to its target main size.
9.8. 確定的~size/不定~size
CSS Sizing `CSS-SIZING-3$r では,長さが 確定的 / 不定 であることを定義しているが、 Flexbox においては、長さが `確定的@ と見なされ得る,いくつかの追加の事例がある: ◎ Although CSS Sizing [CSS-SIZING-3] defines definite and indefinite lengths, Flexbox has several additional cases where a length can be considered definite:
- `単-~line$ `~flex容器$の`交叉size$が確定的である場合、`伸張-$されているどの`~flex駒$についても,その外縁 `交叉size$は[ ~flex容器の(`~flex駒$の[ 最小-, 最大- ]`交叉size$に切詰められた)内縁 `交叉size$ ]になり,`確定的$と見なされる。 ◎ If a single-line flex container has a definite cross size, the outer cross size of any stretched flex items is the flex container’s inner cross size (clamped to the flex item’s min and max cross size) and is considered definite.
- `~flex容器$の`主size$は`確定的$である場合、`~flex駒$ %駒 の~flex後の`主size$は`確定的$と扱われる — それが、同じ~line内にある他の~flex駒の`不定$~sizeに依拠できるとしても。 ◎ If the flex container has a definite main size, a flex item’s post-flexing main size is treated as definite, even though it can rely on the indefinite sizes of any flex items in the same line.
- `~flex~line$の`交叉size$が決定されたなら、 `auto^v で~sizeされている`~flex容器$内の各~駒も,~layoutの目的においては確定的と見なされる — 駒の交叉sizeを決定する段 を見よ。 ◎ Once the cross size of a flex line has been determined, items in auto-sized flex containers are also considered definite for the purpose of layout; see step 11.
注記: 駒の~sizeは、駒が`全部的に~flex不能$である, かつ`~flex基底s$は確定的であるならば,定義により`確定的$になる。 ◎ Note: The main size of a fully inflexible item with a definite flex basis is, by definition, definite.
9.9. 内在的~size
`~flex容器$の`内在的~sizing$は、種々の型の 内容に基づく自動的~sizingの基になる — `内容収納~行内~size$(内容収納( fit-content )公式が利用される)や, 内容に基づく`塊~size$(`最大-内容~size$が利用される)など。 ◎ The intrinsic sizing of a flex container is used to produce various types of content-based automatic sizing, such as shrink-to-fit logical widths (which use the fit-content formula) and content-based logical heights (which use the max-content size).
この節に現れる各種~用語については、`CSS-SIZING-3$r を見よ。 ◎ See [CSS-SIZING-3] for a definition of the terms in this section.
9.9.1. ~flex容器の内在的~主size
`~flex容器$ %容器 の`主-軸$沿いの`最大-内容~size$は、[[ %容器 内の一連の`~flex駒$の`最大-内容 供与$fXを,駒の自前の~flex性に許容される限り保守する ]下で, %容器 が占め得る ]ような,最~小の~sizeであり、次に従って計算される: ◎ The max-content main size of a flex container is the smallest size the flex container can take while maintaining the max-content contributions of its flex items, insofar as allowed by the items’ own flexibility:
-
%容器 内の ~EACH( %駒 ) に対し:
- %~flex量 ~SET ( %駒 の`最大-内容 供与$fX ) − ( %駒 の外縁`~flex基底~size$ )
- %駒 の `~flex係数^i ~LET [ %~flex量 ~GTE 0 ならば `max^op( %駒 の `~flex伸長-係数$, 1 ) / ~ELSE_ [ %駒 の`~flex縮短-係数$を 1 以上に切り上げた下での【?】, %駒 の`拡縮済み~flex縮短-係数$i ]
- %駒 の `最大-内容~flex割合分^i ~LET %~flex量 ~DIV %駒 の `~flex係数^i
- %容器 内のすべての`~flex駒$を、長さ無限の~lineたちの中に配置する ◎ Place all flex items into lines of infinite length.
-
%容器 を成す ~EACH( ~line %~line ) に対し, %~line の `~size^i を次に従って計算する: ◎ Within each line,\
- %L ~LET %~line 内に~layoutされる`~flex駒$たちの集合 ◎ ↓
- %最~大~flex割合分 ~LET `max^op( %駒 の `最大-内容~flex割合分^i ; %駒 ~IN %L ) ◎ find the largest max-content flex fraction among all the flex items.\
-
%L 内の各~駒の `~size^i を次に従って計算する:
- %~size ~LET ( %駒 の `~flex係数^i ) ~MUL %最~大~flex割合分 ~PLUS ( %駒 の`~flex基底~size$ )
- %~size ~SET `min^op( %~size, ( %駒 の`最大-主size$ ) )
- %駒 の `~size^i ~LET `max^op( %~size, ( %駒 の`最小-主size$ ) )
- %~line の `~size^i ~LET ∑ %駒 の `~size^i ; %駒 ~IN %L ◎ ↓
- `~flex容器$ %容器 の`最大-内容~size$は、次で与えられる ⇒ `max^op( %~line の `~size^i ; %~line ~IN { %容器 を成す~lineたち } ) ◎ The flex container’s max-content size is the largest sum of the afore-calculated sizes of all items within a single line.
`~flex容器$ %容器 の`主-軸$沿いの`最小-内容~size$は:
- %容器 は`単-~line$ならば:
- [ `~flex駒$の`最小-内容 供与$fXが その`最大-内容 供与$fXに代わって利用される ]ことを除いて, %容器 の`主-軸$沿いの`最大-内容~size$と同じに計算される。
- %容器 は`複-~line$ならば:
- 単に, %容器 内のすべての`~flex駒$による`最小-内容 供与$fXの最~大。
注記: ~flexの総和 ~LT 1 のときにおける,この~algoの含意 ◎ Implications of this algorithm when the sum of flex is less than 1
上の~algoは、次の 2 つの事例に対し,正しい挙動を与えるよう設計されている — 特に 2 つの合間で,`~flex容器$の~sizeが連続的に遷移するようにする: ◎ The above algorithm is designed to give the correct behavior for two cases in particular, and make the flex container’s size continuous as you transition between the two:
- `~flex容器$を成す どの駒も~flex不能な場合、`~flex容器$はそれらの`~flex基底~size$の総和に~sizeされる。 (~flex不能な`~flex基底~size$は、基本的に[ `width$p / `height$p ]の代用になる — それは,指定されていれば、塊~layoutにおいて,`最大-内容 供与$が基づくものを与える。) ◎ If all items are inflexible, the flex container is sized to the sum of their flex base size. (An inflexible flex base size basically substitutes for a width/height, which, when specified, is what a max-content contribution is based on in Block Layout.)
- すべての駒が[ ~flex可能かつ `~flex係数$ ~GTE 1 ]である場合、`~flex容器$は,それを成す駒たちの`最大-内容 供与$の総和に~sizeされる(あるいはおそらく,少し大きい~sizeになる — どの~flex駒も,その`最大-内容 供与$以上の~sizeになるようにしつつ、その~flex性により決定される~sizeの,他の駒の~sizeに対する比率が正しくなるように)。 ◎ When all items are flexible with flex factors ≥ 1, the flex container is sized to the sum of the max-content contributions of its items (or perhaps a slightly larger size, so that every flex item is at least the size of its max-content contribution, but also has the correct ratio of its size to the size of the other items, as determined by its flexibility).
例えば、`~flex容器$を成す`~flex駒$は 1 個だけで, 駒の `flex-basis$p は `100px^v で, 駒の最大-内容~sizeは `200px^v にあるとき、`~flex容器$(および~flex駒)の幅は, 駒の `flex-grow$p に応じて ⇒ `0^v ならば `100px^v になるが、 `1^v 以上ならば `200px^v になる。 ◎ For example, if a flex container has a single flex item with flex-basis: 100px; but a max-content size of 200px, then when the item is flex-grow: 0, the flex container (and flex item) is 100px wide, but when the item is flex-grow: 1 or higher, the flex container (and flex item) is 200px wide.
これらの 2 つの事例 — 特に,ある~line上の駒たちの~flex性の総和が 0 〜 1 の範囲にあるとき — の挙動の合間を総じて連続的にする仕方には,いくつかあるが、そのいずれにも欠点がある。 ここでは,感じられる不良な含意ができるだけ少ないものを選んだが、あいにく[ ~flex性の総和 ~LT 1 ]のときに,~flex性を “二重に適用する” 。 上の例では、駒の `flex-grow$p が `.5^v の場合,`~flex容器$は `150px^v 幅になるが、駒は通常のように可用な空間の中に~sizeされ, `125px^v 幅になる。 ◎ There are several possible ways to make the overall behavior continuous between these two cases, particularly when the sum of flexibilities on a line is between 0 and 1, but all of them have drawbacks. We chose one we feel has the least bad implications; unfortunately, it "double-applies" the flexibility when the sum of the flexibilities is less than 1. In the above example, if the item has flex-grow: .5, then the flex container ends up 150px wide, but the item then sizes normally into that available space, ending up 125px wide.
9.9.2. ~flex容器の内在的~交叉size
`~flex容器$ %容器 の[ `交叉-軸$沿いの`最小-内容~size$ / `交叉-軸$沿いの`最大-内容~size$ ](以下,同順)は、次で与えられる: ◎ ↓
- %容器 は`単-~line$ならば:
- %容器 の各`~flex駒$の[ `最小-内容 供与$ / `最大-内容 供与$ ]の最~大。 ◎ The min-content/max-content cross size of a single-line flex container is the largest min-content contribution/max-content contribution (respectively) of its flex items.
- %容器 は`複-~line$ならば:
- %容器 を`交叉-軸$~~方向の[ `最小-内容 拘束$ / `最大-内容 拘束$ ]の下で~sizeした結果から得られる,すべての~flex~lineの`交叉size$の総和。 ◎ For a multi-line flex container, the min-content/max-content cross size is the sum of the flex line cross sizes resulting from sizing the flex container under a cross-axis min-content constraint/max-content constraint (respectively).\
-
ただし、 %容器 が `flex-flow$p:column_wrap にされている場合、 %容器 は次のように~sizeされる: ◎ However, if the flex container is flex-flow: column wrap;, then\
- 先ず、 %容器 内のすべての`~flex駒$にわたる`交叉-軸$の[ `最小-内容 供与$ / `最大-内容 供与$ ]のうち,最~大のものを見出す。 ◎ it’s sized by first finding the largest min-content/max-content cross-size contribution among the flex items (respectively), then\
- 前~段の結果の~sizeを,~layout時において[ 各`~flex駒$に対し,`交叉-軸$の`可用な空間$ ]に利用する。 ◎ using that size as the available space in the cross axis for each of the flex items during layout.
-
注記: この `column wrap^v にされた`~flex容器$用の経験則は、次をいずれも満たすような,`~flex容器$のあるべき~sizeに対する適度な近似を与えるが: ◎ Note: This heuristic for column wrap flex containers gives a reasonable approximation of the size that the flex container should be, with\
- 各~flex駒の結果の~sizeは ⇒ `min^op( [ その駒の自前の最大-内容~size ], [ すべての駒の最小-内容~sizeのうちの最大 ] ) ◎ each flex item ending up as min(item’s own max-content, maximum min-content among all items), and\
- 各`~flex~line$は、その中の最~大の`~flex駒$より大きくならない。 ◎ each flex line no larger than its largest flex item.\
が、一部の事例では,完璧に収まるものではない。 完全に正しくやるのは,ひどく高価であり、これでも適度に働く。 ◎ It’s not a perfect fit in some cases, but doing it completely correct is insanely expensive, and this works reasonably well.
9.9.3. ~flex駒の内在的~size供与
`~flex駒$ %駒 の主sizeに対する[ `最小-内容 供与$/`最大-内容 供与$ ]は、次に従って与えられる:
- %~size ~LET [ 最小-…/最大-… ]に応じて, %駒 の 外縁[ `最小-内容~size$ / `最大-内容~size$ ]
- %選好~size ~LET %駒 の外縁`選好~size$
- ~IF[ %選好~size は `~autoS$v でない ] ⇒ %~size ~SET `max^op( %~size, %選好~size )
- ~IF[ %駒 は伸長できない【すなわち,`~flex伸長-係数$ ~EQ 0 】 ] ⇒ %~size ~SET `min^op( %~size, %駒 の`~flex基底~size$ )
- ~IF[ %駒 は縮短できない【すなわち,`~flex縮短-係数$ ~EQ 0 】 ] ⇒ %~size ~SET `max^op( %~size, %駒 の`~flex基底~size$ )
- ~RET `max^op( `min^op( %~size, %駒 の`最大-主size$ ), %駒 の`最小-主size$ )
10. ~flex~layoutの断片化-法
~flex容器は、[ 駒どうしの合間 ], あるいは[ (`複-~line$~mode下における)いくつかの駒からなる~lineどうしの合間 ], あるいは[ 駒の内側 ]にて,何~頁かに渡って分断され得る。 各種 `break-*$p ~propは、通常の[ `塊level$/`行内level$ ]の~boxに対するときと同様に,~flex容器にも適用される。 この節では、それらがどのように ~flex駒とその内容に適用されるかを定義する。 より詳しい文脈は `CSS3-BREAK$r を見よ。 ◎ Flex containers can break across pages between items, between lines of items (in multi-line mode), and inside items. The break-* properties apply to flex containers as normal for block-level or inline-level boxes. This section defines how they apply to flex items and the contents of flex items. See the CSS Fragmentation Module for more context [CSS3-BREAK].
以下の分断~処理~規則の下での, “頁” とは、`断片化~容器$を指す。 同じ規則は,他の`断片化~文脈$においても適用される(必要に応じて, “頁” を適切な`断片化~容器$の種別に読み替える)。 可読性のため、この節の用語 “~row”, “~col” は、`~flex容器$ 自身のそれではなく,[ `断片化~文脈$の`塊~flow方向$ ]に相対的な~flex容器の方位を指すとする。 【 “~col” が塊~flow方向】 ◎ The following breaking rules refer to the fragmentation container as the “page”. The same rules apply in any other fragmentation context. (Substitute “page” with the appropriate fragmentation container type as needed.) For readability, in this section the terms "row" and "column" refer to the relative orientation of the flex container with respect to the block flow direction of the fragmentation context, rather than to that of the flex container itself.
~flex容器が断片化されるときの正確な~layoutは、この仕様のこの~levelでは定義されない。 しかしながら,~flex容器の内側における分断には、次の規則が課される(`改変文書順$を利用して解釈する下で): ◎ The exact layout of a fragmented flex container is not defined in this level of Flexible Box Layout. However, breaks inside a flex container are subject to the following rules (interpreted using order-modified document order):
-
~row~flex容器においては: ◎ In a row flex container,\
- ~flex駒~上の[ `break-before$p / `break-after$p ]値は,~flex~lineに伝播する。 ◎ the break-before and break-after values on flex items are propagated to the flex line.\
- [ 最初の~line上の `break-before$p 値 / 最後の~line上の `break-after$p 値 ]は、~flex容器に伝播する。 ◎ The break-before values on the first line and the break-after values on the last line are propagated to the flex container.
注記: 分断の伝播は、`算出値$には影響しない( `text-decoration$p の伝播の様に)。 ◎ Note: Break propagation (like text-decoration propagation) does not affect computed values.
-
~col~flex容器においては: ◎ In a column flex container,\
- [ 最初の駒~上の`break-before$p 値 / 最後の駒~上の`break-after$p 値 ]は、~flex容器に伝播する。 ◎ the break-before values on the first item and the break-after values on the last item are propagated to the flex container.\
- 他の駒~上の強制分断は、その駒~自身に適用される。 ◎ Forced breaks on other items are applied to the item itself.
- ~flex駒の内側の強制分断は、実質的に,その内容の~sizeを増大させる。 それは、他の同胞~駒の内側に強制分断を誘発することはない。 ◎ A forced break inside a flex item effectively increases the size of its contents; it does not trigger a forced break inside sibling items.
-
~row~flex容器においては: ◎ In a row flex container,\
- 一連の同胞~flex~lineの各~合間に, `A類の分断~機会$が生じる。 ◎ Class A break opportunities occur between sibling flex lines, and\
- [[ 最初/最後 ]の~flex~line ]と[ ~flex容器の内容~辺 ]との合間に, `C類の分断~機会$が生じる。 ◎ Class C break opportunities occur between the first/last flex line and the flex container’s content edges.
-
~col~flex容器においては: ◎ In a column flex container,\
- 一連の同胞~flex駒の各~合間に, `A類の分断~機会$が生じる。 ◎ Class A break opportunities occur between sibling flex items, and\
- [ ~line上の[ 最初/最後 ]の~flex駒 ]と[ ~flex容器の内容~辺 ]との合間に `C類の分断~機会$が生じる。 ◎ Class C break opportunities occur between the first/last flex items on a line and the flex container’s content edges. [CSS3-BREAK]
`CSS3-BREAK$r
- ~flex容器が分断の後にも継続されるとき、その`~flex駒$に`可用な空間$は(`断片化~文脈$の塊~flow方向においては),それまでの一連の頁~上の一連の~flex容器~断片に費やされた空間により,節減される。 ~flex容器~断片に費やされる空間が、当の頁~上のその内容~boxの~sizeになる。 この可用な空間の調整の結果が負になった場合、それは 0 に設定される。 ◎ When a flex container is continued after a break, the space available to its flex items (in the block flow direction of the fragmentation context) is reduced by the space consumed by flex container fragments on previous pages. The space consumed by a flex container fragment is the size of its content box on that page. If as a result of this adjustment the available space becomes negative, it is set to zero.
- ~flex容器の最初の断片が頁の上端に来ない, かつ 頁~上の残りの空間に収まる~flex駒はない場合、その断片~全体が次の頁へ移動される。 ◎ If the first fragment of the flex container is not at the top of the page, and none of its flex items fit in the remaining space on the page, the entire fragment is moved to the next page.
- `複-~line$の~col~flex容器が分断されるときは、[ `複柱~容器$を成す各~断片が自前の[ 一連の~col~boxからなる~row ]を持つ ]のと同じ様に,各~断片が自前の[ 一連の~flex~lineからなる, “堆積” ]を持つ。 ◎ When a multi-line column flex container breaks, each fragment has its own "stack" of flex lines, just like each fragment of a multi-column container has its own row of column boxes.
- 以上により課される,一連の駒の配置替えとは別に、~UAは,~flowが断片化されて歪むのをなるべく抑えるため,~flex容器の乱れを最小限に留めるべきである。 ◎ Aside from the rearrangement of items imposed by the previous point, UAs should attempt to minimize distortion of the flex container with respect to unfragmented flow.
10.1. ~flex断片化~algoの見本
この参考節では、~flex容器の断片化~algoとして考え得る見本を示す。 実装者には,この~algoを改良して CSS Working Group まで ~feedbackを寄せられる よう願う。 ◎ This informative section presents a possible fragmentation algorithm for flex containers. Implementors are encouraged to improve on this algorithm and provide feedback to the CSS Working Group.
注記: この~algoは、頁割付処理が常に順方向に進む(後戻りしない)ものと見做している。 したがって、頁割付処理に~~先行する整列は,ほぼ無視される。 より高度な~layout~engineは、複数の断片に渡る整列も加味し得る。 ◎ This algorithm assumes that pagination always proceeds only in the forward direction; therefore, in the algorithms below, alignment is mostly ignored prior to pagination. Advanced layout engines may be able to honor alignment across fragments.
- `単-~line$ ~col~flex容器
-
- ~flex~layout~algoを,`交叉sizeの決定$の所まで実行する(頁割付処理は~~考慮せずに) ◎ Run the flex layout algorithm (without regards to pagination) through Cross Sizing Determination.
- できるだけ多くの(ただし, 1 個以上, またはその断片の)連続する[ ~flex駒 または駒~断片 ]を、最初から順に,頁~上の部屋が尽きるか, または強制分断に遭遇するまで,~lay-outする ◎ Lay out as many consecutive flex items or item fragments as possible (but at least one or a fragment thereof), starting from the first, until there is no more room on the page or a forced break is encountered.
-
~IF[ 前~段により部屋が尽きた ]~AND[ 自由空間は正である ] ⇒ ~UAは,次の分断し得ない[ 駒/断片 ]用の部屋を作るために,この頁~上に配分される自由空間を節減しても~MAY(負にならない所まで)。 ◎ If the previous step ran out of room and the free space is positive, the UA may reduce the distributed free space on this page (down to, but not past, zero) in order to make room for the next unbreakable flex item or fragment.\
~ELSE ⇒ 収まり切らない[ 駒/断片 ]は,次の頁に押出される。 ~UAは, 50% より多くの断片が残りの空間に収まる場合は引き上げ, そうでなければ押出すべきである。 ◎ Otherwise, the item or fragment that does not fit is pushed to the next page. The UA should pull up if more than 50% of the fragment would have fit in the remaining space and should push otherwise.
- ~IF[ これまでの手続きで~lay-outされなかった[ 駒/断片 ]が在る ] ⇒ ~flex~layout~algoの,`~line~sizeの決定$から`交叉sizeの決定$までの部分を、次の頁の~sizeの下に, (すでに~lay-outされたものも含めた)内容 すべてにより再実行した上で、まだ~lay-outされていない最初の[ 駒/断片 ]から開始する下で,前~段へ戻る。 ◎ If there are any flex items or fragments not laid out by the previous steps, rerun the flex layout algorithm from Line Length Determination through Cross Sizing Determination with the next page’s size and all the contents (including those already laid out), and return to the previous step, but starting from the first item or fragment not already laid out.
- ~flex容器~内の各~断片に対し、~flex~layout~algoの,`主-軸の整列$から その最後までの部分を続行する。 ◎ For each fragment of the flex container, continue the flex layout algorithm from Main-Axis Alignment to its finish.
注記: この~algoでは意図的に、~col方向かつ`単-~line$の ~flex容器が,塊~flowとごく似る様に頁割付させている。 その意図の~~元は、[ `justify-content$p:start にされ, かつ ~flex可能な駒を伴わない ]ような~flex容器による頁割付と,[ その~flex容器と同じ[ 内容, 使用~size, 使用~margin ]を伴う,`~flow内$の子 ]を持つような塊による頁割付が,一致するべきである所に由来する。 ◎ It is the intent of this algorithm that column-direction single-line flex containers paginate very similarly to block flow. As a test of the intent, a flex container with justify-content:start and no flexible items should paginate identically to a block with in-flow children with same content, same used size and same used margins.
- `複-~line$ ~col~flex容器
-
- 頁割付処理を~~考慮した上で(~flex容器の最大~line長さを頁~上に残された空間に制限した下で)、~flex~layout~algoの,`交叉sizeの決定$の所までを実行する。 ◎ Run the flex layout algorithm with regards to pagination (limiting the flex container’s maximum line length to the space left on the page) through Cross Sizing Determination.
-
できるだけ多く(ただし, 1 本以上)の~flex~lineを、交叉~次元にて~flex容器の部屋が尽きるか, または 強制分断に遭遇するまで,~lay-outする: ◎ Lay out as many flex lines as possible (but at least one) until there is no more room in the flex container in the cross dimension or a forced break is encountered:
- できるだけ多く(ただし, 1 つ以上)の連続する~flex駒を、最初のものから順に,頁~上の部屋が尽きるか, または 強制分断に遭遇するまで,~lay-outする。 ただし,~flex駒の 内部の 強制分断は無視する。 ◎ Lay out as many consecutive flex items as possible (but at least one), starting from the first, until there is no more room on the page or a forced break is encountered. Forced breaks within flex items are ignored.
- ~IF[ これが最初の~flex容器~断片である ]~AND[ この~lineは 頁~上に残された空間より大きい単独の~flex駒のみを包含する ]~AND[ この~flex容器はすでに頁先頭に来ているのではない ] ⇒ その~flex容器を次の頁に移動した上で,~flex容器~layout全体を再開始する ◎ If this is the first flex container fragment, this line contains only a single flex item that is larger than the space left on the page, and the flex container is not at the top of the page already, move the flex container to the next page and restart flex container layout entirely.
- ~IF[ 最初の段にて~lay-outされていない~flex駒がある ] ⇒ ~flex~layout~algoの,`主sizeの決定$から`交叉sizeの決定$までの部分を、前の~line上に~lay-outされていない駒のみを利用して,再実行した上で、まだ~lay-outされていない最初の駒から開始する下で,前~段へ戻る。 ◎ If there are any flex items not laid out by the first step, rerun the flex layout algorithm from Main Sizing Determination through Cross Sizing Determination using only the items not laid out on a previous line, and return to the previous step, starting from the first item not already laid out.
- ~IF[ 前~段で~lay-outされていない~flex駒が在る ] ⇒ 次の頁の~size, および まだ~lay-outされていない駒のみを利用して ~flex~layout~algoの `~line~sizeの決定$から`交叉sizeの決定$までの部分を再実行した上で、まだ~lay-outされていない最初の駒から開始する下で,前~段へ戻る。 ◎ If there are any flex items not laid out by the previous step, rerun the flex layout algorithm from Line Sizing Determination through Cross Sizing Determination with the next page’s size and only the items not already laid out, and return to the previous step, but starting from the first item not already laid out.
- ~flex容器の各~断片に対し、~flex~layout~algoの,`主-軸の整列$から その最後までの部分を続行する。 ◎ For each fragment of the flex container, continue the flex layout algorithm from Main-Axis Alignment to its finish.
注記: 単独の頁~上に~flex駒の全体が収まり切らない場合、 `複-~line$ ~col~flex容器の中に 頁割付されることはない。 ◎ If a flex item does not entirely fit on a single page, it will not be paginated in multi-line column flex containers.
- `単-~line$ ~row~flex容器
-
- [ `flex-start$v:ais, `baseline$v:ais ]以外のどの `align-self$p 値も `flex-start$v:ais とみなす下で、~flex~layout~algo全体を(頁割付処理は~~考慮せずに)実行する。 ◎ Run the entire flex layout algorithm (without regards to pagination), except treat any align-self other than flex-start or baseline as flex-start.
- ~IF[ 分断し得ない駒が頁~上に残された空間に収まり切らない ]~AND[ この~flex容器が頁先頭に来てはいない ] ⇒ その~flex容器を次の頁へ移動した上で,~flex容器~layout全体を再開始する。 ◎ If an unbreakable item doesn’t fit within the space left on the page, and the flex container is not at the top of the page, move the flex container to the next page and restart flex container layout entirely.
-
各~駒に対し、その内容を頁~上に残された空間に収まる限り,~lay-outする。 残りの内容を次の頁~上に断片化する — すべての内容(前の頁~上で完結した駒も含む)を利用して,新たな頁~sizeの下で,~flex~layout~algoの,`~line~sizeの決定$から`主-軸の整列$までの部分を再実行した上で。 ◎ For each item, lay out as much of its contents as will fit in the space left on the page, and fragment the remaining content onto the next page, rerunning the flex layout algorithm from Line Length Determination through Main-Axis Alignment into the new page size using all the contents (including items completed on previous pages).
注記: それまでの断片たちの中に全体が収まる~flex駒は、依然として,後方の断片たちにおける主-軸の空間を占める。 ◎ Any flex items that fit entirely into previous fragments still take up space in the main axis in later fragments.
- ~flex容器の各~断片に対し、~flex~layout~algoの,`交叉-軸の整列$から 最後までの部分を再実行する。 最初のもの以外のすべての断片に対し ⇒ すべての駒~断片と~lineに対し,[ `align-self$p, `align-content$p ]は `flex-start$v:ais とみなす ◎ For each fragment of the flex container, rerun the flex layout algorithm from Cross-Axis Alignment to its finish. For all fragments besides the first, treat align-self and align-content as being flex-start for all item fragments and lines.
- ~IF[ 駒を、その元の `align-self$p 値に則って[[ すべての~flex容器~断片 ]の`交叉size$の合計 ]の中で整列させたとするときに,[ 単独の~flex容器~断片~内に全体が収まる ]ことになる ] ⇒ その駒を,その断片の中に~~移動して, 適切に整列して~MAY。 ◎ If any item, when aligned according to its original align-self value into the combined cross size of all the flex container fragments, would fit entirely within a single flex container fragment, it may be shifted into that fragment and aligned appropriately.
- `複-~line$ ~row~flex容器
-
- ~flex~layout~algoの,`交叉sizeの決定$の所までを(頁割付処理は~~考慮せずに)実行する。 ◎ Run the flex layout algorithm (without regards to pagination), through Cross Sizing Determination.
-
できるだけ多く(ただし, 1 本以上)の~flex~lineを, 最初から順に,頁~上の部屋が尽きるか, または 強制分断に遭遇するまで,~lay-outする。 ◎ Lay out as many flex lines as possible (but at least one), starting from the first, until there is no more room on the page or a forced break is encountered.
~IF[ ~lineは[ 頁に収まり切らない ]~AND[ 頁先頭に来てはいない ]] ⇒ ~lineを次の頁に移動させた上で、それらの駒のみを利用して,この~lineに後続するように ~flex~layout~algo全体を再開始する。 ◎ If a line doesn’t fit on the page, and the line is not at the top of the page, move the line to the next page and restart the flex layout algorithm entirely, using only the items in and following this line.
~IF[ ~flex駒それ自身が強制分断を生じさせている ] ⇒ この~lineと後続の~line上の駒のみを利用して, [ `~line分断~処理~段$において自動的な分断により新たな~lineを開始させた駒 ]は利用せずに、 ~flex~layout~algoの,`主sizeの決定$から`主-軸の整列$までの部分を再実行した上で,この段を継続する。 ~flex駒 内の強制分断は無視される。 ◎ If a flex item itself causes a forced break, rerun the flex layout algorithm from Main Sizing Determination through Main-Axis Alignment, using only the items on this and following lines, but with the item causing the break automatically starting a new line in the line breaking step, then continue with this step. Forced breaks within flex items are ignored.
- ~IF[ 前~段により~lay-outされなかった~flex駒がある ] ⇒ 次の頁の~sizeおよび まだ~lay-outされていない駒のみを利用して、~flex~layout~algoの,`~line~sizeの決定$から`主-軸の整列$までの部分を再実行した上で,まだ~lay-outされていない最初の~lineから開始する下で,前~段へ戻る。 ◎ If there are any flex items not laid out by the previous step, rerun the flex layout algorithm from Line Length Determination through Main-Axis Alignment with the next page’s size and only the items not already laid out. Return to the previous step, but starting from the first line not already laid out.
- ~flex容器の各~断片に対し、~flex~layout~algoの,`交叉-軸の整列$から その最後までの部分を続行する。 ◎ For each fragment of the flex container, continue the flex layout algorithm from Cross Axis Alignment to its finish.
付録 A. 各~軸の対応関係
~INFORMATIVE以下に現れる `(no)wrap^v は、[ `wrap$v:fw または `nowrap$v:fw ]の略記である。
`flex-flow$p | `主-軸$ | `始端$ | `終端$ | `交叉-軸$ | `始端$ | `終端$ |
---|---|---|---|---|---|---|
`row$v:fd + `(no)wrap^v | 横方向 | 左端 | 右端 | 縦方向 | 上端 | 下端 |
`row-reverse$v:fd + `(no)wrap^v | 右端 | 左端 | ||||
`row$v:fd + `wrap-reverse$v:fw | 左端 | 右端 | 下端 | 上端 | ||
`row-reverse$v:fd + `wrap-reverse$v:fw | 右端 | 左端 | ||||
`column$v:fd + `(no)wrap^v | 縦方向 | 上端 | 下端 | 横方向 | 左端 | 右端 |
`column-reverse$v:fd + `(no)wrap^v | 下端 | 上端 | ||||
`column$v:fd + `wrap-reverse$v:fw | 上端 | 下端 | 右端 | 左端 | ||
`column-reverse$v:fd + `wrap-reverse$v:fw | 下端 | 上端 |
`flex-flow$p | `主-軸$ | `主-始端$ | `主-終端$ | `交叉-軸$ | `交叉-始端$ | `交叉-終端$ |
---|---|---|---|---|---|---|
`row$v:fd + `(no)wrap^v | 横方向 | 右端 | 左端 | 縦方向 | 上端 | 下端 |
`row-reverse$v:fd + `(no)wrap^v | 左端 | 右端 | ||||
`row$v:fd + `wrap-reverse$v:fw | 右端 | 左端 | 下端 | 上端 | ||
`row-reverse$v:fd + `wrap-reverse$v:fw | 左端 | 右端 | ||||
`column$v:fd + `(no)wrap^v | 縦方向 | 上端 | 下端 | 横方向 | 右端 | 左端 |
`column-reverse$v:fd + `(no)wrap^v | 下端 | 上端 | ||||
`column$v:fd + `wrap-reverse$v:fw | 上端 | 下端 | 左端 | 右端 | ||
`column-reverse$v:fd + `wrap-reverse$v:fw | 下端 | 上端 |
`flex-flow$p | `主-軸$ | `始端$ | `終端$ | `交叉-軸$ | `始端$ | `終端$ |
---|---|---|---|---|---|---|
`row$v:fd + `(no)wrap^v | 縦方向 | 上端 | 下端 | 横方向 | 右端 | 左端 |
`row-reverse$v:fd + `(no)wrap^v | 下端 | 上端 | ||||
`row$v:fd + `wrap-reverse$v:fw | 上端 | 下端 | 左端 | 右端 | ||
`row-reverse$v:fd + `wrap-reverse$v:fw | 下端 | 上端 | ||||
`column$v:fd + `(no)wrap^v | 縦方向 | 右端 | 左端 | 横方向 | 上端 | 下端 |
`column-reverse$v:fd + `(no)wrap^v | 左端 | 右端 | ||||
`column$v:fd + `wrap-reverse$v:fw | 右端 | 左端 | 下端 | 上端 | ||
`column-reverse$v:fd + `wrap-reverse$v:fw | 左端 | 右端 |
謝辞
次の方々からの~feedbackと貢献に謝意を: ◎ Thanks for feedback and contributions to
Erik Anderson, Christian Biesinger, Tony Chang, Phil Cupp, Arron Eicholz, James Elmore, Andrew Fedoniouk, Brian Heuston, Shinichiro Hamaji, Daniel Holbert, Ben Horst, John Jansen, Brad Kemper, Kang-hao Lu, Markus Mielke, Peter Moulder, Robert O’Callahan, Christoph Päper, Ning Rogers, Peter Salas, Elliott Sprehn, Morten Stenshorne, Christian Stockwell, Ojan Vafai, Eugene Veselov, Greg Whitworth, Boris Zbarsky.
変更点
【 この節の内容は未訳。 】
~privacyと保安~上の考慮点
この仕様により、新たな~privacy漏洩や,[ “正しく実装すること” を超えるような保安~上の考慮点 ]が導入されることはない。 ◎ Flexbox introduces no new privacy leaks, or security considerations beyond "implement it correctly".