From e8f0279ce0beff5d70e59fa4165a668e1527fff6 Mon Sep 17 00:00:00 2001 From: Sajid Anwar Date: Mon, 4 May 2026 00:26:23 -0600 Subject: [PATCH 001/127] [css-easing-2][editorial] Fix path syntax in css-easing-2/images/linear-easing-curve.svg (#13882) Removes the commas from the path curve in this example image that were preventing rendering in Firefox. (It was rendering in Chrome fine, but that seems to be against spec (https://w3c.github.io/svgwg/svg2-draft/paths.html#PathDataBNF) which only allows whitespace between draw commands). --- css-easing-2/images/linear-easing-curve.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css-easing-2/images/linear-easing-curve.svg b/css-easing-2/images/linear-easing-curve.svg index 909eb6720f73..3b05d35594b4 100644 --- a/css-easing-2/images/linear-easing-curve.svg +++ b/css-easing-2/images/linear-easing-curve.svg @@ -103,7 +103,7 @@ 0 - + P1 From fb90e63608acdaa7ea910495c65ed3bfe9f6d692 Mon Sep 17 00:00:00 2001 From: Tab Atkins-Bittner Date: Mon, 4 May 2026 19:49:07 +0000 Subject: [PATCH 002/127] [css-flexbox-2] Twiddle the phrasing, undiff the Layout Algo section and fill in the balancing details. --- css-flexbox-2/Overview.bs | 746 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 713 insertions(+), 33 deletions(-) diff --git a/css-flexbox-2/Overview.bs b/css-flexbox-2/Overview.bs index e6e1d5053a86..0637f10b7d3f 100644 --- a/css-flexbox-2/Overview.bs +++ b/css-flexbox-2/Overview.bs @@ -64,7 +64,7 @@ Flex Line Wrapping: the 'flex-wrap' property The flex container is [=multi-line=], and attempts to "balance" the lengths of the [=flex lines=] to be as similar as possible. - See [[#flex-balance=]]. + See [[#flex-balance]]. ''balance'' can be combined with ''wrap'' or ''wrap-reverse'' to dictate which direction the [=flex lines=] are stacked in. @@ -111,17 +111,23 @@ Minimum Flex Lines: the 'flex-line-count' property In some situations, an author might want to ensure there are always a certain number of lines, or might be using a flexbox in a way where there is no limit to the line length - (the standard for a [=column flexbox=]) + (the standard for a [=column flexbox=], with unlimited available height) and so the "default" line number calculation is useless. - The 'flex-line-count' property specifies a minimum number of [=flex lines=] + The 'flex-line-count' property specifies a minimum flex line count that the [=flex container=] should create to balance the items across. - If the [=flex container=] has less [=flex items=] than the 'flex-line-count' value, + The [=minimum flex line count=] is clamped from above + by the number of [=flex items=] in the [=flex container=]; it will only create as many lines as there are [=flex items=]. - If the [=flex lines=] are limited in length - and the [=flex items=] will fill more than the specified number of lines, - the actual [=flex line=] count can be higher than what is specified. + (That is, if you specify ''flex-line-count: 3'' + but only have two [=flex items=], + the [=minimum flex line count=] is 2, instead.) + + Note: There is no maximum flex line count; + the [=flex container=] will always contain enough lines + to hold all of its [=flex items=], + which might be more than what 'flex-line-count' specifies. Unused lines (ones with no [=flex items=] assigned to them) are discarded and do not affect layout. @@ -136,7 +142,8 @@ Minimum Flex Lines: the 'flex-line-count' property then dividing the leftover by N, where N is the 'flex-line-count' value. This uses the actual 'flex-line-count' value, - not the number of lines produced + not the [=minimum flex line count=] + or the actual number of generated lines (which can be higher or lower than what is specified). Note: This [=available space=] adjustment is the only effect 'flex-line-count' has @@ -145,35 +152,708 @@ Minimum Flex Lines: the 'flex-line-count' property Percentages continue to resolve as normal, unaffected by this [=available space=] adjustment. (To have a [=flex item=] fill the [=cross-axis=] [=available space=], - use ''width/height: stretch''.) + use ''width/height: stretch'', + rather than ''width/height: 100%''.) If the [=flex container=] is [=single-line=] (aka, ''flex-wrap: nowrap''), this property has no effect. -

+ + +

Flex Layout Algorithm

-... - -
- - TODO fill in the details of how balancing works. - - In short, do flex layout up to the linebreaking part. - Linebreak as normal - (but with the floor-at-0 thing, below) - to discover how many lines are needed; - if 'flex-line-count' is higher - (and there are at least that many flex items), - use that line count instead. - - Then do balanced line-breaking, - using a well-known algorithm I forget the name of right this moment. - - For the purpose of the balancing algorithm, - hypothetical sizes are floored at 0, - so it can be done efficiently. - (Negative margins can make the hypothetical size negative, - which does affect line-breaking.) -
\ No newline at end of file + 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. + + 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. + + The following sections define the algorithm for laying out a flex container and its contents. + + Note: Flex layout works with the flex items in order-modified document order, + not their original document order. + + + flexbox-basic-block-horiz-001v.xhtml + flexbox-basic-block-horiz-001.xhtml + flexbox-basic-block-vert-001v.xhtml + flexbox-basic-block-vert-001.xhtml + flexbox-basic-canvas-horiz-001v.xhtml + flexbox-basic-canvas-horiz-001.xhtml + flexbox-basic-canvas-vert-001v.xhtml + flexbox-basic-canvas-vert-001.xhtml + flexbox-basic-fieldset-horiz-001.xhtml + flexbox-basic-fieldset-vert-001.xhtml + flexbox-basic-iframe-horiz-001.xhtml + flexbox-basic-iframe-vert-001.xhtml + flexbox-basic-img-horiz-001.xhtml + flexbox-basic-img-vert-001.xhtml + flexbox-basic-textarea-horiz-001.xhtml + flexbox-basic-textarea-vert-001.xhtml + flexbox-basic-video-horiz-001.xhtml + flexbox-basic-video-vert-001.xhtml + flexbox-dyn-resize-001.html + flexbox-mbp-horiz-001-rtl.xhtml + flexbox-mbp-horiz-001.xhtml + flexbox-mbp-horiz-002a.xhtml + flexbox-mbp-horiz-002b.xhtml + flexbox-mbp-horiz-002v.xhtml + flexbox-mbp-horiz-003-reverse.xhtml + flexbox-mbp-horiz-003v.xhtml + flexbox-mbp-horiz-003.xhtml + flexbox-mbp-horiz-004.xhtml + flexbox-sizing-horiz-001.xhtml + flexbox-sizing-horiz-002.xhtml + flexbox-sizing-vert-001.xhtml + flexbox-sizing-vert-002.xhtml + percentage-max-height-001.html + percentage-max-height-002.html + percentage-max-height-003.html + percentage-max-height-004.html + percentage-max-height-005.html + percent-height-flex-items-cross-sizes-with-mutations.html + table-as-item-auto-min-width.html + table-as-item-change-cell.html + table-as-item-fixed-min-width-2.html + table-as-item-fixed-min-width-3.html + table-as-item-fixed-min-width.html + table-as-item-narrow-content-2.html + table-as-item-narrow-content.html + table-as-item-specified-height.html + table-as-item-specified-width.html + table-as-item-specified-width-vertical.html + + +

+Initial Setup

+ +
    +
  1. + Generate anonymous flex items + as described in [[#flex-items]]. +
+ +

+Line Length Determination

+ +
    +
  1. + Determine the available main and cross space for the flex items. + For each dimension, + if that dimension of the flex container’s content box is a definite size, use that; + 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; + 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. + + + If the [=available space=] in the [=cross axis=] is [=definite=], + then additionally modify it based on 'flex-line-count'. + +
    + + For example, the [=available space=] to a flex item + in a 'float|floated' [=width/auto=]-sized [=flex container=] is: + + * the width of the [=flex container=] containing block + minus the [=flex container's=] margin, border, and padding + in the horizontal dimension + * infinite in the vertical dimension +
    + +
  2. + Determine the flex base size and hypothetical main size of each item: + + + image-as-flexitem-size-001.html + image-as-flexitem-size-001v.html + image-as-flexitem-size-002.html + image-as-flexitem-size-002v.html + image-as-flexitem-size-003.html + image-as-flexitem-size-003v.html + image-as-flexitem-size-004.html + image-as-flexitem-size-004v.html + image-as-flexitem-size-005.html + image-as-flexitem-size-005v.html + image-as-flexitem-size-006.html + image-as-flexitem-size-006v.html + image-as-flexitem-size-007.html + image-as-flexitem-size-007v.html + item-with-table-with-infinite-max-intrinsic-width.html + multiline-min-max.html + orthogonal-writing-modes-and-intrinsic-sizing.html + svg-root-as-flex-item-001.html + svg-root-as-flex-item-002.html + svg-root-as-flex-item-003.html + svg-root-as-flex-item-004.html + svg-root-as-flex-item-005.html + svg-root-as-flex-item-006.html + table-as-item-min-height-1.html + table-as-item-wide-content.html + table-with-infinite-max-intrinsic-width.html + + +
      +
    1. + If the item has a definite used flex basis, + that's the flex base size. + +
    2. + If the flex item has ... + + then the flex base size is calculated from + its used cross size + and the flex item’s aspect ratio. + +
    3. + 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 [[!CSS2]]), + size the item under that constraint. + The flex base size is the item's resulting main size. + +
    4. + 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. + + 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. + +
    5. + 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 ''width/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, + or when it has a [=preferred aspect ratio=]) + and the flex item’s cross size is ''auto'' and not definite, + in this calculation use ''width/fit-content'' as the flex item’s cross size. + The flex base size is the item's resulting main size. + + + css-flexbox-img-expand-evenly.html + fit-content-item-001.html + fit-content-item-002.html + fit-content-item-003.html + fit-content-item-004.html + flexbox-vert-lr-with-img.html + flex-container-max-content-001.html + flex-container-min-content-001.html + flex-height-min-content.html + +
    + + 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.) + + 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). + + + text-as-flexitem-size-001.html + + +
  3. + Determine the main size of the flex container + using the rules of the formatting context in which it participates. + +
    + The [=automatic block size=] of a [=block-level=] [=flex container=] + is its [=max-content size=]. + + The Block Layout spec should define this equivalency, but it doesn't exist yet. +
    +
+ +

+Main Size Determination

+ +
    +
  1. + Collect flex items into flex lines: + +
    +
    If the flex container is single-line, +
    Collect all the flex items into a single flex line. + +
    If the flex container is [=multi-line=] + but not [=balancing=], +
    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 size|inner=] main size + (or until a forced break is encountered, + see [[#pagination]]). + If the very first uncollected item wouldn't fit, + collect just it into the line. + +

    + For this step, + the size of a flex item is its [=outer size|outer=] hypothetical main size. + (Note: This can be negative.) + +

    + Repeat until all flex items have been collected into flex lines. + +

    + 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. +

    If the flex container is [=multi-line=] and [=balancing=], +
    + First determine how many [=flex lines=] will be produced + by the non-balancing algorithm, above. + For this purpose, + floor the [=outer size|outer=] [=hypothetical main size=] of each [=flex item=] + at zero. + This can, if the items have large negative margins, + result in a higher line count than a non-balancing flexbox. + Let the |balancing line count| + be the larger of this line count + and the [=minimum flex line count=]. + + Then, + [=balance flex items=] + across |balancing line count| number of lines. +
    + +
  2. + Resolve the flexible lengths of all the flex items + to find their used main size. See [[#resolve-flexible-lengths]]. +
+ + + flexbox_quirks_body.html + ortho-table-item-001.html + percentage-heights-000.html + percentage-heights-001.html + percentage-heights-002.html + percentage-heights-003.html + percentage-heights-004.html + percentage-heights-005.html + percentage-heights-006.html + percentage-heights-007.html + percentage-heights-008.html + percentage-heights-009.html + percentage-heights-010.html + percentage-heights-011.html + percentage-heights-012.html + percentage-heights-013.html + percentage-heights-014.html + percentage-heights-015.html + percentage-heights-016.html + percentage-heights-017.html + percentage-heights-018.html + percentage-heights-019.html + + +

+Cross Size Determination

+ +
    +
  1. + Determine the hypothetical cross size of each item + by performing layout as if it were an [=in-flow=] [=block-level box=] + with the used [=main size=] and the given available space, + treating auto as ''fit-content''. + + + canvas-contain-size.html + + +
  2. + Calculate the cross size of each flex line. + +

    + 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. + +

    + Otherwise, + for each flex line: + +

      +
    1. + Collect all the flex items whose inline-axis is parallel to the main-axis, + whose 'align-self' is ''align-self/baseline'', + and whose cross-axis margins are both non-auto. + Find the largest of the distances between each item's baseline and its hypothetical outer cross-start edge, + and the largest of the distances between each item's baseline and its hypothetical outer cross-end edge, + and sum these two values. + +
    2. + Among all the items not collected by the previous step, + find the largest outer hypothetical cross size. + +
    3. + The used cross size of the flex line is the largest of the numbers found in the previous two steps and zero. + + 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. +
    + + + flexbox-single-line-clamp-1.html + flexbox-single-line-clamp-2.html + flexbox-single-line-clamp-3.html + flex-item-contains-size-layout-001.html + flex-item-contains-strict.html + layout-algorithm_algo-cross-line-001.html + layout-algorithm_algo-cross-line-002.html + + + +
  3. + Handle 'align-content: stretch'. + If the flex container has a definite cross size, + 'align-content' is stretch, + and the sum of the flex lines' cross sizes is less than the flex container's inner cross 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. + +
  4. + Collapse ''visibility:collapse'' items. + If any flex items have ''visibility: collapse'', + note the cross size of the line they're in as the item's |strut size|, + and restart layout from the beginning. + + In this second layout round, + when collecting items into lines, + treat the collapsed items as having zero main size. + For the rest of the algorithm following that step, + ignore the collapsed items entirely + (as if they were ''display:none'') + except that 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. + + Skip this step in the second layout round. + + + flexbox-collapsed-item-baseline-001.html + flexbox-collapsed-item-horiz-001.html + flexbox-collapsed-item-horiz-002.html + flexbox-collapsed-item-horiz-003.html + + +
  5. + Determine the used cross size of each flex item. + If a flex item's [=cross size=] depends on the available space + in the [=cross axis=], + recalculate its cross size using the [=flex line's=] [=cross size=] + (rather than the [=flex container's=]) as the available space. + Otherwise, + the used cross size is the item's hypothetical cross size. + + If the flex item's [=cross size=] changed as a result, + redo layout for its contents, + treating this used size as its definite cross size + so that percentage-sized children can be resolved. + + + table-as-item-cross-size.html + + + Note: This step does not affect the main size of the flex item, + even if it has a [=preferred aspect ratio=]. +
+ + + flex-item-and-percentage-abspos.html + + +

+Main-Axis Alignment

+ +
    +
  1. + Distribute any remaining free space. + For each flex line: + +
      +
    1. + 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. + +
    2. + Align the items along the main-axis per 'justify-content'. +
    +
+ +

+Cross-Axis Alignment

+ +
    +
  1. + Resolve cross-axis auto margins. + If a flex item has auto cross-axis margins: + +
      +
    • + 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. +
    • + Otherwise, + if the block-start or inline-start margin (whichever is in the cross axis) + is auto, set it to zero. + Set the opposite margin so that the outer cross size of the item + equals the cross size of its flex line. +
    + + +
  2. + Align all flex items along the cross-axis per 'align-self', + if neither of the item's cross-axis margins are auto. + +
  3. + Determine the flex container's used cross size + using the rules of the [=formatting context=] in which it participates. + If a content-based [=cross size=] is needed, + use the sum of the [=flex lines=]' [=cross sizes=]. + +
  4. + Align all flex lines per 'align-content'. +
+ +

+Balancing Flex Items

+ +
+ + To balance flex items + for a [=flex container=] + across a number of [=flex lines=] |line count|, + divide its [=flex items=] + into exactly |line count| numbers of contiguous sequences, + under the following conditions: + + * The sum of the [=flex item=] sizes + of all the [=flex items=] in the sequence + (the |line size|) + do not exceed the [=inner size|inner=] [=main size=] of the [=flex container=]. + * At least one [=flex item=] is assigned to each sequence. + * If a [=flex item's=] size is zero, + and it could be assigned either to the end of a preceding sequence + or the beginning of the next sequence, + it is assigned to the end of the preceding sequence. + * Calling the difference between the |line size| + and the [=flex container's=] [=inner size|inner=] [=main size=] + a sequence's |error|, + the sum of the squared |error| across all sequences + is minimized. + + For the purpose of this algorithm, + a [=flex item's=] size + is its [=outer size|outer=] [=hypothetical main size=], + floored at 0. + + Assign each sequence of [=flex items=] + to the corresponding [=flex line=]. +
+ + Issue: Can there be multiple equally valid sequence assignments? + If so, do we care which we choose? + Do the efficient algos make it possible to reasonably choose between them? + + Note: Because all items have zero or positive size, + and thus adding an item to a line never increases the error, + there are efficient, nearly linear algorithms + to minimize the sum of squared error, + such as SMAWK algorithm. + (A naive minimization algo is O(n^2) in the number of items being balanced, + which is not usable in practice.) + + +

+Resolving Flexible Lengths

+ +

+ To resolve the flexible lengths of the items within a flex line: + +

    +
  1. + 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. + +
  2. + Each item in the flex line has a target main size, + initially set to its [=flex base size=]. + Each item is initially unfrozen + and may become frozen. + + Note: An item’s [=target main size=] doesn’t change after freezing. + +
  3. + Size inflexible items. + Freeze, + setting its [=target main size=] + to its hypothetical main size… + + +
  4. + 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. + +
  5. + Loop: + +
      +
    1. + Check for flexible items. + If all the flex items on the line are frozen, exit this loop. + +
    2. + Calculate the remaining free space + as for initial free space, above. + If the sum of the unfrozen flex items’ flex factors is less than one, + multiply the initial free space by this sum. + If the magnitude of this value is less than the magnitude of the remaining free space, + use this as the remaining free space. + +
    3. + If the [=remaining free space=] is non-zero, + distribute it proportional to the flex factors: + +
      +
      If using the flex grow factor +
      + For every unfrozen item on the line, + 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. + +
      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. +
      + +
    4. + 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. + +
    5. + 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. +
      + + Note: This freezes at least one item, + ensuring that the loop makes progress and eventually terminates. + +
    6. + Return to the start of this loop. +
    + +
  6. + Set each item’s used main size to its target main size. +
+ + + item-with-max-height-and-scrollbar.html + item-with-max-height-and-scrollbar.html + max-width-violation.html + relayout-image-load.html + table-as-item-inflexible-in-column-1.html + table-as-item-inflexible-in-column-2.html + table-as-item-inflexible-in-row-1.html + table-as-item-inflexible-in-row-2.html + \ No newline at end of file From a2f5595195ad781e8c06966faed510a6bd1d0590 Mon Sep 17 00:00:00 2001 From: Tab Atkins-Bittner Date: Tue, 5 May 2026 00:36:48 +0000 Subject: [PATCH 003/127] [css-flexbox-2] Undiff the spec, and add more explanatory info. --- css-flexbox-2/Overview.bs | 4836 ++++++++++++++++- .../examples/flex-item-determination.html | 39 + css-flexbox-2/images/OK.png | Bin 0 -> 223 bytes .../images/align-content-example.svg | 94 + css-flexbox-2/images/basic-flexbox.png | Bin 0 -> 2552 bytes .../images/basic-vertical-flexbox.png | Bin 0 -> 1242 bytes css-flexbox-2/images/computer.jpg | Bin 0 -> 7106 bytes css-flexbox-2/images/flex-align.svg | 79 + css-flexbox-2/images/flex-direction-terms.svg | 66 + css-flexbox-2/images/flex-flow-english.svg | 24 + css-flexbox-2/images/flex-flow-japanese.svg | 24 + css-flexbox-2/images/flex-flow1.svg | 24 + css-flexbox-2/images/flex-flow2.svg | 24 + css-flexbox-2/images/flex-flow3.svg | 24 + .../images/flex-item-determination.png | Bin 0 -> 1334 bytes css-flexbox-2/images/flex-order-example.png | Bin 0 -> 2006 bytes css-flexbox-2/images/flex-order-page.svg | 32 + css-flexbox-2/images/flex-pack.svg | 59 + .../images/multiline-balance-flex.svg | 24 + css-flexbox-2/images/multiline-balance.svg | 24 + css-flexbox-2/images/multiline-flex.svg | 24 + css-flexbox-2/images/multiline-no-flex.svg | 24 + css-flexbox-2/images/printer.png | Bin 0 -> 1959 bytes css-flexbox-2/images/rel-vs-abs-flex.svg | 77 + css-flexbox-2/images/target.png | Bin 0 -> 2904 bytes css-flexbox-2/images/toolbar-example.svg | 35 + css-flexbox-2/images/wp7zxxyu.gif | Bin 0 -> 1731 bytes 27 files changed, 5454 insertions(+), 79 deletions(-) create mode 100644 css-flexbox-2/examples/flex-item-determination.html create mode 100644 css-flexbox-2/images/OK.png create mode 100644 css-flexbox-2/images/align-content-example.svg create mode 100644 css-flexbox-2/images/basic-flexbox.png create mode 100644 css-flexbox-2/images/basic-vertical-flexbox.png create mode 100644 css-flexbox-2/images/computer.jpg create mode 100644 css-flexbox-2/images/flex-align.svg create mode 100644 css-flexbox-2/images/flex-direction-terms.svg create mode 100644 css-flexbox-2/images/flex-flow-english.svg create mode 100644 css-flexbox-2/images/flex-flow-japanese.svg create mode 100644 css-flexbox-2/images/flex-flow1.svg create mode 100644 css-flexbox-2/images/flex-flow2.svg create mode 100644 css-flexbox-2/images/flex-flow3.svg create mode 100644 css-flexbox-2/images/flex-item-determination.png create mode 100644 css-flexbox-2/images/flex-order-example.png create mode 100644 css-flexbox-2/images/flex-order-page.svg create mode 100644 css-flexbox-2/images/flex-pack.svg create mode 100644 css-flexbox-2/images/multiline-balance-flex.svg create mode 100644 css-flexbox-2/images/multiline-balance.svg create mode 100644 css-flexbox-2/images/multiline-flex.svg create mode 100644 css-flexbox-2/images/multiline-no-flex.svg create mode 100644 css-flexbox-2/images/printer.png create mode 100644 css-flexbox-2/images/rel-vs-abs-flex.svg create mode 100644 css-flexbox-2/images/target.png create mode 100644 css-flexbox-2/images/toolbar-example.svg create mode 100644 css-flexbox-2/images/wp7zxxyu.gif diff --git a/css-flexbox-2/Overview.bs b/css-flexbox-2/Overview.bs index 0637f10b7d3f..e27eae36c72f 100644 --- a/css-flexbox-2/Overview.bs +++ b/css-flexbox-2/Overview.bs @@ -10,23 +10,1701 @@ Abstract: The specification describes a CSS box model optimized for user interfa Editor: Tab Atkins Jr., Google, http://xanthir.com/contact/, w3cid 42199 Editor: Elika J. Etemad / fantasai, Apple, http://fantasai.inkedblade.net/contact, w3cid 35400 Editor: Rossen Atanassov, Microsoft, ratan@microsoft.com, w3cid 49885 +WPT Path Prefix: css/css-flexbox/ +Ignored Terms: auto, first formatted line, first letter +Ignored Vars: item’s own max-content, maximum min-content among all items + + + +

Introduction

This section is not normative. - This module is currently a diff spec over [[CSS-FLEXBOX-1]]. - It defines a new flex wrapping mode, ''flex-wrap: balance'', - which attempts to find linebreak locations - which make the size of each flex line - as similar as possible. + Flexbox Level 1 defined a new layout mode: flex layout. + [=Flex layout=] is a powerful, flexible layout mode + for laying out a [=flex container's=] children ([=flex items=]) + across one or several lines, + either horizontally or vertically, + and aligning or stretching the items within their line in various ways + that are generally useful for application or whole-page layouts. + + This level extends the [=flex layout=] model in a number of ways: + + * ''flex-wrap: balance'' allows for flex items to be balanced across lines, + so each line is as similar in length as possible, + avoiding "jagged" lines, particularly on the last line. + + +

+Overview

+ + This section is not normative. + + 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: + + * can be laid out in any flow direction + (leftwards, rightwards, downwards, or even upwards!) + * can have their display order reversed or + 'order|rearranged' at the style layer + (i.e., visual order can be independent of source and speech order) + * can be laid out linearly along a single (main) axis or + wrapped into multiple lines along a secondary (cross) axis + * if [=multi-line=], can be packed tightly onto each line + (similar to standard text line-breaking) + or balanced across the lines + (similar to ''text-wrap:pretty'') + * can “flex” their sizes + to respond to the available space + * can be aligned with respect to their container or each other on the secondary (cross) + * can be dynamically collapsed or uncollapsed + along the main axis while preserving the container's cross size + +
+ 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 are aligned at the bottom, regardless of the length of the item's description. + Flex layout makes many aspects of this design easy: + + * 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. + + * 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. + + * 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: flex;        /* Flex layout so items have equal height  */
+			flex-flow: row wrap;  /* Allow items to wrap into multiple lines */
+		}
+		.sale-item {
+			display: flex;        /* Lay out each item using flex layout */
+			flex-flow: column;    /* Lay out item's contents vertically  */
+		}
+		.sale-item > img {
+			order: -1;            /* Shift image before other content (in visual order) */
+			align-self: center;   /* Center the image cross-wise (horizontally)         */
+		}
+		.sale-item > button {
+			margin-top: auto;     /* Auto top margin pushes button to bottom */
+		}
+		
+ +
+		<section id="deals">
+		  <section class="sale-item">
+		    <h1>Computer Starter Kit</h1>
+		    <p>This is the best computer money can buy, if you don’t have much money.
+		    <ul>
+		      <li>Computer
+		      <li>Monitor
+		      <li>Keyboard
+		      <li>Mouse
+		    </ul>
+		    <img src="images/computer.jpg"
+		         alt="You get: a white computer with matching peripherals.">
+		    <button>BUY NOW</button>
+		  </section>
+		  <section class="sale-item">
+		    …
+		  </section>
+		  …
+		</section>
+		
+ +
+
+
+
+
+ You get: a white computer with matching keyboard and monitor. +

Computer Starter Kit

+

+ This is the best computer money can buy, + if you don't have much money. +

    +
  • Computer +
  • Monitor +
  • Keyboard +
  • Mouse +
+
+
+ You get: beautiful ASCII art. +

Printer

+

+ Only capable of printing + ASCII art. +

    +
  • Paper and ink not included. +
+
+
+
+
+
+
+
+ An example rendering of the code above. +
+
+
+ +

+Module interactions

+ + This module extends the definition of the 'display' property [[!CSS2]], + 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. + + The CSS Box Alignment Module + extends and supersedes the definitions of the alignment properties + ('justify-content', 'align-items', 'align-self', 'align-content') + introduced here. + + + flexbox_first-letter.html + flexbox_first-line.html + flexbox-ignores-first-letter.html + + +

+Value Definitions

+ + This specification follows the CSS property definition conventions from [[!CSS2]] + using the value definition syntax from [[!CSS-VALUES-3]]. + Value types not defined in this specification are defined in CSS Values & Units [[!CSS-VALUES-3]]. + Combination with other CSS modules may expand the definitions of these value types. + + In addition to the property-specific values listed in their definitions, + all properties defined in this specification + also accept the CSS-wide keywords as their property value. + For readability they have not been repeated explicitly. + +

+Flex Layout Box Model and Terminology

+ + 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. + + 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). + +
+ +
+ An illustration of the various directions and sizing terms as applied to a ''row'' flex container. +
+
+ +
+
main axis +
main dimension +
+ The main axis of a flex container is the primary axis along which flex items are laid out. + It extends in the main dimension. + +
main-start +
main-end +
+ The flex items are placed within the container + starting on the main-start side + and going toward the main-end side. + +
main size +
main size property +
+ The main size of a [=flex container=] or [=flex item=] + refers to its [=width=] or [=height=], + whichever is in the [=main dimension=]. + Its main size property + is either its 'width' or 'height' property, + whichever is in the [=main dimension=]. + Likewise, its min and + max main size properties + are its 'min-width'/'max-width' or 'min-height'/'max-height' properties, + whichever are in the main dimension, + and determine its min/max main size. + + In [=flex layout=], the [=main size=] is controlled by the 'flex' property + rather than directly by the [=main size property=]. + + Note: This means any references to a flex item's used size in the [=main dimension=] + ([=width=], [=height=], [=inline size=], [=block size=]) + refers to its post-flexing [=main size=]. +
+ +
+
cross axis +
cross dimension +
+ The axis perpendicular to the main axis is called the cross axis. + It extends in the cross dimension. + +
cross-start +
cross-end +
+ 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. + +
cross size +
cross size property +
+ The cross size of a [=flex container=] or [=flex item=] + refers to its [=width=] or [=height=], + whichever is in the [=cross dimension=]. + Its cross size property + is either its 'width' or 'height' property, + whichever is in the [=cross dimension=]. + Likewise, its min and + max cross size properties + are its 'min-width'/'max-width' or 'min-height'/'max-height' properties, + whichever are in the cross dimension, + and determine its min/max cross size. +
+ + Additional sizing terminology used in this specification + is defined in CSS Intrinsic and Extrinsic Sizing. [[!CSS-SIZING-3]] + + + box-sizing-min-max-sizes-001.html + + + + +

+Flex Containers: the ''flex'' and ''inline-flex'' 'display' values

+ +
+
+		Name: display
+		New values: flex | inline-flex
+		
+
+ + + inheritance.html + + +
+
flex +
+ This value causes an element to generate a flex container box + that is block-level when placed in flow layout. + + + baseline-synthesis-001.html + baseline-synthesis-002.html + baseline-synthesis-003.html + baseline-synthesis-004.html + baseline-synthesis-vert-lr-line-under.html + display-flex-001.htm + dynamic-change-simplified-layout-002.html + dynamic-change-simplified-layout.html + fixedpos-video-in-abspos-quirk-crash.html + flexbox_flex-0-0-0.html + flexbox_flex-0-0-0-unitless.html + flexbox_flex-0-0-1-unitless-basis.html + flexbox_flex-0-0-auto.html + flexbox_flex-0-0-auto-shrink.html + flexbox_flex-0-0.html + flexbox_flex-0-0-N.html + flexbox_flex-0-0-Npercent.html + flexbox_flex-0-0-Npercent-shrink.html + flexbox_flex-0-0-N-shrink.html + flexbox_flex-0-0-N-unitless-basis.html + flexbox_flex-0-1-0.html + flexbox_flex-0-1-0-unitless.html + flexbox_flex-0-1-1-unitless-basis.html + flexbox_flex-0-1-auto.html + flexbox_flex-0-1-auto-shrink.html + flexbox_flex-0-1.html + flexbox_flex-0-1-N.html + flexbox_flex-0-1-Npercent.html + flexbox_flex-0-1-Npercent-shrink.html + flexbox_flex-0-1-N-shrink.html + flexbox_flex-0-1-N-unitless-basis.html + flexbox_flex-0-auto.html + flexbox_flex-0-N-0.html + flexbox_flex-0-N-0-unitless.html + flexbox_flex-0-N-auto.html + flexbox_flex-0-N-auto-shrink.html + flexbox_flex-0-N.html + flexbox_flex-0-N-N.html + flexbox_flex-0-N-Npercent.html + flexbox_flex-0-N-Npercent-shrink.html + flexbox_flex-0-N-N-shrink.html + flexbox_flex-1-0-0.html + flexbox_flex-1-0-0-unitless.html + flexbox_flex-1-0-auto.html + flexbox_flex-1-0-auto-shrink.html + flexbox_flex-1-0.html + flexbox_flex-1-0-N.html + flexbox_flex-1-0-Npercent.html + flexbox_flex-1-0-Npercent-shrink.html + flexbox_flex-1-0-N-shrink.html + flexbox_flex-1-1-0.html + flexbox_flex-1-1-0-unitless.html + flexbox_flex-1-1-auto.html + flexbox_flex-1-1-auto-shrink.html + flexbox_flex-1-1.html + flexbox_flex-1-1-N.html + flexbox_flex-1-1-Npercent.html + flexbox_flex-1-1-Npercent-shrink.html + flexbox_flex-1-1-N-shrink.html + flexbox_flex-1-N-0.html + flexbox_flex-1-N-0-unitless.html + flexbox_flex-1-N-auto.html + flexbox_flex-1-N-auto-shrink.html + flexbox_flex-1-N.html + flexbox_flex-1-N-N.html + flexbox_flex-1-N-Npercent.html + flexbox_flex-1-N-Npercent-shrink.html + flexbox_flex-1-N-N-shrink.html + flexbox_flex-N-0-0.html + flexbox_flex-N-0-0-unitless.html + flexbox_flex-N-0-auto.html + flexbox_flex-N-0-auto-shrink.html + flexbox_flex-N-0.html + flexbox_flex-N-0-N.html + flexbox_flex-N-0-Npercent.html + flexbox_flex-N-0-Npercent-shrink.html + flexbox_flex-N-0-N-shrink.html + flexbox_flex-N-1-0.html + flexbox_flex-N-1-0-unitless.html + flexbox_flex-N-1-auto.html + flexbox_flex-N-1-auto-shrink.html + flexbox_flex-N-1.html + flexbox_flex-N-1-N.html + flexbox_flex-N-1-Npercent.html + flexbox_flex-N-1-Npercent-shrink.html + flexbox_flex-N-1-N-shrink.html + flexbox_flex-N-N-0.html + flexbox_flex-N-N-0-unitless.html + flexbox_flex-N-N-auto.html + flexbox_flex-N-N-auto-shrink.html + flexbox_flex-N-N.html + flexbox_flex-N-N-N.html + flexbox_flex-N-N-Npercent.html + flexbox_flex-N-N-Npercent-shrink.html + flexbox_flex-N-N-N-shrink.html + flexbox_flex-formatting-interop.html + flexbox_generated-flex.html + flexbox_generated.html + flexbox_generated-nested-flex.html + flexbox-iframe-intrinsic-size-001.html + flexbox_item-bottom-float.html + flexbox_item-clear.html + flexbox_item-float.html + flexbox_item-top-float.html + flexbox_item-vertical-align.html + flexbox_block.html + flexbox_box-clear.html + flexbox_display.html + flexbox_fbfc2.html + flexbox_fbfc.html + flexbox_nested-flex.html + flexbox-root-node-001a.html + flexbox-root-node-001b.html + flexbox_stf-fixpos.html + flexbox_stf-float.html + flexbox_stf-inline-block.html + flexbox_stf-table-caption.html + flexbox_stf-table-cell.html + flexbox_stf-table.html + flexbox_stf-table-row-group.html + flexbox_stf-table-row.html + flexbox_stf-table-singleline-2.html + flexbox_stf-table-singleline.html + flexbox_table-fixed-layout.html + flexbox-with-multi-column-property.html + getcomputedstyle/flexbox_computedstyle_display.html + grid-flex-item-001.html + grid-flex-item-002.html + grid-flex-item-003.html + grid-flex-item-004.html + grid-flex-item-005.html + grid-flex-item-006.html + grid-flex-item-007.html + interactive/flexbox_interactive_flex-transitions.html + interactive/flexbox_interactive_order-transitions-2.html + interactive/flexbox_interactive_order-transitions.html + nested-flex-image-loading-invalidates-intrinsic-sizes.html + percentage-margins-001.html + stretch-after-sibling-size-change.html + stretched-child-in-nested-flexbox-001.html + stretched-child-in-nested-flexbox-002.html + stretched-child-in-nested-flexbox-003.html + stretched-child-shrink-on-relayout.html + stretch-flex-item-checkbox-input.html + stretch-flex-item-radio-input.html + stretching-orthogonal-flows.html + table-with-percent-intrinsic-width.html + + +
inline-flex +
+ This value causes an element to generate a flex container box + that is inline-level when placed in flow layout. + + + flexbox_inline.html + flex-inline.html + flexbox_inline-float.html + inline-flexbox-absurd-block-size-crash.html + inline-flexbox-wrap-vertically-width-calculation.html + inline-flex-editing-crash.html + inline-flex-editing-with-updating-text-crash.html + inline-flex-frameset-main-axis-crash.html + inline-flex.html + inline-flex-min-content-height.html + getcomputedstyle/flexbox_computedstyle_display-inline.html + intrinsic-width-orthogonal-writing-mode.html + +
+ + 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. [[!CSS2]] + The 'overflow' property applies to flex containers. + + + flexbox-overflow-horiz-001.html + flexbox-overflow-horiz-002.html + flexbox-overflow-horiz-003.html + flexbox-overflow-horiz-004.html + flexbox-overflow-horiz-005.html + flexbox-overflow-padding-001.html + flexbox-overflow-padding-002.html + flexbox-overflow-vert-001.html + flexbox-overflow-vert-002.html + flexbox-overflow-vert-003.html + flexbox-overflow-vert-004.html + flexbox-overflow-vert-005.html + flexbox_rowspan-overflow-automatic.html + flexbox_rowspan-overflow.html + flexbox-safe-overflow-position-001.html + flexbox-safe-overflow-position-002.html + flexbox-safe-overflow-position-003.html + flexbox-safe-overflow-position-004.html + flexbox-safe-overflow-position-005.html + flexbox-safe-overflow-position-006.html + flexbox_width-overflow.html + min-size-auto-overflow-clip.html + negative-overflow-002.html + negative-overflow-003.html + negative-overflow.html + overflow-area-001.html + overflow-area-002.html + overflow-area-003.html + overflow-auto-001.html + overflow-auto-002.html + overflow-auto-003.html + overflow-auto-004.html + overflow-auto-005.html + overflow-auto-006.html + overflow-auto-007.html + overflow-auto-008.html + overflow-top-left.html + padding-overflow.html + text-overflow-on-flexbox-001.html + synthesize-vrl-baseline.html + + + 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' and 'clear' do not create floating or clearance of flex item, + and do not take it out-of-flow. + * 'vertical-align' has no effect on a flex item. + * 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. + + + + + align-content-wrap-004.html + align-items-baseline-column-vert-lr-table-item.html + align-items-baseline-vert-lr-column-horz-table-item.html + align-items-baseline-vert-rl-column-horz-table-item.html + flexbox_box-clear.html + flexbox_first-letter.html + flexbox_first-line.html + flexbox-ignores-first-letter.html + flexbox_item-vertical-align.html + flexbox-with-pseudo-elements-001.html + flexbox-with-pseudo-elements-002.html + flexbox-with-pseudo-elements-003.html + flexible-box-float.html + flex-item-vertical-align.html + flex-vertical-align-effect.html + hittest-before-pseudo.html + + + If an element's specified 'display' is ''inline-flex'', + then its 'display' property computes to ''flex'' + in certain circumstances: + the table in CSS 2.1 Section 9.7 + is amended to contain an additional row, + with ''inline-flex'' in the "Specified Value" column + and ''flex'' in the "Computed Value" column. + + + +

+Flex Items

+ + Loosely speaking, the flex items of a flex container + are boxes representing its in-flow contents. + + Each in-flow child of a flex container + becomes a flex item, + and each child text sequence + is wrapped in an anonymous block container flex item. + However, if the entire text sequences contains only + [=document white space characters=] + (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''). + + + anonymous-block.html + anonymous-flex-item-001.html + anonymous-flex-item-002.html + anonymous-flex-item-003.html + anonymous-flex-item-004.html + anonymous-flex-item-005.html + anonymous-flex-item-006.html + canvas-dynamic-change-001.html + column-flex-child-with-max-width.html + flexbox-whitespace-handling-001a.xhtml + flexbox-whitespace-handling-001b.xhtml + flexbox-whitespace-handling-002.xhtml + hittest-anonymous-box.html + percentage-descendant-of-anonymous-flex-item.html + percentage-size-subitems-001.html + whitespace-in-flexitem-001.html + + +
+

Examples of flex items: +

+		<div style="display:flex">
+
+		    <!-- flex item: block child -->
+		    <div id="item1">block</div>
+
+		    <!-- flex item: floated element; floating is ignored -->
+		    <div id="item2" style="float: left;">float</div>
+
+		    <!-- flex item: anonymous block box around inline content -->
+		    anonymous item 3
+
+		    <!-- flex item: inline child -->
+		    <span>
+		        item 4
+		        <!-- flex items do not split around blocks -->
+		        <q style="display: block" id=not-an-item>item 4</q>
+		        item 4
+		    </span>
+		</div>
+		
+ +
+
Flex items determined from above code block
+ + +
    +
  1. Flex item containing block. +
  2. Flex item containing float. +
  3. (Anonymous, unstyleable) flex item containing anonymous item 3. +
  4. Flex item containing three blocks in succession: +
      +
    • Anonymous block containing item 4. +
    • <q> element block containing item 4. +
    • Anonymous block containing item 4. +
    +
+
+
+
+ + 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. + + 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. +
+ + 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. + +
+ + Note: Authors reading this spec may want to + skip past the following box-generation and static position details. + + If the [=computed value|computed=] 'display' value of an element's nearest ancestor element + (skipping ''display:contents'' ancestors) + is ''flex'' or ''inline-flex'', + the element's own 'display' value is [=blockified=]. + (See CSS2.1§9.7 [[!CSS2]] + and [[css-display-3#transformations]] + for details on this type of 'display' value conversion.) + + Note: Blockification still occurs even when the ''flex'' or ''inline-flex'' element does not end up generating a [=flex container=] box, + e.g. when it is [=replaced element|replaced=] + or in a ''display: none'' subtree. + + 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. + + In the case of flex items with ''display: table'', + the table wrapper box becomes the flex item, + so the 'align-self' property applies 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. + + + flexbox-table-fixup-001.xhtml + + + + +

+Absolutely-Positioned Flex Children

+ + As it is out-of-flow, + an absolutely-positioned child of a flex container does not participate in flex layout. + + The [=cross-axis=] edges of the [=static-position rectangle=] + of an absolutely-positioned child of a flex container + are the [=content edges=] of the [=flex container=]. + The [=main-axis=] edges of the [=static-position rectangle=] + are where the [=margin edges=] of the child would be positioned + 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, + the child's ''margin/auto'' margins are treated as zero.) + + + abspos/abspos-autopos-htb-ltr.html + abspos/abspos-autopos-htb-rtl.html + abspos/abspos-autopos-vlr-ltr.html + abspos/abspos-autopos-vlr-rtl.html + abspos/abspos-autopos-vrl-ltr.html + abspos/abspos-autopos-vrl-rtl.html + abspos/dynamic-align-self-001.html + abspos/flex-abspos-staticpos-align-self-safe-002.html + abspos/flex-abspos-staticpos-align-self-safe-003.html + abspos/abspos-descendent-001.html + abspos/flex-abspos-staticpos-align-content-001.html + abspos/flex-abspos-staticpos-align-self-001.html + abspos/flex-abspos-staticpos-align-self-002.html + abspos/flex-abspos-staticpos-align-self-003.html + abspos/flex-abspos-staticpos-align-self-004.html + abspos/flex-abspos-staticpos-align-self-005.html + abspos/flex-abspos-staticpos-align-self-006.html + abspos/flex-abspos-staticpos-align-self-007.html + abspos/flex-abspos-staticpos-align-self-008.html + abspos/flex-abspos-staticpos-align-self-rtl-001.html + abspos/flex-abspos-staticpos-align-self-rtl-002.html + abspos/flex-abspos-staticpos-align-self-rtl-003.html + abspos/flex-abspos-staticpos-align-self-rtl-004.html + abspos/flex-abspos-staticpos-align-self-safe-001.html + abspos/flex-abspos-staticpos-align-self-vertWM-001.html + abspos/flex-abspos-staticpos-align-self-vertWM-002.html + abspos/flex-abspos-staticpos-align-self-vertWM-003.html + abspos/flex-abspos-staticpos-align-self-vertWM-004.html + abspos/flex-abspos-staticpos-fallback-justify-content-001.html + abspos/flex-abspos-staticpos-justify-content-001.html + abspos/flex-abspos-staticpos-justify-content-002.html + abspos/flex-abspos-staticpos-justify-content-003.html + abspos/flex-abspos-staticpos-justify-content-004.html + abspos/flex-abspos-staticpos-justify-content-005.html + abspos/flex-abspos-staticpos-justify-content-006.html + abspos/flex-abspos-staticpos-justify-content-007.html + abspos/flex-abspos-staticpos-justify-content-008.html + abspos/flex-abspos-staticpos-justify-content-rtl-001.html + abspos/flex-abspos-staticpos-justify-content-rtl-002.html + abspos/flex-abspos-staticpos-justify-content-vertWM-001.html + abspos/flex-abspos-staticpos-justify-content-vertWM-002.html + abspos/flex-abspos-staticpos-justify-self-001.html + abspos/flex-abspos-staticpos-margin-001.html + abspos/flex-abspos-staticpos-margin-002.html + abspos/flex-abspos-staticpos-margin-003.html + abspos/flexbox_absolute-atomic.html + abspos/flexbox-abspos-child-001a.html + abspos/flexbox-abspos-child-001b.html + abspos/flexbox-abspos-child-002.html + abspos/flexbox_inline-abspos.html + abspos/position-absolute-001.html + abspos/position-absolute-002.html + abspos/position-absolute-003.html + abspos/position-absolute-004.html + abspos/position-absolute-005.html + abspos/position-absolute-006.html + abspos/position-absolute-007.html + abspos/position-absolute-008.html + abspos/position-absolute-009.html + abspos/position-absolute-010.html + abspos/position-absolute-011.html + abspos/position-absolute-012.html + abspos/position-absolute-013.html + abspos/position-absolute-014.html + abspos/position-absolute-015.html + abspos/position-absolute-containing-block-001.html + abspos/position-absolute-containing-block-002.html + alignment/flex-content-alignment-with-abspos-001.html + dynamic-grid-flex-abspos.html + flexbox_stf-abspos.html + flex-item-position-relative-001.html + + +
+ 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. +
+ +

+Flex Item Margins and Paddings

+ + The margins of adjacent flex items do not + collapse. + + 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. + + 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. + + + empty-flex-box-and-margin-collapsing.html + flex-container-margin.html + flexitem-no-margin-collapsing.html + flex-margin-no-collapse.html + negative-margins-001.html + + +

+Flex Item Z-Ordering

+ + Flex items paint exactly the same as inline blocks [[!CSS2]], + except that 'order'-modified document order is used in place of raw document order, + and 'z-index' + values other than ''z-index/auto'' create a stacking context + even if 'position' is ''static'' + (behaving exactly as if 'position' were ''relative''). + + Note: Descendants that are positioned outside a flex item still participate + in any stacking context established by the flex item. + + + flexbox-paint-ordering-001.xhtml + flexbox-paint-ordering-002.xhtml + flexbox-paint-ordering-003.html + flex-item-z-ordering-001.html + flex-item-z-ordering-002.html + flexbox-items-as-stacking-contexts-001.xhtml + flexbox-items-as-stacking-contexts-002.html + flexbox-items-as-stacking-contexts-003.html + hittest-overlapping-margin.html + hittest-overlapping-order.html + hittest-overlapping-relative.html + + + + +

+Collapsed Items

+ + 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. + + Though [=collapsed flex items=] aren't rendered, + they do appear in the formatting structure. + Therefore, unlike on ''display:none'' items [[!CSS2]], + effects that depend on a box appearing in the formatting structure + (like incrementing counters or running animations and transitions) + still operate on collapsed items. + + + flexbox_visibility-collapse.html + flexbox_visibility-collapse-line-wrapping.html + + +
+ 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. + +
+
Sample live rendering for example code below
+
+ + +
+ Hover over the menu to the left: + each section expands to show its sub-items. + In order to keep the sidebar width (and this main area width) stable, + ''visibility: collapse'' is used instead of ''display: none''. + This results in a sidebar that is always wide enough for the word “Architecture”, + even though it is not always visible. +
+
+
+ +
+			  @media (min-width: 60em) {
+			    /* two column layout only when enough room (relative to default text size) */
+			    div { display: flex; }
+			    #main {
+			      flex: 1;         /* Main takes up all remaining space */
+			      order: 1;        /* Place it after (to the right of) the navigation */
+			      min-width: 12em; /* Optimize main content area sizing */
+			    }
+			  }
+			  /* menu items use flex layout so that visibility:collapse will work */
+			  nav > ul > li {
+			    display: flex;
+			    flex-flow: column;
+			  }
+			  /* dynamically collapse submenus when not targeted */
+			  nav > ul > li:not(:target):not(:hover) > ul {
+			    visibility: collapse;
+			  }
+		
+
+			<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>
+			…
+		
+
+ + To compute the size of the strut, flex layout is first performed with all items uncollapsed, + and then re-run with each [=collapsed flex 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. + + 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.) + + + +

+Automatic Minimum Size of Flex Items

+ + Note: The ''min-width/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-3|CSS Sizing]] module. + + 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 whose [=computed value|computed=] 'overflow' value is [=non-scrollable overflow value|non-scrollable=] + is its [=content-based minimum size=]; + for scroll containers the automatic minimum size is zero, as usual. + + The content-based minimum size of a [=flex item=] + differs depending on whether the [=flex item=] is [=replaced element|replaced=] or not: + + : For [=replaced elements=] + :: + Use the smaller of the [=content size suggestion=] + and the [=transferred size suggestion=] + (if one exists), + capped by the [=specified size suggestion=] + (if one exists). + + : For [=non-replaced elements=] + :: + Use the larger of the [=content size suggestion=] + and the [=transferred size suggestion=] + (if one exists), + capped by the [=specified size suggestion=] + (if one exists). + + In either case, + the size is clamped by the [=maximum size|maximum=] [=main size=] + if it's definite. -

+ + image-items-flake-001.html + + + + + The content size suggestion, specified size suggestion, and transferred size suggestion + used in this calculation account for the relevant min/max/preferred size properties + so that the content-based minimum size does not interfere with any author-provided constraints, + and are defined below: + +
+
specified size suggestion +
+ If the item’s [=preferred size|preferred=] [=main size=] is definite and not [=automatic size|automatic=], + then the specified size suggestion is that size. + It is otherwise undefined. + +
transferred size suggestion +
+ If the item has a [=preferred aspect ratio=] + and its [=preferred size|preferred=] [=cross size=] is definite, + then the transferred size suggestion is that size + (clamped by its [=minimum size|minimum=] and [=maximum size|maximum=] [=cross sizes=] if they are definite), + converted through the aspect ratio. + It is otherwise undefined. + +
content size suggestion +
+ The content size suggestion is the min-content size in the main axis, + clamped, if it has a [=preferred aspect ratio=], + by any definite [=minimum size|minimum=] and [=maximum size|maximum=] [=cross sizes=] converted through the aspect ratio. +
+ + + content-height-with-scrollbars.html + fieldset-as-item-dynamic.html + fieldset-as-item-overflow.html + flex-aspect-ratio-img-column-001.html + flex-aspect-ratio-img-column-002.html + flex-aspect-ratio-img-column-003.html + flex-aspect-ratio-img-column-004.html + flex-aspect-ratio-img-column-005.html + flex-aspect-ratio-img-column-006.html + flex-aspect-ratio-img-column-007.html + flex-aspect-ratio-img-column-008.html + flex-aspect-ratio-img-column-009.html + flex-aspect-ratio-img-column-010.html + flex-aspect-ratio-img-column-011.html + flex-aspect-ratio-img-column-012.html + flex-aspect-ratio-img-column-013.html + flex-aspect-ratio-img-column-014.html + flex-aspect-ratio-img-column-015.html + flex-aspect-ratio-img-column-016.html + flex-aspect-ratio-img-column-017.html + flex-aspect-ratio-img-column-018.html + flex-aspect-ratio-img-row-001.html + flex-aspect-ratio-img-row-002.html + flex-aspect-ratio-img-row-003.html + flex-aspect-ratio-img-row-004.html + flex-aspect-ratio-img-row-005.html + flex-aspect-ratio-img-row-006.html + flex-aspect-ratio-img-row-007.html + flex-aspect-ratio-img-row-008.html + flex-aspect-ratio-img-row-009.html + flex-aspect-ratio-img-row-010.html + flex-aspect-ratio-img-row-011.html + flex-aspect-ratio-img-row-012.html + flex-aspect-ratio-img-row-013.html + flex-aspect-ratio-img-row-014.html + flex-aspect-ratio-img-row-015.html + flex-aspect-ratio-img-row-016.html + flex-aspect-ratio-img-row-017.html + flex-aspect-ratio-img-vert-lr.html + flexbox-definite-cross-size-constrained-percentage.html + flexbox-min-height-auto-001.html + flexbox-min-height-auto-002a.html + flexbox-min-height-auto-002b.html + flexbox-min-height-auto-002c.html + flexbox-min-height-auto-003.html + flexbox-min-height-auto-004.html + flexbox-min-width-auto-001.html + flexbox-min-width-auto-002a.html + flexbox-min-width-auto-002b.html + flexbox-min-width-auto-002c.html + flexbox-min-width-auto-003.html + flexbox-min-width-auto-004.html + flexbox-min-width-auto-005.html + flexbox-min-width-auto-006.html + flex-item-compressible-001.html + flex-item-compressible-002.html + flexitem-stretch-image.html + flexitem-stretch-range.html + flex-minimum-height-flex-items-001.xht + flex-minimum-height-flex-items-002.xht + flex-minimum-height-flex-items-003.xht + flex-minimum-height-flex-items-004.xht + flex-minimum-height-flex-items-005.xht + flex-minimum-height-flex-items-006.xht + flex-minimum-height-flex-items-007.xht + flex-minimum-height-flex-items-008.xht + flex-minimum-height-flex-items-009.html + flex-minimum-height-flex-items-010.html + flex-minimum-height-flex-items-011.xht + flex-minimum-height-flex-items-012.html + flex-minimum-height-flex-items-013.html + flex-minimum-height-flex-items-014.html + flex-minimum-height-flex-items-015.html + flex-minimum-height-flex-items-016.html + flex-minimum-height-flex-items-017.html + flex-minimum-height-flex-items-018.html + flex-minimum-height-flex-items-019.html + flex-minimum-height-flex-items-020.html + flex-minimum-height-flex-items-021.html + flex-minimum-height-flex-items-022.html + flex-minimum-height-flex-items-023.html + flex-minimum-height-flex-items-024.html + flex-minimum-height-flex-items-025.html + flex-minimum-height-flex-items-026.html + flex-minimum-height-flex-items-027.html + flex-minimum-height-flex-items-028.html + flex-minimum-height-flex-items-029.html + flex-minimum-height-flex-items-030.html + flex-minimum-height-flex-items-031.html + flex-minimum-size-001.html + flex-minimum-size-002.html + flex-minimum-size-003.html + flex-minimum-width-flex-items-001.xht + flex-minimum-width-flex-items-002.xht + flex-minimum-width-flex-items-003.xht + flex-minimum-width-flex-items-004.xht + flex-minimum-width-flex-items-005.xht + flex-minimum-width-flex-items-006.xht + flex-minimum-width-flex-items-007.xht + flex-minimum-width-flex-items-008.xht + flex-minimum-width-flex-items-009.html + flex-minimum-width-flex-items-010.html + flex-minimum-width-flex-items-011.html + flex-minimum-width-flex-items-012.html + flex-minimum-width-flex-items-013.html + flex-minimum-width-flex-items-014.html + flex-minimum-width-flex-items-015.html + flex-minimum-width-flex-items-016.html + getcomputedstyle/flexbox_computedstyle_min-auto-size.html + getcomputedstyle/flexbox_computedstyle_min-height-auto.html + getcomputedstyle/flexbox_computedstyle_min-width-auto.html + select-element-zero-height-001.html + select-element-zero-height-002.html + + + Note: The [=content-based minimum size=] is a type of [=intrinsic size contribution=], + and thus the cyclic percentage provisions in [[css-sizing-3#intrinsic-contribution]] apply. + + 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=]. + + For any purpose other than calculating intrinsic sizes, + a [=content-based minimum size=] + (unlike an explicit ''min-content''/etc [=minimum size=]) + does not force the box's size to become indefinite. + However, if a percentage resolved against the box's size before this minimum was applied, + it must be re-resolved against the new size after it is applied. + +
+ 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: + + 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. + + 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.) +
+ + + aspect-ratio-intrinsic-size-001.html + aspect-ratio-intrinsic-size-002.html + aspect-ratio-intrinsic-size-003.html + aspect-ratio-intrinsic-size-004.html + aspect-ratio-intrinsic-size-005.html + aspect-ratio-intrinsic-size-006.html + aspect-ratio-intrinsic-size-007.html + aspect-ratio-intrinsic-size-008.html + aspect-ratio-intrinsic-size-009.html + aspect-ratio-intrinsic-size-010.html + aspect-ratio-transferred-max-size.html + flex-item-content-is-min-width-max-content.html + + + +

Ordering and Orientation

-... + 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. + + 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 [[css-display-3#order-accessibility]] + and the Flex Layout Overview for examples + that use this dichotomy to improve accessibility. + + Advisement: + 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. + + + +

+Flex Flow Direction: the 'flex-direction' property

+ +
+	Name: flex-direction
+	Value: row | row-reverse | column | column-reverse
+	Initial: row
+	Applies to: flex containers
+	Inherited: no
+	Computed value: specified keyword
+	Animation type: discrete
+	
+ + 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 +
+ 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. + + + flex-child-percent-basis-resize-1.html + flexbox-flex-basis-content-001a.html + flexbox-flex-basis-content-001b.html + flexbox-flex-direction-row.htm + flexbox_justifycontent-left-001.html + flexbox-writing-mode-010.html + flexbox-writing-mode-011.html + flexbox-writing-mode-012.html + flexbox-writing-mode-016.html + percentage-size.html + + +
row-reverse +
+ Same as ''row'', + except the main-start and main-end directions are swapped. + + + flexbox_direction-row-reverse.html + flexbox-mbp-horiz-001-reverse.xhtml + flexbox-mbp-horiz-001-rtl-reverse.xhtml + flex-lines/multi-line-wrap-with-row-reverse.html + flexbox_justifycontent-right-001.html + flexbox_justifycontent-start.html + flexbox_justifycontent-start-rtl.html + + +
column +
+ 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. + + + columns-height-set-via-top-bottom.html + dynamic-bsize-change.html + flexbox_direction-column.html + flexbox_direction-column-reverse.html + flexbox_rtl-flow.html + flex-column-relayout-assert.html + flex-item-max-height-min-content.html + flex-item-transferred-sizes-padding-border-sizing.html + flex-item-transferred-sizes-padding-content-sizing.html + flex-outer-flexbox-column-recalculate-height-on-resize-001.html + image-nested-within-definite-column-flexbox.html + layout-with-inline-svg-001.html + nested-orthogonal-flexbox-relayout.html + percentage-max-width-cross-axis.html + percentage-size.html + + +
column-reverse +
+ Same as ''column'', + except the main-start and main-end directions are swapped. + + + column-reverse-gap.html + flexbox_rtl-direction.html + flex-lines/multi-line-wrap-with-column-reverse.html + +
+ + 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. + + Note: Depending on the value of 'justify-content', + the reverse values of 'flex-direction' can alter the initial scroll position + on [=flex containers=] that are also [=scroll containers=]. + See [[css-align-3#overflow-scroll-position]]. + + + animation/discrete-no-interpolation.html + change-column-flex-width.html + column-flex-child-with-max-width.html + column-flex-child-with-overflow-scroll.html + cross-axis-scrollbar.html + dynamic-orthogonal-flex-item.html + flexbox-writing-mode-001.html + flexbox-writing-mode-002.html + flexbox-writing-mode-003.html + flexbox-writing-mode-004.html + flexbox-writing-mode-005.html + flexbox-writing-mode-006.html + flexbox-writing-mode-007.html + flexbox-writing-mode-008.html + flexbox-writing-mode-009.html + flexbox-writing-mode-010.html + flexbox-writing-mode-011.html + flexbox-writing-mode-012.html + flexbox-writing-mode-013.html + flexbox-writing-mode-014.html + flexbox-writing-mode-015.html + flexbox-writing-mode-016.html + flexbox-writing-mode-slr.html + flexbox-writing-mode-slr-row-mix.html + flexbox-writing-mode-slr-rtl.html + flexbox-writing-mode-srl.html + flexbox-writing-mode-srl-row-mix.html + flexbox-writing-mode-srl-rtl.html + flexbox_object.html + flexbox_writing_mode_vertical_lays_out_contents_from_top_to_bottom.html + getcomputedstyle/flexbox_computedstyle_flex-direction-column.html + getcomputedstyle/flexbox_computedstyle_flex-direction-column-reverse.html + getcomputedstyle/flexbox_computedstyle_flex-direction-invalid.html + getcomputedstyle/flexbox_computedstyle_flex-direction-row.html + getcomputedstyle/flexbox_computedstyle_flex-direction-row-reverse.html + + +

Flex Line Wrapping: the 'flex-wrap' property

@@ -62,9 +1740,8 @@ Flex Line Wrapping: the 'flex-wrap' property
balance
The flex container is [=multi-line=], - and attempts to "balance" the lengths of the [=flex lines=] + and attempts to [=balance=] the lengths of the [=flex lines=] to be as similar as possible. - See [[#flex-balance]]. ''balance'' can be combined with ''wrap'' or ''wrap-reverse'' to dictate which direction the [=flex lines=] are stacked in. @@ -72,92 +1749,1917 @@ Flex Line Wrapping: the 'flex-wrap' property it behaves as if ''wrap'' was specified. - By default, the [=cross-start=] direction of the [=flex container=] - is either the inline-start or block-start direction - of the [=flex container's=] writing mode - (whichever is in the cross axis) - and the cross-end direction is the opposite direction of cross-start. - If ''wrap-reverse'' is specified, - the cross-start and cross-end directions - are swapped. + By default, the [=cross-start=] direction of the [=flex container=] + is either the inline-start or block-start direction + of the [=flex container's=] writing mode + (whichever is in the cross axis) + and the cross-end direction is the opposite direction of cross-start. + If ''wrap-reverse'' is specified, + the cross-start and cross-end directions + are swapped. + + Note: Depending on the value of 'align-content', + the ''wrap-reverse'' value of 'flex-wrap' can alter the initial scroll position + on [=flex containers=] that are also [=scroll containers=]. + See [[css-align-3#overflow-scroll-position]]. + + + animation/discrete-no-interpolation.html + flexbox-flex-wrap-default.htm + flexbox-flex-wrap-flexing-002.html + flexbox-flex-wrap-flexing-003.html + flexbox-flex-wrap-flexing.html + flexbox-flex-wrap-horiz-001.html + flexbox-flex-wrap-horiz-002.html + flexbox-flex-wrap-nowrap.htm + flexbox-flex-wrap-vert-001.html + flexbox-flex-wrap-vert-002.html + flexbox-flex-wrap-wrap.htm + flexbox-flex-wrap-wrap-reverse.htm + flexbox_rowspan.html + flexbox_rtl-flow.html + flexbox_rtl-flow-reverse.html + flexbox_rtl-order.html + flex-box-wrap.html + flexbox_wrap.html + flexbox_wrap-long.html + flexbox_wrap-reverse.html + flex-lines/multi-line-wrap-reverse-column-reverse.html + flex-lines/multi-line-wrap-reverse-row-reverse.html + getcomputedstyle/flexbox_computedstyle_flex-wrap-invalid.html + getcomputedstyle/flexbox_computedstyle_flex-wrap-nowrap.html + getcomputedstyle/flexbox_computedstyle_flex-wrap-wrap.html + getcomputedstyle/flexbox_computedstyle_flex-wrap-wrap-reverse.html + multiline-min-preferred-width.html + multiline-reverse-wrap-baseline.html + + + + + +

+Flex Direction and Wrap: the 'flex-flow' shorthand

+ +
+	Name: flex-flow
+	Value: <<'flex-direction'>> || <<'flex-wrap'>>
+	
+ + + box-sizing-001.html + button-column-wrap-crash.html + column-intrinsic-size-aspect-ratio-crash.html + css-flexbox-row.html + css-flexbox-row-reverse.html + css-flexbox-row-reverse-wrap.html + css-flexbox-row-reverse-wrap-reverse.html + css-flexbox-row-wrap.html + css-flexbox-row-wrap-reverse.html + css-flexbox-test1.html + flexbox-flex-direction-column.htm + flexbox-flex-direction-column-percentage-ignored.html + flexbox-flex-direction-column-reverse.htm + flexbox-flex-direction-default.htm + flexbox-flex-direction-row.htm + flexbox-flex-direction-row-reverse.htm + flex-direction-column-001-visual.html + flex-direction-column.html + flex-direction-column-overlap-001.html + flex-direction-column-reverse-001-visual.html + flex-direction-column-reverse-002-visual.html + flex-direction-column-reverse.html + flex-direction.html + flex-direction-modify.html + flex-direction-row-001-visual.html + flex-direction-row-002-visual.html + flex-direction-row-reverse-001-visual.html + flex-direction-row-reverse-002-visual.html + flex-direction-row-reverse.html + flex-direction-row-vertical.html + flex-direction-with-element-insert.html + flexbox-flex-flow-001.html + flexbox-flex-flow-002.html + flexbox_flow-column-reverse-wrap.html + flexbox_flow-column-reverse-wrap-reverse.html + flexbox_flow-column-wrap.html + flexbox_flow-column-wrap-reverse.html + flexbox_flow-row-wrap.html + flexbox_flow-row-wrap-reverse.html + flex-flow-001.html + flex-flow-002.html + flex-flow-003.html + flex-flow-004.html + flex-flow-005.html + flex-flow-006.html + flex-flow-007.html + flex-flow-008.html + flex-flow-009.html + flex-flow-010.html + flex-flow-011.html + flex-flow-012.html + flex-flow-013.html + flex-wrap-002.html + flex-wrap-003.html + flex-wrap-004.html + flex-wrap-005.html + flex-wrap-006.html + getcomputedstyle/flexbox_computedstyle_flex-flow-column.html + getcomputedstyle/flexbox_computedstyle_flex-flow-column-nowrap.html + getcomputedstyle/flexbox_computedstyle_flex-flow-column-reverse.html + getcomputedstyle/flexbox_computedstyle_flex-flow-column-reverse-nowrap.html + getcomputedstyle/flexbox_computedstyle_flex-flow-column-reverse-wrap.html + getcomputedstyle/flexbox_computedstyle_flex-flow-column-wrap.html + getcomputedstyle/flexbox_computedstyle_flex-flow-column-wrap-reverse.html + getcomputedstyle/flexbox_computedstyle_flex-flow-nowrap.html + getcomputedstyle/flexbox_computedstyle_flex-flow-row.html + getcomputedstyle/flexbox_computedstyle_flex-flow-row-nowrap.html + getcomputedstyle/flexbox_computedstyle_flex-flow-row-reverse.html + getcomputedstyle/flexbox_computedstyle_flex-flow-row-reverse-nowrap.html + getcomputedstyle/flexbox_computedstyle_flex-flow-row-reverse-wrap.html + getcomputedstyle/flexbox_computedstyle_flex-flow-row-reverse-wrap-reverse.html + getcomputedstyle/flexbox_computedstyle_flex-flow-row-wrap.html + getcomputedstyle/flexbox_computedstyle_flex-flow-row-wrap-reverse.html + getcomputedstyle/flexbox_computedstyle_flex-flow-wrap.html + multiline-column-max-height.html + parsing/flex-direction-computed.html + parsing/flex-direction-invalid.html + parsing/flex-direction-valid.html + parsing/flex-flow-computed.html + parsing/flex-flow-invalid.html + parsing/flex-flow-shorthand.html + parsing/flex-flow-valid.html + parsing/flex-wrap-computed.html + parsing/flex-wrap-invalid.html + parsing/flex-wrap-valid.html + + + 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. + +
+ Some examples of valid flows in an English (left-to-right, horizontal writing mode) document: + + + + + +
+
+					div { flex-flow: row; }
+					/* Initial value. Main-axis is inline, no wrapping.
+					   (Items will either shrink to fit or overflow.) */
+					
+
+
+
+					div { flex-flow: column wrap; }
+					/* Main-axis is block-direction (top to bottom)
+					   and lines wrap in the inline direction (rightwards). */
+					
+
+
+
+					div { flex-flow: row-reverse wrap-reverse; }
+					/* Main-axis is the opposite of inline direction
+					   (right to left). New lines wrap upwards. */
+					
+
+
+
+ +
+ 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: + + + + + + + +
English + Japanese +
flex-flow: row wrap;
writing-mode: horizontal-tb;
+
flex-flow: row wrap;
writing-mode: vertical-rl;
+
+ +
+
+ +

+Reordering and Accessibility: the 'order' property

+ + Flex items are, by default, displayed and laid out + in the same order as they appear in the source document, + which represents their logical ordering. + This same order is used in rendering to non-visual media + (such as speech), + in the default traversal order of sequential navigation modes + (such as cycling through links, + see e.g. tabindex [[HTML]]), + and when content is represented in non-CSS UAs. + + The 'order' property can be used to change flex items’ ordering, + laying them out in [=order-modified document order=] instead, + in order to make their spatial arrangement on the 2D visual canvas + differ from their logical order in linear presentations + such as speech and sequential navigation. + See [[CSS-DISPLAY-3#order-property]]. + [[!CSS-DISPLAY-3]] + + Note: Since visual perception is two-dimensional and non-linear, + the desired box order is not always the same logical order + used by non-visual media and non-CSS UAs. + + Advisement: + Authors must use 'order' only for visual, not logical, reordering of content. + Style sheets that use 'order' to perform logical reordering are non-conforming. + +
+ 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>
+				
+
+
In this page the header is at the top and the footer at the bottom, but the article is in the center, flanked by the nav on the right and the aside on the left.
+
+ + This layout can be easily achieved with flex layout: + +
+			main { display: flex; }
+			main > article { order: 2; min-width: 12em; flex:1; }
+			main > nav     { order: 1; width: 200px; }
+			main > aside   { order: 3; width: 200px; }
+		
+ + 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: 600px) {
+				/* Too narrow to support three columns */
+				main { flex-flow: column; }
+				main > article, main > nav, main > aside {
+					/* Return them to document order */
+					order: 0; width: auto;
+				}
+			}
+		
+ + (Further use of multi-line flex containers to achieve even more intelligent wrapping left as an exercise for the reader.) +
+ + + +

+Flex Lines

+ + 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: + + * 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. + * 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. + + Additionally, a [=multi-line=] flexbox can be + a balanced flex container, + meaning it carefully chooses its linebreaks + to make the line lengths as similar as possible. + (Otherwise, it simply fills the first line, then the second, etc.) + +
+ This example shows four buttons that do not fit side-by-side horizontally, + and therefore will wrap into multiple lines. + +
+			#flex {
+				display: flex;
+				flex-flow: row wrap;
+				width: 300px;
+			}
+			.item {
+				width: 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>
+		
+ + 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. + +
+ +
An example rendering of the multi-line flex container.
+
+
+ + 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. + + 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. + + + align-content-001.htm + align-content-002.htm + align-content-003.htm + align-content-004.htm + align-content-005.htm + align-content-006.htm + align-content-007.htm + flexbox-lines-must-be-stretched-by-default.html + + +
+ 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. + +
+ + +
+ A rendering of the same as above, + but with the items all given ''flex: auto''. +
+
+
+ +
+ The above examples show three items fitting on a single line, + leaving a single item on the second line. + ''flex-wrap: balance'' will instead put two items on the first line, + then two on the second line: + +
+ + +
+ The previous example's four items, + but now balanced across the two lines + with ''flex-wrap: balance''. +
+
+ + This can have more dramatic effects when flexing items to fill the line, + as the items are more likely to flex similar amounts, + rather than the final line's items flexing a lot more: + +
+ + +
+ The same example, + but now with ''flex: auto''. +
+
+
+ +

+Minimum Flex Lines: the 'flex-line-count' property

+ +
+	Name: flex-line-count
+	Value: <>
+	Initial: 1
+	Applies to: [=multi-line=] [=flex containers=]
+	Inherited: no
+	Computed value: the specified integer, computed
+	Animation type: as integer
+	
+ + By default, a ''balance'' flexbox + will create as many lines as a normal [=multi-line=] flexbox, + then rebalance how the flex items are assigned across that many lines. + In some situations, + an author might want to ensure there are always a certain number of lines, + or might be using a flexbox in a way where there is no limit to the line length + (the standard for a ''column'' flexbox, with unlimited available height) + and so the "default" line number calculation is useless. + The 'flex-line-count' property specifies a minimum flex line count + that the [=flex container=] should create + to balance the items across. + + The [=minimum flex line count=] is clamped from above + by the number of [=flex items=] in the [=flex container=]; + it will only create as many lines as there are [=flex items=]. + (That is, if you specify ''flex-line-count: 3'' + but only have two [=flex items=], + the [=minimum flex line count=] is 2, instead.) + + Note: There is no maximum flex line count; + the [=flex container=] will always contain enough lines + to hold all of its [=flex items=], + which might be more than what 'flex-line-count' specifies. + + Unused lines (ones with no [=flex items=] assigned to them) + are discarded and do not affect layout. + This only affects non-''balance'' flexboxes. + A ''balance'' flexbox will always assign at least one [=flex item=] to each line, + and if it has less items than 'flex-line-count', + that's handled specially, above. + + In addition to setting a minimum number of lines that are used by ''balance'', + 'flex-line-count' changes the [=available space=] in the [=cross axis=] for [=flex items=]: + subtracting the size of N-1 gaps from the normal [=available space=], + then dividing the leftover by N, + where N is the 'flex-line-count' value. + This uses the actual 'flex-line-count' value, + not the [=minimum flex line count=] + or the actual number of generated lines + (which can be higher or lower than what is specified). + + Note: This [=available space=] adjustment is the only effect 'flex-line-count' has + on non-''balance'' flexboxes. + + Percentages continue to resolve as normal, + unaffected by this [=available space=] adjustment. + (To have a [=flex item=] fill the [=cross-axis=] [=available space=], + use ''width/height: stretch'', + rather than ''width/height: 100%''.) + + If the [=flex container=] is [=single-line=] + (aka, ''flex-wrap: nowrap''), + this property has no effect. + + + +

+Flexibility

+ + 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. + + A flex item is fully inflexible + if both its 'flex-grow' and 'flex-shrink' values are zero, + and flexible otherwise. + + + flex-factor-less-than-one.html + + +

+The 'flex' Shorthand

+ +
+	Name: flex
+	Value: none | [ <<'flex-grow'>> <<'flex-shrink'>>? || <<'flex-basis'>> ]
+	Initial: 0 1 auto
+	Applies to: flex items
+	Inherited: no
+	Animation type: by computed value type
+	
+ + + flexbox-dyn-resize-001.html + flex-item-max-width-min-content.html + flex-item-min-height-min-content.html + flex-item-min-width-min-content.html + flex-shorthand-calc.html + parsing/flex-computed.html + parsing/flex-invalid.html + parsing/flex-shorthand.html + parsing/flex-valid.html + + + The 'flex' property specifies the components of a [=flexible=] size: + 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. + + Note: The initial values of the 'flex' longhands are equivalent to + flex: 0 1 auto. + This differs from their defaults when omitted in the 'flex' shorthand + (effectively ''1 1 0px'') + so that the 'flex' shorthand can better accommodate + the most common cases. + +
+
<<'flex-grow'>> +
+ This <> 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''. + + + animation/flex-grow-interpolation.html + flex-001.htm + flex-003.htm + flex-grow-001.xht + flex-grow-002.html + flex-grow-003.html + flex-grow-004.html + flex-grow-005.html + flex-grow-006.html + flex-grow-007.html + flex-grow-008.html + flexbox_flex-natural.html + flexbox_flex-natural-mixed-basis-auto.html + flexbox_flex-natural-mixed-basis.html + flexbox_flex-natural-variable-auto-basis.html + flexbox_flex-natural-variable-zero-basis.html + flexbox_flex-none.html + flexbox_flex-none-wrappable-content.html + flex-factor-less-than-one.html + getcomputedstyle/flexbox_computedstyle_flex-shorthand-0-auto.html + getcomputedstyle/flexbox_computedstyle_flex-shorthand-auto.html + getcomputedstyle/flexbox_computedstyle_flex-shorthand.html + getcomputedstyle/flexbox_computedstyle_flex-shorthand-initial.html + getcomputedstyle/flexbox_computedstyle_flex-shorthand-invalid.html + getcomputedstyle/flexbox_computedstyle_flex-shorthand-none.html + getcomputedstyle/flexbox_computedstyle_flex-shorthand-number.html + getcomputedstyle/flexbox_computedstyle_flex-grow-0.html + getcomputedstyle/flexbox_computedstyle_flex-grow-invalid.html + getcomputedstyle/flexbox_computedstyle_flex-grow-number.html + interactive/flexbox_interactive_flex-grow-transitions.html + parsing/flex-grow-computed.html + parsing/flex-grow-invalid.html + parsing/flex-grow-valid.html + table-item-flex-percentage-min-width.html + table-item-flex-percentage-width.html + + +
+ 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. + + 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 [[#resolve-flexible-lengths]] for the exact details + of how free space is distributed. + + 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. + + 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'>> +
+ This <> 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''. + + + animation/flex-shrink-interpolation.html + flex-002.htm + flex-004.htm + flex-factor-less-than-one.html + flex-shrink-001.html + flex-shrink-002.html + flex-shrink-003.html + flex-shrink-004.html + flex-shrink-005.html + flex-shrink-006.html + flex-shrink-007.html + flex-shrink-008.html + flex-shrink-large-value-crash.html + getcomputedstyle/flexbox_computedstyle_flex-shrink-0.html + getcomputedstyle/flexbox_computedstyle_flex-shrink-invalid.html + getcomputedstyle/flexbox_computedstyle_flex-shrink-number.html + interactive/flexbox_interactive_flex-shrink-transitions.html + interactive/flexbox_interactive_flex-shrink-transitions-invalid.html + parsing/flex-shrink-computed.html + parsing/flex-shrink-invalid.html + parsing/flex-shrink-valid.html + table-item-flex-percentage-min-width.html + table-item-flex-percentage-width.html + + + 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-item-max-width-min-content-002.html + + +
<<'flex-basis'>> +
+ 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. + + + animation/flex-basis-composition.html + animation/flex-basis-content-crash.html + animation/flex-basis-interpolation.html + dynamic-isize-change-001.html + dynamic-isize-change-002.html + dynamic-isize-change-003.html + dynamic-isize-change-004.html + flex-basis-001.html + flex-basis-002.html + flex-basis-003.html + flex-basis-004.html + flex-basis-005.html + flex-basis-006.html + flex-basis-007.html + flex-basis-008.html + flex-basis-009.html + flex-basis-010.html + flex-basis-011.html + flex-basis-012.html + flex-basis-013.html + flex-basis-intrinsics-001.html + flex-basis-item-margins-001.html + flexbox-flex-basis-content-001a.html + flexbox-flex-basis-content-001b.html + flexbox-flex-basis-content-002a.html + flexbox-flex-basis-content-002b.html + flexbox-flex-basis-content-003a.html + flexbox-flex-basis-content-003b.html + flexbox-flex-basis-content-004a.html + flexbox-flex-basis-content-004b.html + flexbox_flex-basis.html + flexbox_flex-basis-shrink.html + flex-one-sets-flex-basis-to-zero-px.html + flex-shorthand-flex-basis-middle.html + getcomputedstyle/flexbox_computedstyle_flex-basis-0.html + getcomputedstyle/flexbox_computedstyle_flex-basis-0percent.html + getcomputedstyle/flexbox_computedstyle_flex-basis-auto.html + getcomputedstyle/flexbox_computedstyle_flex-basis-percent.html + interactive/flexbox_interactive_flex-basis-transitions.html + parsing/flex-basis-computed.html + parsing/flex-basis-invalid.html + parsing/flex-basis-valid.html + table-as-item-percent-width-cell-001.html + + + <<'flex-basis'>> accepts the same values as the 'width' and 'height' properties + (except that ''flex-basis/auto'' is treated differently) + plus the ''content'' keyword: + +
+
auto +
+ When specified on a flex item, the ''flex-basis/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 ''flex-basis/content''. + +
content +
+ Indicates an [=automatic size=] + based on the flex item’s content. + (This is typically equivalent to the max-content size, + but with adjustments to handle [=preferred aspect ratios=], + intrinsic sizing constraints, + and orthogonal flows; + see details in [[#layout-algorithm]].) + + 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 ''flex/auto'' + together with a main size ('width' or 'height') of ''width/auto''. + +
<<'width'>> +
+ For all other values, + 'flex-basis' is resolved the same way as for 'width' and 'height'. +
+ + When omitted from the 'flex' shorthand, its specified value is ''0''. + +
none +
+ The keyword ''flex/none'' expands to ''0 0 auto''. +
+ +
+ +
+ A diagram showing the difference between "absolute" flex + (starting from a basis of zero) + and "relative" flex + (starting from a basis of the item's content size). + The three items have flex factors of ''1'', ''1'', and ''2'', respectively: + notice that the item with a flex factor of ''2'' grows twice as fast as the others. +
+
+ + 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. + +

+Basic Values of 'flex'

+ + This section is informative. + + The list below summarizes the effects of the four 'flex' values + that represent most commonly-desired effects: + +
+
''flex: initial'' +
+ 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: 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: none'' +
+ 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: <number [1,∞]>'' +
+ Equivalent to ''flex: <number [1,∞]> 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. +
+ + + flexbox_flex-auto.html + flexbox_flex-initial-2.html + flexbox_flex-initial.html + radiobutton-min-size.html + + + 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 [[#min-size-auto]].) + +

+Components of Flexibility

+ + Individual components of flexibility can be controlled by independent longhand properties. + + Advisement: 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. + +

+The 'flex-grow' property

+ +
+	Name: flex-grow
+	Value: <>
+	Initial: 0
+	Applies to: flex items
+	Inherited: no
+	Computed value: specified number
+	Animation type: by computed value type
+	
+ + + + animation/flex-grow-interpolation.html + flex-001.htm + flex-003.htm + flex-grow-001.xht + flex-grow-002.html + flex-grow-003.html + flex-grow-004.html + flex-grow-005.html + flex-grow-006.html + flex-grow-007.html + flex-grow-008.html + getcomputedstyle/flexbox_computedstyle_flex-grow-0.html + getcomputedstyle/flexbox_computedstyle_flex-grow-invalid.html + getcomputedstyle/flexbox_computedstyle_flex-grow-number.html + interactive/flexbox_interactive_flex-grow-transitions.html + parsing/flex-grow-computed.html + parsing/flex-grow-invalid.html + parsing/flex-grow-valid.html + + + Advisement: 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. + + The 'flex-grow' property sets the flex grow factor + to the provided <>. + Negative values are not allowed. + +

+The 'flex-shrink' property

+ +
+	Name: flex-shrink
+	Value: <>
+	Initial: 1
+	Applies to: flex items
+	Inherited: no
+	Computed value: specified value
+	Animation type: number
+	
+ + + animation/flex-shrink-interpolation.html + flex-002.htm + flex-004.htm + flex-shrink-001.html + flex-shrink-002.html + flex-shrink-003.html + flex-shrink-004.html + flex-shrink-005.html + flex-shrink-006.html + flex-shrink-007.html + flex-shrink-008.html + flex-shrink-large-value-crash.html + getcomputedstyle/flexbox_computedstyle_flex-shrink-0.html + getcomputedstyle/flexbox_computedstyle_flex-shrink-invalid.html + getcomputedstyle/flexbox_computedstyle_flex-shrink-number.html + interactive/flexbox_interactive_flex-shrink-transitions.html + interactive/flexbox_interactive_flex-shrink-transitions-invalid.html + parsing/flex-shrink-computed.html + parsing/flex-shrink-invalid.html + parsing/flex-shrink-valid.html + + + Advisement: 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. + + The 'flex-shrink' property sets the flex shrink factor + to the provided <>. + Negative values are not allowed. + +

+The 'flex-basis' property

+ +
+	Name: flex-basis
+	Value: content | <<'width'>>
+	Initial: auto
+	Applies to: flex items
+	Inherited: no
+	Percentages: relative to the flex container's inner main size
+	Computed value: specified keyword or a computed <> value
+	Animation type: by computed value type
+	
+ + + animation/flex-basis-composition.html + animation/flex-basis-content-crash.html + animation/flex-basis-interpolation.html + dynamic-isize-change-001.html + dynamic-isize-change-002.html + dynamic-isize-change-003.html + dynamic-isize-change-004.html + flex-basis-001.html + flex-basis-002.html + flex-basis-003.html + flex-basis-004.html + flex-basis-005.html + flex-basis-006.html + flex-basis-007.html + flex-basis-008.html + flex-basis-009.html + flex-basis-010.html + flex-basis-011.html + flex-basis-012.html + flex-basis-013.html + flex-basis-intrinsics-001.html + flex-basis-item-margins-001.html + flexbox-flex-basis-content-001a.html + flexbox-flex-basis-content-001b.html + flexbox-flex-basis-content-002a.html + flexbox-flex-basis-content-002b.html + flexbox-flex-basis-content-003a.html + flexbox-flex-basis-content-003b.html + flexbox-flex-basis-content-004a.html + flexbox-flex-basis-content-004b.html + flexbox_flex-basis.html + flexbox_flex-basis-shrink.html + flex-one-sets-flex-basis-to-zero-px.html + flex-shorthand-flex-basis-middle.html + getcomputedstyle/flexbox_computedstyle_flex-basis-0.html + getcomputedstyle/flexbox_computedstyle_flex-basis-0percent.html + getcomputedstyle/flexbox_computedstyle_flex-basis-auto.html + getcomputedstyle/flexbox_computedstyle_flex-basis-percent.html + interactive/flexbox_interactive_flex-basis-transitions.html + parsing/flex-basis-computed.html + parsing/flex-basis-invalid.html + parsing/flex-basis-valid.html + + + Advisement: 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. + + The 'flex-basis' property sets the flex basis. + It accepts the same values as the 'width' and 'height' property, plus ''content''. + + For all values other than ''flex-basis/auto'' and ''content'' (defined above), + 'flex-basis' is resolved the same way as 'width' in horizontal writing modes [[!CSS2]], + except that if a value would resolve to ''width/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]]. + +

+Alignment

+ + 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. + + 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. + + 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 other words, the Box Alignment module, once completed, + will supersede the definitions here. + + + baseline-outside-flex-item.html + fieldset-baseline-alignment.html + + + + +

+Aligning with auto margins

+ + This section is non-normative. + The normative definition of how margins affect flex items is in the Flex Layout Algorithm section. + + Auto margins on flex items have an effect very similar to auto margins in block flow: + + * During calculations of flex bases and flexible lengths, auto margins are treated as ''0''. + * Prior to alignment via 'justify-content' and 'align-self', + any positive free space is distributed to auto margins in that dimension. + * Overflowing boxes ignore their auto margins and overflow in the end direction. + + + auto-height-column-with-border-and-padding.html + auto-height-with-flex.html + auto-margins-001.html + auto-margins-002.html + auto-margins-003.html + flexbox-margin-auto-horiz-001.xhtml + flexbox-margin-auto-horiz-002.xhtml + flexbox_margin-auto.html + flexbox_margin-auto-overflow.html + + + 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. + +
+ One use of ''margin/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. + +
+
+ Sample rendering of the code below. +
+ +
+ +
+			nav > ul {
+				display: flex;
+			}
+			nav > ul > #login {
+				margin-left: 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>
+		
+
+ +
+ The figure below illustrates the difference in cross-axis alignment in overflow situations between + using auto margins + and using the alignment properties. + +
+
+
+
+
About
+
Authoritarianism
+
Blog
+
+
+
+
+
About
+
Authoritarianism
+
Blog
+
+
+
+
+ The items in the figure on the left are centered with margins, + while those in the figure on the right are centered with 'align-self'. + If this column flex container was placed against the left edge of the page, + the margin behavior would be more desirable, + as the long item would be fully readable. + In other circumstances, + the true centering behavior might be better. +
+
+
+ + + +

+Axis Alignment: the 'justify-content' property

+ +
+	Name: justify-content
+	Value: flex-start | flex-end | center | space-between | space-around
+	Initial: flex-start
+	Applies to: flex containers
+	Inherited: no
+	Computed value: specified keyword
+	Animation type: discrete
+	
+ + + dynamic-isize-change-001.html + dynamic-isize-change-002.html + dynamic-isize-change-003.html + dynamic-isize-change-004.html + flexbox_justifycontent-center.html + flexbox_justifycontent-center-overflow.html + flexbox_justifycontent-end.html + flexbox_justifycontent-end-rtl.html + flexbox_justifycontent-flex-end.html + flexbox_justifycontent-flex-start.html + flexbox-justify-content-horiz-001a.xhtml + flexbox-justify-content-horiz-001b.xhtml + flexbox-justify-content-horiz-002.xhtml + flexbox-justify-content-horiz-003.xhtml + flexbox-justify-content-horiz-004.xhtml + flexbox-justify-content-horiz-005.xhtml + flexbox-justify-content-horiz-006.xhtml + flexbox_justifycontent-left-001.html + flexbox_justifycontent-left-002.html + flexbox_justifycontent-right-001.html + flexbox_justifycontent-right-002.html + flexbox_justifycontent-rtl-001.html + flexbox_justifycontent-rtl-002.html + flexbox_justifycontent-spacearound.html + flexbox_justifycontent-spacearound-negative.html + flexbox_justifycontent-spacearound-only.html + flexbox_justifycontent-spacebetween.html + flexbox_justifycontent-spacebetween-negative.html + flexbox_justifycontent-spacebetween-only.html + flexbox_justifycontent-start.html + flexbox_justifycontent-start-rtl.html + flexbox_justifycontent-stretch.html + flexbox-justify-content-vert-001a.xhtml + flexbox-justify-content-vert-001b.xhtml + flexbox-justify-content-vert-002.xhtml + flexbox-justify-content-vert-003.xhtml + flexbox-justify-content-vert-004.xhtml + flexbox-justify-content-vert-005.xhtml + flexbox-justify-content-vert-006.xhtml + flexbox-justify-content-wmvert-001.xhtml + flexbox-justify-content-wmvert-002.html + flexbox-justify-content-wmvert-003.html + flexbox_margin.html + flexbox_margin-left-ex.html + getcomputedstyle/flexbox_computedstyle_justify-content-center.html + getcomputedstyle/flexbox_computedstyle_justify-content-flex-end.html + getcomputedstyle/flexbox_computedstyle_justify-content-flex-start.html + getcomputedstyle/flexbox_computedstyle_justify-content-space-around.html + getcomputedstyle/flexbox_computedstyle_justify-content-space-between.html + justify-content-001.htm + justify-content-002.htm + justify-content-003.htm + justify-content-004.htm + justify-content-005.htm + justify-content-006.html + justify-content-007.html + justify-content_center.html + justify-content_flex-end.html + justify-content_flex-start.html + justify-content-sideways-001.html + justify-content_space-around.html + justify-content_space-between-001.html + justify-content_space-between-002.html + scrollbars-auto.html + scrollbars.html + scrollbars-no-margin.html + + + 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 +
+ 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. + + + flexbox_justifycontent-start.html + flexbox_justifycontent-start-rtl.html + + +
flex-end +
+ 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. + + + css-box-justify-content.html + flexbox_justifycontent-end.html + flexbox_justifycontent-end-rtl.html + flexbox_justifycontent-flex-end.html + + +
center +
+ 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.) + + + flexbox_justifycontent-center.html + flexbox_justifycontent-center-overflow.html + + +
space-between +
+ 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 falls back to ''safe 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. + + + flexbox_justifycontent-spacebetween.html + flexbox_justifycontent-spacebetween-negative.html + flexbox_justifycontent-spacebetween-only.html + + +
space-around +
+ 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 falls back to ''safe 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. + + + flexbox-column-row-gap-001.html + flexbox-column-row-gap-002.html + flexbox-column-row-gap-003.html + flexbox-column-row-gap-004.html + flexbox_columns-flexitems-2.html + flexbox_columns-flexitems.html + flexbox_justifycontent-spacearound.html + flexbox_justifycontent-spacearound-negative.html + flexbox_justifycontent-spacearound-only.html + + +
+ +
+ +

An illustration of the five 'justify-content' keywords and their effects on a flex container with three colored items. +

+ + + +

+Cross-axis Alignment: the 'align-items' and 'align-self' properties

+ +
+	Name: align-items
+	Value: flex-start | flex-end | center | baseline | stretch
+	Initial: stretch
+	Applies to: flex containers
+	Inherited: no
+	Computed value: specified keyword
+	Animation type: discrete
+	
+ + + align-items-007.html + align-items-008.html + align-items-009.html + align-items-baseline-column-horz.html + align-items-baseline-column-vert.html + align-items-baseline-column-vert-lr-flexbox-item.html + align-items-baseline-column-vert-lr-grid-item.html + align-items-baseline-column-vert-lr-items.html + align-items-baseline-column-vert-lr-table-item.html + align-items-baseline-column-vert-rl-flexbox-item.html + align-items-baseline-column-vert-rl-grid-item.html + align-items-baseline-column-vert-rl-items.html + align-items-baseline-column-vert-rl-table-item.html + align-items-baseline-overflow-non-visible.html + align-items-baseline-row-horz.html + align-items-baseline-row-vert.html + align-items-baseline-vert-lr-column-horz-flexbox-item.html + align-items-baseline-vert-lr-column-horz-grid-item.html + align-items-baseline-vert-lr-column-horz-items.html + align-items-baseline-vert-lr-column-horz-table-item.html + align-items-baseline-vert-rl-column-horz-flexbox-item.html + align-items-baseline-vert-rl-column-horz-grid-item.html + align-items-baseline-vert-rl-column-horz-items.html + align-items-baseline-vert-rl-column-horz-table-item.html + alignment/multiline-align-self.html + column-flex-child-with-max-width.html + dynamic-stretch-change.html + flexbox_align-items-baseline.html + flexbox_align-items-center-2.html + flexbox_align-items-center-3.html + flexbox_align-items-center.html + flexbox-align-items-center-nested-001.html + flexbox_align-items-flexend-2.html + flexbox_align-items-flexend.html + flexbox_align-items-flexstart-2.html + flexbox_align-items-flexstart.html + flexbox_align-items-stretch-2.html + flexbox_align-items-stretch-3.html + flexbox_align-items-stretch-4.html + flexbox_align-items-stretch.html + getcomputedstyle/flexbox_computedstyle_align-items-baseline.html + getcomputedstyle/flexbox_computedstyle_align-items-center.html + getcomputedstyle/flexbox_computedstyle_align-items-flex-end.html + getcomputedstyle/flexbox_computedstyle_align-items-flex-start.html + getcomputedstyle/flexbox_computedstyle_align-items-invalid.html + getcomputedstyle/flexbox_computedstyle_align-items-stretch.html + position-relative-percentage-top-001.html + position-relative-percentage-top-002.html + position-relative-percentage-top-003.html + relayout-align-items.html + stretch-input-in-column.html + stretch-requires-computed-auto-size.html + table-as-item-stretch-cross-size-2.html + table-as-item-stretch-cross-size-3.html + table-as-item-stretch-cross-size-4.html + table-as-item-stretch-cross-size-5.html + table-as-item-stretch-cross-size.html + + +
+	Name: align-self
+	Value: auto | flex-start | flex-end | center | baseline | stretch
+	Initial: auto
+	Applies to: flex items
+	Inherited: no
+	Computed value: specified keyword
+	Animation type: discrete
+	
+ + + align-self-006.html + align-self-010.html + align-self-013.html + align-self-014.html + align-self-015.html + align-self-016.html + flexbox_align-self-auto.html + flexbox-align-self-baseline-compatability.html + flexbox-align-self-baseline-horiz-001a.xhtml + flexbox-align-self-baseline-horiz-001b.xhtml + flexbox-align-self-baseline-horiz-002.xhtml + flexbox-align-self-baseline-horiz-003.xhtml + flexbox-align-self-baseline-horiz-004.xhtml + flexbox-align-self-baseline-horiz-005.xhtml + flexbox-align-self-baseline-horiz-006.xhtml + flexbox-align-self-baseline-horiz-007.xhtml + flexbox-align-self-baseline-horiz-008.xhtml + flexbox_align-self-baseline.html + flexbox_align-self-center.html + flexbox_align-self-flexend.html + flexbox_align-self-flexstart.html + flexbox-align-self-horiz-001-block.xhtml + flexbox-align-self-horiz-001-table.xhtml + flexbox-align-self-horiz-002.xhtml + flexbox-align-self-horiz-003.xhtml + flexbox-align-self-horiz-004.xhtml + flexbox-align-self-horiz-005.xhtml + flexbox_align-self-stretch.html + flexbox-align-self-stretch-vert-001.html + flexbox-align-self-stretch-vert-002.html + flexbox-align-self-vert-001.xhtml + flexbox-align-self-vert-002.xhtml + flexbox-align-self-vert-003.xhtml + flexbox-align-self-vert-004.xhtml + flexbox-align-self-vert-rtl-001.xhtml + flexbox-align-self-vert-rtl-002.xhtml + flexbox-align-self-vert-rtl-003.xhtml + flexbox-align-self-vert-rtl-004.xhtml + flexbox-align-self-vert-rtl-005.xhtml + getcomputedstyle/flexbox_computedstyle_align-self-baseline.html + getcomputedstyle/flexbox_computedstyle_align-self-center.html + getcomputedstyle/flexbox_computedstyle_align-self-flex-end.html + getcomputedstyle/flexbox_computedstyle_align-self-flex-start.html + getcomputedstyle/flexbox_computedstyle_align-self-invalid.html + getcomputedstyle/flexbox_computedstyle_align-self-stretch.html + + + 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.) + + If either of the flex item's cross-axis margins are auto, + 'align-self' has no effect. + + Values have the following meanings: + +
+
auto +
+ Defers cross-axis alignment control + to the value of 'align-items' on the parent box. + (This is the initial value of 'align-self'.) + + + align-self-007.html + align-self-008.html + align-self-009.html + align-self-011.html + align-self-012.html + + +
flex-start +
+ The cross-start margin edge of the flex item + is placed flush with the cross-start edge of the line. + + + align-items-002.htm + align-items-006.html + align-self-001.html + + +
flex-end +
+ The cross-end margin edge of the flex item + is placed flush with the cross-end edge of the line. + + + align-items-003.htm + align-self-002.html + + +
center +
+ 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.) + + + align-items-001.htm + align-self-003.html + + +
baseline +
+ 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. + + + align-items-004.htm + align-baseline.html + dynamic-baseline-change.html + dynamic-baseline-change-nested.html + + +
stretch +
+ If the cross size property of the flex item computes to ''width/auto'', + and neither of the cross-axis margins are ''margin/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'. + + Note: If the flex container's height is constrained + this value may cause the contents of the flex item + to overflow the item. - Note: Depending on the value of 'align-content', - the ''wrap-reverse'' value of 'flex-wrap' can alter the initial scroll position - on [=flex containers=] that are also [=scroll containers=]. - See [[css-align-3#overflow-scroll-position]]. + The cross-start margin edge of the flex item + is placed flush with the cross-start edge of the line. + + align-items-005.htm + align-self-004.html + align-self-005.html + css-flexbox-height-animation-stretch.html + +
-

-Flex Lines

+
+ +

An illustration of the five 'align-items' keywords and their effects on a flex container with four colored items. +

-... + -

-Minimum Flex Lines: the 'flex-line-count' property

+

+Packing Flex Lines: the 'align-content' property

-	Name: flex-line-count
-	Value: <>
-	Initial: 1
-	Applies to: [=multi-line=] [=flex containers=]
+	Name: align-content
+	Value: flex-start | flex-end | center | space-between | space-around | stretch
+	Initial: stretch
+	Applies to: multi-line flex containers
 	Inherited: no
-	Computed value: the specified integer, computed
-	Animation type: as integer
+	Computed value: specified keyword
+	Animation type: discrete
 	
- By default, a ''balance'' flexbox - will create as many lines as a normal [=multi-line=] flexbox, - then rebalance how the flex items are assigned across that many lines. - In some situations, - an author might want to ensure there are always a certain number of lines, - or might be using a flexbox in a way where there is no limit to the line length - (the standard for a [=column flexbox=], with unlimited available height) - and so the "default" line number calculation is useless. - The 'flex-line-count' property specifies a minimum flex line count - that the [=flex container=] should create - to balance the items across. + 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: - The [=minimum flex line count=] is clamped from above - by the number of [=flex items=] in the [=flex container=]; - it will only create as many lines as there are [=flex items=]. - (That is, if you specify ''flex-line-count: 3'' - but only have two [=flex items=], - the [=minimum flex line count=] is 2, instead.) +
+
flex-start +
+ 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. - Note: There is no maximum flex line count; - the [=flex container=] will always contain enough lines - to hold all of its [=flex items=], - which might be more than what 'flex-line-count' specifies. +
flex-end +
+ 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. - Unused lines (ones with no [=flex items=] assigned to them) - are discarded and do not affect layout. - This only affects non-''balance'' flexboxes. - A ''balance'' flexbox will always assign at least one [=flex item=] to each line, - and if it has less items than 'flex-line-count', - that's handled specially, above. +
center +
+ 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 +
+ 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 falls back to ''safe 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 +
+ Lines are evenly distributed in the flex container, + with half-size spaces on either end. + If the leftover free-space is negative + this value falls back to ''safe 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 +
+ Lines stretch to take up the remaining space. + If the leftover free-space is negative, + this value falls back to ''align-content/flex-start''. + Otherwise, + the free-space is split equally between all of the lines, + increasing their cross size. +
- In addition to setting a minimum number of lines that are used by ''balance'', - 'flex-line-count' changes the [=available space=] in the [=cross axis=] for [=flex items=]: - subtracting the size of N-1 gaps from the normal [=available space=], - then dividing the leftover by N, - where N is the 'flex-line-count' value. - This uses the actual 'flex-line-count' value, - not the [=minimum flex line count=] - or the actual number of generated lines - (which can be higher or lower than what is specified). + 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. - Note: This [=available space=] adjustment is the only effect 'flex-line-count' has - on non-''balance'' flexboxes. +
+ +

+ An illustration of the 'align-content' keywords and their effects on a multi-line flex container. +

- Percentages continue to resolve as normal, - unaffected by this [=available space=] adjustment. - (To have a [=flex item=] fill the [=cross-axis=] [=available space=], - use ''width/height: stretch'', - rather than ''width/height: 100%''.) + + align-content_center.html + align-content_flex-end.html + align-content_flex-start.html + align-content-horiz-001a.html + align-content-horiz-001b.html + align-content-horiz-002.html + align-content_space-around.html + align-content_space-between.html + align-content_stretch.html + align-content-vert-001a.html + align-content-vert-001b.html + align-content-vert-002.html + align-content-wmvert-001.html + align-content-wrap-001.html + align-content-wrap-002.html + align-content-wrap-003.html + align-content-wrap-004.html + align-content-wrap-005.html + flex-align-content-center.html + flex-align-content-end.html + flex-align-content-space-around.html + flex-align-content-space-between.html + flex-align-content-start.html + flexbox_align-content-center.html + flexbox_align-content-flexend.html + flexbox_align-content-flexstart.html + flexbox_align-content-spacearound.html + flexbox_align-content-spacebetween.html + flexbox_align-content-stretch-2.html + flexbox_align-content-stretch.html + getcomputedstyle/flexbox_computedstyle_align-content-center.html + getcomputedstyle/flexbox_computedstyle_align-content-flex-end.html + getcomputedstyle/flexbox_computedstyle_align-content-flex-start.html + getcomputedstyle/flexbox_computedstyle_align-content-space-around.html + getcomputedstyle/flexbox_computedstyle_align-content-space-between.html + - If the [=flex container=] is [=single-line=] - (aka, ''flex-wrap: nowrap''), - this property has no effect. + + +

+Flex Container Baselines

+ + 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: + + 1. 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. + + 2. Otherwise, if the flex container has at least one flex item, + the flex container's first/last main-axis baseline set + is generated from + the alignment baseline of the [=startmost=]/[=endmost=] flex item. + (If that item has no alignment baseline + parallel to the flex container's main axis, + then one is first synthesized + from its border edges.) + + 3. 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: + + 1. If the flex container has at least one flex item, + the flex container's first/last cross-axis baseline set + is generated from + the alignment baseline of the [=startmost=]/[=endmost=] flex item. + (If that item has no alignment baseline + parallel to the flex container's cross axis, + then one is first synthesized + from its border edges.) + + 2. 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. + +
+ + 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. + + When determining the baseline of a table cell, + a flex container provides a baseline just as a line box or table-row does. [[!CSS2]] + + See [[css-writing-modes-3#intro-baselines]] + and [[css-align-3#baseline-rules]] + for more information on baselines. + + + alignment/flex-align-baseline-001.html + alignment/flex-align-baseline-002.html + alignment/flex-align-baseline-003.html + alignment/flex-align-baseline-004.html + alignment/flex-align-baseline-005.html + alignment/flex-align-baseline-006.html + alignment/flex-align-baseline-007.html + alignment/flex-align-baseline-column-rtl-direction.html + alignment/flex-align-baseline-column-vert-lr-rtl-wrap-reverse.html + alignment/flex-align-baseline-column-vert-rl-rtl-wrap-reverse.html + alignment/flex-align-baseline-fieldset-001.html + alignment/flex-align-baseline-fieldset-002.html + alignment/flex-align-baseline-fieldset-003.html + alignment/flex-align-baseline-flex-001.html + alignment/flex-align-baseline-flex-002.html + alignment/flex-align-baseline-flex-003.html + alignment/flex-align-baseline-flex-004.html + alignment/flex-align-baseline-grid-001.html + alignment/flex-align-baseline-grid-002.html + alignment/flex-align-baseline-grid-003.html + alignment/flex-align-baseline-multicol-001.html + alignment/flex-align-baseline-multicol-002.html + alignment/flex-align-baseline-multicol-003.html + alignment/flex-align-baseline-overflow-001.html + alignment/flex-align-baseline-overflow-002.html + alignment/flex-align-baseline-overflow-003.html + alignment/flex-align-baseline-table-001.html + alignment/flex-align-baseline-table-002.html + alignment/flex-align-baseline-table-003.html + flexbox-baseline-align-self-baseline-horiz-001.html + flexbox-baseline-align-self-baseline-vert-001.html + flexbox-baseline-empty-001a.html + flexbox-baseline-empty-001b.html + flexbox-baseline-multi-item-horiz-001a.html + flexbox-baseline-multi-item-horiz-001b.html + flexbox-baseline-multi-item-vert-001a.html + flexbox-baseline-multi-item-vert-001b.html + flexbox-baseline-multi-line-horiz-001.html + flexbox-baseline-multi-line-horiz-002.html + flexbox-baseline-multi-line-horiz-003.html + flexbox-baseline-multi-line-horiz-004.html + flexbox-baseline-multi-line-vert-001.html + flexbox-baseline-multi-line-vert-002.html + flexbox-baseline-nested-001.html + flexbox-baseline-single-item-001a.html + flexbox-baseline-single-item-001b.html + + +

+Definite and Indefinite Sizes

+ + Although CSS Sizing [[!CSS-SIZING-3]] defines definite and indefinite lengths, + Flexbox has several additional cases where a length can be considered definite: + + 1. If the [=flex container=] has a [=definite=] [=main size=], + then the post-flexing [=main sizes=] + of its [=flex items=] + are treated as [=definite=]. + + 2. If a [=flex item’s=] [=flex basis=] is [=definite=], + then its post-flexing [=main size=] is also [=definite=]. + + 3. If a single-line flex container has a definite cross size, + the [=automatic size|automatic=] [=preferred size|preferred=] [=outer size|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. + + 4. Once the cross size of a flex line has been determined, + the cross sizes of items in auto-sized flex containers + are also considered definite for the purpose of layout; + see step 11. + + + flexbox-definite-cross-size-constrained-percentage.html + flexbox-definite-sizes-001.html + flexbox-definite-sizes-002.html + flexbox-definite-sizes-003.html + flexbox-definite-sizes-004.html + flexbox-definite-sizes-005.html + flexbox-definite-sizes-006.html + height-percentage-with-dynamic-container-size.html + percentage-widths-001.html + position-fixed-001.html + stretch-obeys-min-max-001.html + stretch-obeys-min-max-002.html + stretch-obeys-min-max-003.html + + + Note: This means that within [=flex layout=], + “definite” sizes can require performing layout. + This was done to allow percentages inside of [=flex items=] + to resolve where authors expected them to resolve. + + + + +

+Intrinsic Sizes

+ + 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). + For these computations, auto margins on flex items are treated as ''0''. + + See [[!CSS-SIZING-3]] for a definition of the terms in this section. + + + flexbox-gap-position-absolute.html + gap-001-lr.html + gap-001-ltr.html + gap-001-rl.html + gap-001-rtl.html + gap-002-lr.html + gap-002-ltr.html + gap-002-rl.html + gap-002-rtl.html + gap-003-lr.html + gap-003-ltr.html + gap-003-rl.html + gap-003-rtl.html + gap-004-lr.html + gap-004-ltr.html + gap-004-rl.html + gap-004-rtl.html + gap-005-lr.html + gap-005-ltr.html + gap-005-rl.html + gap-005-rtl.html + gap-006-lr.html + gap-006-ltr.html + gap-006-rl.html + gap-006-rtl.html + gap-007-lr.html + gap-007-ltr.html + gap-007-rl.html + gap-007-rtl.html + gap-008-ltr.html + gap-009-ltr.html + gap-010-ltr.html + gap-011.html + gap-012.html + gap-013.html + gap-014.html + gap-015.html + gap-016.html + gap-017.html + gap-018.html + gap-019.html + gap-020.html + gap-021.html + intrinsic-size/auto-min-size-001.html + intrinsic-size/col-wrap-001.html + intrinsic-size/col-wrap-002.html + intrinsic-size/col-wrap-003.html + intrinsic-size/col-wrap-004.html + intrinsic-size/col-wrap-005.html + intrinsic-size/col-wrap-006.html + intrinsic-size/col-wrap-007.html + intrinsic-size/col-wrap-008.html + intrinsic-size/col-wrap-009.html + intrinsic-size/col-wrap-010.html + intrinsic-size/col-wrap-011.html + intrinsic-size/col-wrap-012.html + intrinsic-size/col-wrap-013.html + intrinsic-size/col-wrap-014.html + intrinsic-size/col-wrap-015.html + intrinsic-size/col-wrap-016.html + intrinsic-size/col-wrap-017.html + intrinsic-size/col-wrap-018.html + intrinsic-size/col-wrap-019.html + intrinsic-size/col-wrap-020.html + intrinsic-size/col-wrap-crash.html + intrinsic-size/row-001.html + intrinsic-size/row-002.html + intrinsic-size/row-003.html + intrinsic-size/row-004.html + intrinsic-size/row-005.html + intrinsic-size/row-006.html + intrinsic-size/row-007.html + intrinsic-size/row-008.html + intrinsic-size/row-compat-001.html + intrinsic-size/row-use-cases-001.html + intrinsic-size/row-wrap-001.html + multiline-shrink-to-fit.html + svg-no-natural-size-grandchild.html + + +

+Flex Container Intrinsic Main Sizes

+ + The max-content main size of a flex container + is, theoretically, the smallest size the flex container can take + such that when flex layout is run with that container size, + each [=flex item=] ends up at least as large as + its [[#intrinsic-item-contributions|max-content contribution]], + to the extent allowed by the items’ flexibility. + + The [=min-content=] [=main size=] of a flex container + is, theoretically, the smallest size the [=flex container=] can take + such that no items overflow it, + and no item's contents overflow the item-- + setting aside the cases in which the boxes layouts are defined to overflow + (for example with negative margins or percentage sizes that add up to more than 100%). + + + flex-container-max-content-001.html + flex-container-min-content-001.html + + + For the min-content size of a multi-line flex container, + see [[#intrinsic-main-sizes-multiline]]. + For max-content sizes and for single-line min-content sizes, + an implementation is conformant to CSS Flexible Box Layout + if it conforms to either the Ideal Algorithm or the Web-compatible Algorithm, + as defined below. + +
+Ideal Algorithm: Max-content Size and Min-content Single-line Size
+ + Note: The following algorithm calculates the [=flex container=]’s ideal + intrinsic [=main sizes=]. + However, because it was not implemented correctly initially, + and existing content became dependent on the (unfortunately consistent) incorrect implemented behavior, + it is not Web-compatible. + Implementers and the CSS Working Group are investigating to what extent + Web browser implementations can safely approach this behavior, + and further experimentation is welcome. + + Considering only non-[=collapsed=] [=flex items=]; + +
    +
  1. + For each flex item, + subtract its outer flex base size from its [[#intrinsic-item-contributions|max-content contribution]] size. + If that result is positive, + divide it by the item's flex grow factor + if the flex grow factor is ≥ 1, + or multiply it by the flex grow factor + if the flex grow factor is < 1; + if the result is negative, + divide it by the item's scaled flex shrink factor + (if dividing by zero, treat the result as negative infinity). + This is the item's desired flex fraction. + +
  2. + Place all flex items into lines of infinite length. + Within each line, + find the greatest (most positive) + desired flex fraction + among all the flex items. + This is the line’s chosen flex fraction. + +
  3. + If the chosen flex fraction is positive, + and the sum of the line’s flex grow factors + is less than 1, + divide the chosen flex fraction by that sum. + + If the chosen flex fraction is negative, + and the sum of the line’s flex shrink factors + is less than 1, + multiply the chosen flex fraction by that sum. + +
  4. + Add each item’s flex base size + to the product of its flex grow factor + (scaled flex shrink factor, if shrinking) + and the chosen flex fraction, + then clamp that result by the max main size + floored by the min main size. + +
  5. + The flex container’s max-content size is + the largest sum (among all the lines) + of the afore-calculated sizes of all items within a single line. +
+ + The min-content main size of a single-line flex container + is calculated identically to the max-content main size, + except that the flex items’ [[#intrinsic-item-contributions|min-content contributions]] are used + instead of their [[#intrinsic-item-contributions|max-content contributions]]. + +
+ Implications of this algorithm when the sum of flex is less than 1 + + 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: + + 1. 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.) + + 2. 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). + + 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. + + There are several possible ways to make the overall behavior continuous between these two cases, + but all of them have drawbacks. + We chose one we feel has the least bad implications; + unfortunately, it "double-applies" the flexibility in cases with [=flex factors=] that are < 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. + +
+ Even more involved notes on the specific behavior chosen + + Principles: + + 1. Don't explode any sizes, whether growing or shrinking, as inputs approach zero. + 2. When flex factors are all >=1, return the minimum size necessary for every item to be >= max-content size. + 3. Items with a zero flex shouldn't affect the sizes at all. + 4. Keep it continuous over variance of flex factors and item sizes. + 5. Keep sizing variance as linear as possible with respect to linear changes to any input variable (size, flex factor). + 6. When the sum of flex factors is >=1, return the minimum size necessary for every item to be >= max-content size. + + To get these all to work together, + we have to apply some correction when either flex factors + or the sum of flex factors on a line + is < 1. + + For shrink our behavior is somewhat easier; + since the explosive case of 0 shrink + results in a negative infinity desired fraction + which we'll never choose (since we always take the largest), + we can just apply the correction at the line level, + giving us double-application only when the sum is < 1. + + For positives it's more complicated. + 0 grow naively explodes into *positive* infinity, + which we'd choose, + so we need to apply the correction at the individual item level. + We do that by multiplying the space by the factor when factor is <1. + Leaving it at that would result in a double-application for items < 1 + but sum >= 1, + but a *triple*-application when the sum is < 1. + To avoid *that* ridiculousness, + we apply a *reverse* correction when the sum is 1, + dividing by the sum instead. + This leaves us with a double correction in all cases for items with factors < 1. + + We can't eliminate the double-applications entirely + without giving up other, more important principles + (in particular, principle 3 -- + try to come up with rules that don't double-apply + when you have two items with ''flex-grow: .5'', + but also don't give a ''flex-grow: 0'' item any power + over a ''flex-grow: 1'' sibling; + you can't, as far as we can tell.) +
+
+ +
+Web-compatible Intrinsic Sizing Algorithm: Max-content Size and Min-content Single-line Size
+ + Note: The following algorithm has been demonstrated to be Web-compatible. + It may be altered in the future to bring it closer to the ideal algorithm above, + if possible. + + * For the [=max-content size=] of a [=flex container=], + take the sum of the [[#intrinsic-item-contributions|max-content contributions]] + of all the non-[=collapsed=] flex items in the flex container. + * For the [=min-content size=] of a single-line container, + take the sum of the [[#intrinsic-item-contributions|min-content contributions]] + of all the non-[=collapsed=] flex items in the flex container. + + +
+Multi-line Min-content Algorithm
+ + For a multi-line container, + the [=min-content=] [=main size=] is simply the largest [[#intrinsic-item-contributions|min-content contribution]] + of all the non-[=collapsed=] flex items in the flex container. + +

+Flex Container Intrinsic Cross Sizes

+ + 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. + + For a multi-line flex container, + the behavior depends on whether it's a row or column flexbox: + + : ''flex-direction/row'' [=multi-line=] [=flex container=] [=cross size=] + :: 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-direction/column'' [=multi-line=] [=flex container=] [=cross size=] + :: The [=min-content=] [=cross size=] + is the largest [=min-content contribution=] among all of its [=flex items=]. + + Note: This heuristic effectively assumes a single flex line, + in order to guarantee that the [=min-content size=] + is smaller than the [=max-content size=]. + If the flex container has a height constraint, + this will result in overflow, + but if the [=flex container=] is also a [=scroll container=], + it will at least be large enough to fit + any given column entirely within its [=scrollport=]. + + The [=max-content=] [=cross size=] is the sum of the [=flex line=] cross sizes + resulting from sizing the [=flex container=] + under a cross-axis max-content constraint, + using the largest max-content cross-size contribution among the flex items + as the available space in the cross axis + for each of the flex items during layout. + + Note: This heuristic gives a reasonable approximation + of the size that the flex container should be, + with each [=flex item=] laid out at its [=max-content contribution=] or larger, + and 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. + + + flexbox_width-change-and-relayout-children.html + table-as-flex-item-max-content.html + table-as-item-flex-cross-size.html + + + +

+Flex Item Intrinsic Size Contributions

+ + The main-size min-content contribution of a flex item + is the larger of its outer min-content size + and outer preferred size + if that is not an [=automatic size=]. + + The main-size max-content contribution of a flex item + is the larger of its outer max-content size + and outer preferred size + if that is not an [=automatic size=]. + + For this purpose, + each contribution + is capped by the item’s [=flex base size=] if the item is not growable, + floored by the item’s [=flex base size=] if the item is not shrinkable, + and then further clamped by the item's min/max main size. + + + +

+Fragmenting Flex Layout

+ +

+ 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]]. + +

+ 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. + +

+ 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): + +

    +
  • + In a row flex container, + the 'break-before' and 'break-after' values on flex items + are propagated to the flex line. + The 'break-before' values on the first line + and the 'break-after' values on the last line + are propagated to the flex container. + + Note: Break propagation + (like 'text-decoration' propagation) + does not affect computed values. + +
  • + In a column flex container, + 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. + +
  • + A forced break inside a flex item effectively increases the size of its contents; + it does not trigger a forced break inside sibling items. + +
  • + In a row flex container, + Class A break opportunities occur between sibling flex lines, + and Class C break opportunities occur between the first/last flex line and the flex container's content edges. + In a column flex container, + Class A break opportunities occur between sibling flex items, + and Class C break opportunities occur between the first/last flex items on a line and the flex container's content edges. + [[!CSS3-BREAK]] + +
  • + 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. + +
  • + 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. + +
  • + When breaking a multi-line column flex container, + the UA may organize each fragment into its own “stack” of flex lines-- + just like each fragment of a multi-column container + has its own row of column boxes-- + in order to ensure that content presented on earlier pages + corresponds to content earlier in the box order. + +
  • + 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. +
+ + + interactive/flexbox_interactive_break-after-column-item.html + interactive/flexbox_interactive_break-after-column-lastitem.html + interactive/flexbox_interactive_break-after-container.html + interactive/flexbox_interactive_break-after-item.html + interactive/flexbox_interactive_break-after-line.html + interactive/flexbox_interactive_break-after-line-order.html + interactive/flexbox_interactive_break-after-multiline.html + interactive/flexbox_interactive_break-before-column-firstitem.html + interactive/flexbox_interactive_break-before-column-item.html + interactive/flexbox_interactive_break-before-container.html + interactive/flexbox_interactive_break-before-item.html + interactive/flexbox_interactive_break-before-multiline.html + interactive/flexbox_interactive_break-natural.html + + + +

+Sample Flex Fragmentation Algorithm

+ +

+ 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. + +

+ +

+ 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. + +

+
single-line column flex container +
+
    +
  1. + Run the flex layout algorithm (without regards to pagination) + through Cross Sizing Determination. + +
  2. + 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. + +
  3. + 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. + 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. + +
  4. + 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. + +
  5. + For each fragment of the flex container, + continue the flex layout algorithm + from Main-Axis Alignment + to its finish. +
+ +

+ 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. + +

multi-line column flex container +
+
    +
  1. + 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. + +
  2. + 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. + 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. + +
    2. + 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. + +
    3. + 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. +
    + +
  3. + 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. + +
  4. + For each fragment of the flex container, + continue the flex layout algorithm + from Main-Axis Alignment + to its finish. +
+ +

+ A shortcoming of this sample algorithm is that + if a flex item does not entirely fit on a single page, + it will not be paginated in multi-line column flex containers. + +

single-line row flex container +
+
    +
  1. + Run the entire flex layout algorithm (without regards to pagination), + except treat any 'align-self' other than ''align-self/flex-start'' or ''baseline'' + as ''align-self/flex-start''. + +
  2. + 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. + +
  3. + 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). + +

    + Any flex items that fit entirely into previous fragments + still take up space in the main axis in later fragments. + +

  4. + 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 ''align-self/flex-start'' for all item fragments and lines. + +
  5. + 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. +
+ +
multi-line row flex container +
+
    +
  1. + Run the flex layout algorithm (without regards to pagination), + through Cross Sizing Determination. + +
  2. + 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 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 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. + +

  3. + 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. + +
  4. + For each fragment of the flex container, + continue the flex layout algorithm + from Cross Axis Alignment + to its finish. +
+
+
+ +

+Appendix A: Axis Mappings

+ + This appendix is non-normative. + + + + + + + + + + + + + + + + + +
Axis Mappings for ''ltr'' + ''horizontal-tb'' Writing Mode (e.g. English)
'flex-flow' + main axis + start + end + cross axis + start + end +
''row'' + ''nowrap''/''wrap'' + horizontal + left + right + vertical + top + bottom +
''row-reverse'' + ''nowrap''/''wrap'' + right + left +
''row'' + ''wrap-reverse'' + left + right + bottom + top +
''row-reverse'' + ''wrap-reverse'' + right + left +
''column'' + ''nowrap''/''wrap'' + vertical + top + bottom + horizontal + left + right +
''column-reverse'' + ''nowrap''/''wrap'' + bottom + top +
''column'' + ''wrap-reverse'' + top + bottom + right + left +
''column-reverse'' + ''wrap-reverse'' + bottom + top +
+ + + + + + + + + + + + + + + + + +
Axis Mappings for ''rtl'' + ''horizontal-tb'' Writing Mode (e.g. Farsi)
'flex-flow' + main axis + main-start + main-end + cross axis + cross-start + cross-end +
''row'' + ''nowrap''/''wrap'' + horizontal + right + left + vertical + top + bottom +
''row-reverse'' + ''nowrap''/''wrap'' + left + right +
''row'' + ''wrap-reverse'' + right + left + bottom + top +
''row-reverse'' + ''wrap-reverse'' + left + right +
''column'' + ''nowrap''/''wrap'' + vertical + top + bottom + horizontal + right + left +
''column-reverse'' + ''nowrap''/''wrap'' + bottom + top +
''column'' + ''wrap-reverse'' + top + bottom + left + right +
''column-reverse'' + ''wrap-reverse'' + bottom + top +
+ + + + + + + + + + + + + + + + + +
Axis Mappings for ''ltr'' + ''vertical-rl'' Writing Mode (e.g. Japanese)
'flex-flow' + main axis + start + end + cross axis + start + end +
''row'' + ''nowrap''/''wrap'' + vertical + top + bottom + horizontal + right + left +
''row-reverse'' + ''nowrap''/''wrap'' + bottom + top +
''row'' + ''wrap-reverse'' + top + bottom + left + right +
''row-reverse'' + ''wrap-reverse'' + bottom + top +
''column'' + ''nowrap''/''wrap'' + vertical + right + left + horizontal + top + bottom +
''column-reverse'' + ''nowrap''/''wrap'' + left + right +
''column'' + ''wrap-reverse'' + right + left + bottom + top +
''column-reverse'' + ''wrap-reverse'' + left + right +
+ +

+Appendix B: -webkit- Legacy Properties

+ + This appendix is normative. + + Advisement: These aliases are deprecated + and authors should not use them + unless their content needs to support actively-used legacy UAs. + + For compatibility with general Web content, + UAs that are Web browsers must and other UAs may + implement the following [=legacy name aliases=]: + + + + +
Alias Standard +
-webkit-align-contentalign-content +
-webkit-align-itemsalign-items +
-webkit-align-selfalign-self +
-webkit-flexflex +
-webkit-flex-basisflex-basis +
-webkit-flex-directionflex-direction +
-webkit-flex-flowflex-flow +
-webkit-flex-growflex-grow +
-webkit-flex-shrinkflex-shrink +
-webkit-flex-wrapflex-wrap +
-webkit-justify-contentjustify-content +
-webkit-orderorder +
+ + + flexbox_width-wrapping-column.html + parsing/webkit-aliases.html + webkit-box-vertical-writing-mode.html + + +

Acknowledgments

+ +

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. + + + +

Changes

+ + This section documents the changes since previous publications. + +

+Changes since the 14 October 2025 CRD +

+ +
    +
  • + Defined the web-compatible intrinsic sizing algo in [[#intrinsic-main-sizes-compat]]. + (Issue 8884) + +
  • + Clarified that the used cross size of an item is recalculated + with the line's cross size as its available space. + (Issue 11784) + +
  • + Added the ''flex-wrap: balance'' feature. + (Issue 3070, + Issue 12222, + and Issue 13414) +
+ + +

Privacy Considerations

+ +No new privacy considerations have been reported on this specification. + +

Security Considerations

+ +No new security considerations have been reported on this specification. + + + animation/order-interpolation.html + flexbox-anonymous-items-001.html + flexbox_order-abspos-space-around.html + flexbox_order-box.html + flexbox-order-from-lowest.html + flexbox_order.html + flexbox_order-noninteger-invalid.html + flexbox-order-only-flexitems.html + flexible-order.html + flex-item-z-ordering-001.html + flex-item-z-ordering-002.html + flex-order.html + getcomputedstyle/flexbox_computedstyle_order.html + getcomputedstyle/flexbox_computedstyle_order-inherit.html + getcomputedstyle/flexbox_computedstyle_order-integer.html + getcomputedstyle/flexbox_computedstyle_order-invalid.html + getcomputedstyle/flexbox_computedstyle_order-negative.html + order-001.htm + order/order-abs-children-painting-order-different-container.html + order/order-abs-children-painting-order.html + order/order-with-column-reverse.html + order/order-with-row-reverse.html + order-painting.html + order_value.html + parsing/order-computed.html + parsing/order-invalid.html + parsing/order-valid.html + + + + break-nested-float-in-flex-item-001-print.html + break-nested-float-in-flex-item-002-print.html + flexbox-break-request-horiz-001a.html + flexbox-break-request-horiz-001b.html + flexbox-break-request-horiz-002a.html + flexbox-break-request-horiz-002b.html + flexbox-break-request-vert-001a.html + flexbox-break-request-vert-001b.html + flexbox-break-request-vert-002a.html + flexbox-break-request-vert-002b.html + inline-flexbox-vertical-rl-image-flexitem-crash-print.html + + + + contain-size-layout-abspos-flex-container-crash.html + frame-flex-item-crash.html + frameset-crash.html + grandchild-span-height.html + min-height-min-content-crash.html + mixed-containing-blocks-crash.html + negative-available-size-crash.html + negative-flex-margins-crash.html + negative-flex-rounding-crash.html + negative-item-margins-002-crash.html + negative-item-margins-crash.html + orthogonal-flex-item-crash.html + position-absolute-scrollbar-freeze.html + position-relative-with-scrollable-with-abspos-crash.html + relayout-input.html + remove-out-of-flow-child-crash.html + zero-content-size-with-scrollbar-crash.html + + + + fixed-table-layout-with-percentage-width-in-flex-item.html + percentage-size-quirks-002.html + percentage-size-quirks.html + quirks-auto-block-size-with-percentage-item.html + + + + percentage-padding-001.html + percentage-padding-002.html + percentage-padding-003.html + percentage-padding-004.html + percentage-padding-005.html + + + + remove-wrapped-001.html + remove-wrapped-002.html + scrollbars-auto-min-content-sizing.html + select-element-multiple.html + shrinking-column-flexbox.html + table-as-item-large-intrinsic-size.html + table-with-float-paint.html + + + + align-content-rounding.html + anonymous-flex-item-restyle.html + flex-rounding.html + justify-content-rounding.html + main-axis-margin-rounding.html + percentage-heights-020.html + percentage-heights-021.html + percentage-heights-022.html + percentage-heights-023.html + relayout-intrinsic-block-size.html + total-min-max-violation-zero.html + \ No newline at end of file diff --git a/css-flexbox-2/examples/flex-item-determination.html b/css-flexbox-2/examples/flex-item-determination.html new file mode 100644 index 000000000000..49233d0b832d --- /dev/null +++ b/css-flexbox-2/examples/flex-item-determination.html @@ -0,0 +1,39 @@ + + + + +
+ + +
block
+ + +
float
+ + + anonymous item 3 + + + + + item 4 + + item 4 + item 4 + +
diff --git a/css-flexbox-2/images/OK.png b/css-flexbox-2/images/OK.png new file mode 100644 index 0000000000000000000000000000000000000000..0b7577eab59c7b4a717694635a69e4b16d9e3676 GIT binary patch literal 223 zcmeAS@N?(olHy`uVBq!ia0vp^V9WtzFg$X<;|`>jdAc};L>zv5V<*4QEQs#WHsMeCYhI>*luEc z{9+;B87WK2Ng0zSsjmF~NK0JNQ;E;Wz4Y~}wK<=9;neo_x8Hbn+}IPZ1T)%x!ar`a%umOwnAg<(a(DFF Q{~Y9UPgg&ebxsLQ0ISwuCIA2c literal 0 HcmV?d00001 diff --git a/css-flexbox-2/images/align-content-example.svg b/css-flexbox-2/images/align-content-example.svg new file mode 100644 index 000000000000..fcd90d70c8e4 --- /dev/null +++ b/css-flexbox-2/images/align-content-example.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + flex-start + + + + + + + + center + + + + + + + + flex-end + + + + + + + + space-between + + + + + + + + space-around + + + + + + + + stretch + + diff --git a/css-flexbox-2/images/basic-flexbox.png b/css-flexbox-2/images/basic-flexbox.png new file mode 100644 index 0000000000000000000000000000000000000000..3901c3e11c833f2ed6a32fc5418d959292d59e3e GIT binary patch literal 2552 zcmcgudpOhm8{P~X$^2f)Ia62?^($T>%lQx*3QLJiYfvyFQ=mx$e*NeeV0YpXaY{y6X}9&C)8;5C~+m zql1k*1OhDs@g;;97*BQ#Xh9%SEsi#p$6}#V?;Mq3nsVf4ly_osO8UK*(c4kA0;l)F z>-(7#nUVt75Ij(W^fz=P9IODKvxuJaKNA%pzO~w-<&PEB_0$Q<`Y_Y`!PAEU z55uJtC;^7N%A>;RKoR`b=7y?y^hN;~*1re4fFx&8-JaS&u1l_V_)_GwUfxhlq=-1> z1x^0ox26A3ZVvtt6oES`JDCo(my=4ddMieviMf(s(#+csdxu7txU!c6J~{eI`6kP| zdo7&q9(Zs~p*~S4e>@-KakfAQ6U!B?t|i80W}-8G%hK)%P{I*VODkr{4>&hNu@^iH zeU3B~&N6(`au9e&?mn6OCJ^C`gy}zCuz&1ds+fBcxw!gPrmK#5XNbP*iF0XyS1i{+ z%T1hiKU`U|UoEYPNVVE&Y*Zh5(j#v*G#cGJFE#?d0f}!`y;C)9rj6LlQnKrPVF2Dc{ajV(`Byx2RHifF8d5Ply#i)CC`f0lVpw~d4LzOaI(Db? zOxvaxaxqf>Av<@VNudiY2{XA^shs8e~+`>hsgFQBB}YUkcqxxIdJD1S*vHbP8X5;?C#Z%19# z#K}ku%DnpYEW#OLA+=4MglZKjp$U87Ssl+}gpIPxm)3wo$h{pz>gc!m8l>KJA=C5t z$gYXFO}6Jvy00o5KH7vdb}ycA^Ds-^ZP|5?{$tgfop8Ak*(Q$FZ6047q@|RY$YF0T zudq9TZy3qP9Vd=EhV#Jj^Gv!5ql{wd*}Ke3g6y@O#LjHZZS@t!V->pqluoR4#u%TY z;yupXk~lve)3+MPUi~CN;9{;PJvwpRGm;mlZ<}W#yZ@rm=51m3O-s((d*mjQZsp#? ziHKOX1VJNB>dq-$bN=ERnq-M?&Q6KHsae3St>+q*ZR>JUdXX%3J;R*Oq@%HPT+MX$ zWVaxE2VVOn12wQO?;P4O=$(p!-@<-norOrVP^>z|UD}vX3f{D+;bN(77&r5dq?R<#m?u|bEQu>;8&c`j= z3_R@~o5u``K6oZ0XyK~j&Ua`PnvV5$W0}ByQkquA=-v=Lh!YQ$c3K%9@QQW}C4(R( zKmSJQH$Xs3C{D<$Fi5L(*BPY&<*pZy1G0!T3oqBykBp|+{>~}$Vm}RJ%SsFUda9Q+)6z80Hcg;ZdKa|%S5cKnlzllL9gIGOodX+m1yCnfcv4EBhz`4VV4he zGS;@OF%^?gZN?Xd%jNUUTw-m$P=$^9ENNWZkbih>YF8FexAiN!zs#IqJWR8STR3aO zFBmDM0Dr-_$Yd0!t;VZLJ~|)d9T5D>)1ZMoY+u<@dQ?!)?>>sl`f{Qyqn;1MvZHXA zBXj)8@KLLx8Y8vq9o4PB%Y`UkR2LNedCqsyvj1slX2g%_2ozjAq%vVh+widptG8N4 zF9i0C636~V^sYH|a*?*ZJtt&PxIOs89ie+^$1@V?_3h}U>8$)Tu$_;9w{ zYDm(6{SAxbNogkCb~&8Y0*)rBtNi_#VY9Ii^O#5hsBt<4U0qZ zr+g~U;KoPV`vs!|aB^^YeUZQ(--&sz&w*vSSK#dX{&^!`WUaUiG0yq=13hinYQ!PV6TX#k_Kmn}& zDkNG)+|~Jf_+0v;T7^w-{nxnpWw(z1jz73i>UpAA#~_2h*Ll{)+Iz5)wVWoOv?QUJ zl%J*Nq%cmX{>{h!A^)`o!Gv<%4T{u-w-e`&Wi*e9Ugvq*<%kf9~>%?9SJk7qwyWOXb1S;(}x z)=AqTtFPKtWy>%4K_jo_SjOjWUBHO06chciZ`7GoDlR2_2X;87F#2VcXu-SV-B2%i zVjnj(GF$tT)*oM`1O3(7y#s3XjWx;9>Ufl@Pxf5a)ckPLkY>wFUvQrEN{widXCdTz@Bn#^3yKC^-N+lNiOCtEM(39J{lN7`kb z_5fPI`rzTNNO|`_wxuMk_kC5^nt*<3pbWMNa%Ly#OyY9ESjiNk*f!3}|D{=y2*F7e zfj5FGitr_iIQAqFhmQeY9QX`@Dq;dN1Pz6sh~5Ltz=VxGfcj7L5hH9wf)ruYPn5JS z@n8hZZJ-UY_rJ&%Cj8Q1U95<;-s%_GOxg8Tzsj1fxB6Fh-PxC4-Tq(1Wd7Hg7>Cb* z2zeOrf*#km%3end`AY=Y>L55B3jnRrtH4=V0Ca}nYrzaEmBoYqWpbp&6QypGsdRAZ z)l2{~0|N!X&BHiCF(xn#5kl$6jdX+tNdyu5IJEf=UrW&rWI`NmkJwaN`Ca}8Y5gp7 literal 0 HcmV?d00001 diff --git a/css-flexbox-2/images/basic-vertical-flexbox.png b/css-flexbox-2/images/basic-vertical-flexbox.png new file mode 100644 index 0000000000000000000000000000000000000000..6a07d225b16356fdc5011911d618e5be5d44f9a3 GIT binary patch literal 1242 zcmV<01SR{4P)E;>Uw5gg(>gjy3JMIbuiF?H z9)^ae!ou^y!t#WKr56_+Nl9CKdzyK9mr6=p5)v1>y6CyN=Mxhc0s;fd%KXX6`vU_6 zdU}|yuG$tB9EF9ZsHoC9I!Fl#3jl}!%>T@^;j}^hNy;lmw65n4xYxIx#zhQ85GF+$jST30|W!O=D0~)Ne~ne zF+DL|bX~UOw#xm=j<+nstL<|oMBP=6_sfVfn0RPO)&!(n2E-nTI1uG&VuZ)cP$jG~vmj27jcVA!Asi{di zIt&U5+pn)47#OF9hV#P0^1{NUgoGUz7h6e5ntOYfd3jt)N*59m=(@V+xw#k<69WPQ z{L0Gv$;ku*1DJYx+ODn~78a(3h0>^~NIE(T2?^laz}5f&0@F!EK~#7F?V1H|8%q>M zJ#Qa|Ij_tOGc#kEF=eJLH%w)21OK<3u<;dw$71sedBKe$IDlV1ONblN;t5? z&H%8BxblYyMBIooJM6H-&iZ{|haGkaYxn10e=B9hCcro(yMO-uFUjHW3n~uDE;+?= zBB(eVJ6WA-S!wAR8R==3rFT}4aY)-vNy*I0&dJTo&(u31pg3f^|JO)eyH4+ffZ~wt z)^Cuyag*K&0mUKPZQdev>o&a;f{WR9t9IONj~*J)P6#Lt*>1hG%&CX#(oSan-9WE_B za`afTQY!kU;JU(eyWSsL=J<(|r%Fp>*g35*-R|^{qiW>LN;4e8&S{0|c4upP&z+Yu z;)RRd!!Yh=GZZL zVDiA^fyo1t2PO|p9+*7vjDQ_>*kQ;2iTMIM?6A9&AYf+{*kNbKHP{&ocG%s$cV8(x z24=?|?H)XQ^w{Aym>PSuOMYTIU~KHoPQDzq?XmHRiSaSp);fb@@7qpEnVg!QnVp-T z)H-ux-*!)*Nqzo8>&%UP+r4}x_4OOAGdK2a_x7FC_aC&*=$LJ%?c5)uJ9o4*Hui1z z>GRyo%)yz><$ Eg511MIsgCw literal 0 HcmV?d00001 diff --git a/css-flexbox-2/images/computer.jpg b/css-flexbox-2/images/computer.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0d531c7825e591abfe6d05f93c8ba97a724a8e8b GIT binary patch literal 7106 zcmb7pWmH^2v)~LfxD4*@p5TPR2_Ae14nY#!2^t9QZXxL4u7kSm|2tkrKLA7n zfgdfz!X^X&L1-Wl7zc|0f`R$S0R%iQ5usx+5ew*GlE{T%kueKex~HTzE|8K_dZafE z%(Do|>*`rqdxd5c4$Uo6u(GiWi-;=0UV28P4Gt?jSM&}G*MD79T!Ps7^{DgzQTr(V zpY%r^K=40<{$p9s6EKs2kID z3=OnNz8lQc@%|3E<>~&1{0RHGwNKiV)CQBW;KOAqWQLO%INA0fN^&%CYpwmz#i9qOulsU@P$iD#Y^pYLF#{KY|9(690}!TP-W z`|L;dS`Lcq$LSZHt#|oWMlbf0Wf?c<<0(J!_mMYaB~=>5D+X^Je94e8ML;=oZ2wk{o){wD-7?u%Fs!Z*(`pG z+_rL)Cx3hLBnhQ=pN={e!{47e@iW>V2*bMA8?-7X+E4neWqy#Y$>7f>b-H3>c1-wg znc=;!;h?<}>z7Jvf3>i_Eb@!p{~S57>k_VIbIdT8DNr4FFk_zUdFmq<~--8UYtzioyvvQ$XvSnlV9sH z;^pM;zik38G#ie`4U_N4Z$^9(S1w_6X+t-~(P=yQe_}=oKKTjU1fk~NXH$lp9^MS^ zOzeD4nmf+(`6J){7O~7h@SY-#p$y7lwvb+ZS96UT`7o5mP%r;YA;af)MzmFfa>VB- z1fGqO(j>;hWR7Jk)3BkZOV3qAOiW~vm3fJmG&1#^Ufr>0Qk<369;1e^*Ko-yIAh*HT~k#F#>K%zGdP1$wPRulUdR z!On6_G_G*jYk2T}sJ0b*DYmB^C+)0m$P^ep?0oQ&QQC6IKM@D2ZPLs$XDibYFNLfnUAg?lG1MHX zP`)+rOZ6y9*_sHD-lxeq;Oi@{S%-MsCd&mPpq zfLtx9kJcZa+k4#@1cq+^_&nUYR}<4E3jzmllnq;0;GbNRsroHxKFiIEc`2v4L8^%V zJmu+UWuaUJQ)6uASNzTcEMt{d)4nck{mOsC9{@Exsw(lGk`{ga(jc*V-ONle+8F|w z7XyG_+8RISV{H^;zuTe?b6I^WSg+s6CnAWZ-F38N5N@}lH2HvHiB*fzAKECv^QDDX z=?l9;*xV%{NgrMp))Fw1ypj+>J$G7l!B(a7@>iPMrjMu~{wdq?*#5|sPWAO~vm8dv z>R7_dyeH?n!a`Kpu5V-7vZvbbER158#6I(co<9I&s%I+K<@{;qI}6(eL(N(77}MU$ z{*lFpVO62Qu;{rXg*OPnsH#+{`i7aSTk!{gwcKfyL6XVZ!2;^MP$G$X`#?Zq-NE6? zZ@tPcf88(-!CP4FPSFT$mR2mWf0KqLqzY}sQQ2gf*hEA-#ie<8fwJM z5)C8yU5m8K|H2f_pZCoPm`XeV&S;{(6VHh*eS=hvG|awxmhrVkvIuFAK|_+j&K2G% z3r%*vT>W!a_EnKnpUs7W^(1U9E1+`2N#zsmQJL2Rpn1y?)nWW{KEEtcg@%@lw4U#k zbD^&UuG{iDv!E6GFl*vK+nQ@MpRE7sze8KNqxHT&{O`&)&W3%YsGF1+mNeGn)ao8Y zWVFkcuGTfxr(WyqrrqJ9f{vnaY?SPINGCS_vbG90WzQn9I{G47At`Ptqbk_!Ye|yB zp^!{3-nR6P!apBbtR2k%3FOxD5=NQQ8CWHy)R*H0eDSxt6i%;*p^z7lZxcXGsjq zAS~hQHd6_iBjphf-e<{g$#=ugub|LN$tqjX#Q2eD$o=!UzO!>=^%qjZ;GUPemf#RE zIYu9Nawo>Zyf*X-hCU8*tON$YgaO=IWs&7CS<+aEvo(ogM4gc2`TbpMd-EG3MQVOmPKIXxlk1@(+Q!s&v_MYIFalumIzhd zW{v$VA`qRN7C`_vDdAS%k=D*>9KY~!KED_-f7c?&zcsUvSndSyA~*j)I+9|~swU8* z!x)l?qmqhtz%m<*MO+Fh`vz3EKaz@!x}3;y{!1VCZ|7}@)(=`G)29ROZ%q zr}WwN|Imup0rp6W;~%|L0uKNQEL9RQ=f!v27P+Cl&b1Wl=|7;T{GDr6xinB$GNHGv z-)R-THnT6|lWk7iM9lFpy&S9~#VeHslwuV7irEo43g@2q$~A-h&|@a=%L5>PsepHy zr!_3HT6eyO-#%<|GltnQJ3r#VFes0yp`J<5Q z1*rvfp>Io1eu8v?8mPm=%f{-{ncQWw1(}_t7d%M~yDb)%$}8O*;?WeF>!MHA*Yi`+ zM5`Sg(+RoBKxHi7zH_b394za_xVS%X8-D^$P>f<+AvP&jB7lQyu} zGi&CUZ2!@mAZniDu2IShEsbeDhN;^F@Glu(t*(z@(vWgeFg*|MkWD6#V7y2iO4`G4 zmT@m)xT!LTdpw!uQRl^4UXqS!Rg;!2npI)h*?IA#bGXuZ(^4mdrw96!{E6KRJFxfQ z_qETJt-5Klv!Q_p4*=uL@>`!9eTM$6pSmL{x57C%oiZVP%SF1sCS~ISxMR2c`j#uA zJGpo6FIAURPK+x|$nY%%r)Wk-!kBo^+bgP3z2%?MW{>i={%!V$Z2e<6u5i%q(H;W= zIi@WS%Xth4HGXu*9NDP_pT_>R*Az0r%_on>>~~$KOr1nuq89_sAN5#gX*O^uw}J;| zAX)QM-GLx6bv(8ZQZt}e19!M)b|v>k{*dQwPtNJC`g=Fv8lbajpt%%b3abf zEVakEM+=rs7N*YKyi<6#ZFCySD;}zNd0x~jvbWbo+r1ADsxtQRvoDh2{#pDbv0l^2 zKR4B0TeJ&C3|S)Lt0j6N&P+ENL3&XW%zl6yj;JsX}=d%yf6vh4}P^t$$iaQu}5}E{oo2%&0Xa4p*_b#X1AO zERrh$v`qnM+sr(EUt{YmN*Ufs;q>QGyr;aiM5!vfv~a3ngqQ)s^mDMp(Y1mR$Z$h9 zP46Dg#crPrX?dQr_nf}@jzfqti2V2|I=rGRW27`$nQGDQ?dzMR_;RXW!$^`Zxl#!q z>wgIC!+d&Uy&nMSwP)XE=()F6*YZZ^&+1ft0N30!*G0M49OT?H);^pTIyr*4-ET7# z&T!7Yxm!UVN!xL6-UYv-pQ-$VJ(Dtmb(`z=0%K~liKUx`uwXCZ*>7=p-s;|X^k&>Q zAKyl<9$n9G?()*#rC~F-_o^~qb^V*akL?Zz^HTe$KA({ku*5<(zK_?RZ=}j} zmt4m@N{v-$oXF6+Q)fw{XM0ku`7V)D#arxm$qH7Xy&Ju^TGAS#R#!s8W)RQTR zo<*kWACK0?(ztbGM^4)Q1Hc#NAO3wTfitSa1N*b4)wkVu9`#SHsrx{ ze|61YUxy^L-n`lj%2{)tkXrCSQ7$a4x@-eFIuq2Vp!8oEg5Q*jX?q5-oLZ{9Mj5o8 z!&E6cvBRu8z+ZaM;W@5yCgV7JHx@e(Il0#q3oMt&`RHS83MP9TjWtS(l>GZF!)OzFs`}w)#MoMRpIp#oXPa5=avX&C1I6TF zK<8!Dno|FLA(4n?vD|!K5Wm|sY=09ke{oT7wxS1_Rwo~M%z-h!Om4-*oVV`4 zpz1Zrw1uQYtMr*P1ipIl{^VL!r$*eCt$i|$`QXLoTlc@Oe{6Cx`@qvgezEb@5H!e% zN*bX_{0QwxnjP)E#=)(4o6iumrB-n?eTLM>25Zx)5R{NE_jB8om$~y1e>ylBvLkvw z9u}O&iZlrv&T@>R_e0*rIJ%A0jIG`^FDQMQb(TuB>yc|2WBIAyv@FAhEd74qRbp|t zbTgEc2DlV>eJo&vYrTn@rP7-E}?@GCnua#xkD+Jukdx zewN>UQ<;&j4yTMQ*orLbnbMbW^@419-{p8Azi*S#*P6}tzDzXi5c+yJ;!20FT&*!1 zlW6ECAQAtWP{wx=_W^KJb^sgY>HgStJp~!ymNL#MByY>8)4;md8~A1P*VvR>W6w6t z1eMKok1sQ+=fzl%k*HAsPKlqwSSS|#Tm9@{!OOlA{A$mdd8CO;$P|yYWyZ3w!d;ZS z5#i(V3)Ri#R#(r7ocr!1U1!>%L(ZW}GfDO&GVu*Lh3Lf%OJu9qhSFZ$+`?$2Rn$F^ z{x{oco$AQStWUH;PJWs?Y|_tIo+r;OB36&{+FEwJa(HuwraG1zdy$UVE((p~GS+*N z9!yOtlW%?aPE?8du`vdBkwJZo$x_mnFXdhSpob7L0-LxucMo`Sy6>JO!x6YKjf*2q z7MqhRPzPm+Pe|`MQEC@zg5WBsTNO1BO?Fmacy45?bNCqRDYv^=$T^n!6;0B7oQBP6 zBp1^$^P0=;2VBT_7`c&vfmkl_XoKQK$ABw0&&NGXj7jl*g91p2K(E2r;4F%o`sf3i z;%9~jfFEhPAGCvUYDo(N0WJYP0AP-c5?(1jpoK0)vLp`ck>@jzs$x6O7ASfm>jNOJ zJcWm0em<$OHDNev$aK@6oB14||0Tu|)0&<7NKxM!Gi1`|T0SFMYLe2Of-=H2Yil+m zx^^>OSfQu3#_tmTF2*oAAe$>oII+os^w705#xOH3fEE-mDed78uDAY6;E)mH(RP7X zQ=GVXt%K+&?u9t#?W}o4er_e+D;j;qIx`b7x3ebkvJH-nTIJh?oUb{|!3X?!_O`IT zBL{yUbEuQfJ9jI`=sp!+UulyX@GSc<5#=!#VIUDlG$`aMIYHq``WuGO#%fN%e0p-= z-iow#6GQ8^#ouF~92%kL%0y^5;rXV-=ipXCAvF05jow{HIo3O{sD=xPo%VdPlpm;5 ze_Hw2x)++NrsL~AiahmTkjpe6+1ux51xwKYX#QBO!kN)kM-Tn^Q|u-15HwFmml~I` zPVY^q(u$WbvIp$OZDGAUeC#G;f9R5OXg<>+s0lkRpbYb}t5bxc`fad&F_z?UXgvbLG@Z+xI@cn~*1*bDlFrtJlI>vRwF(`Uv! zGI_x%c6wCDnj*|Cjz~u!M|XwL$ZE3)y?+D0zk#)aw<%J4d&#aMc|BQ+2r?2Qw%wvs5X*mDd`X%M`gX+=i~{v z(M;S1AL-bHmn@s)v@e8PYZ@e-lIIYJO~7c=)q1>0ld=H~&#;#Blyxf| zBa8hP8i|Bf8XEKI4SrYNlJZ)7xHl8Jk&Rr+1glH+y5ualbE+l#_d;J#=xr*Fg^r#u zi87C)XpxZ9A_%s!+8*2w&Hv_nLR0H_`Z9bwTL}iD=VkyTz5b$K<9X4V^wy^>qEjpb z!;BAh{D~9p?70`K=J3(X-uP#xbYAgG;Duh15U2jii^(A)V0AvX??I(aLT$F_+DU4K z^e6Q&x3Rlu<4IKJv@!o>O0(zeg)t1RKC!e13LQ zl^S4aK-MwFYdBtMII!s>i_ro%Dca<$b)sx#p4LiacXW7NorD&svT`|i zaZSVy$)KGHeqE!K(moYXF+7>9cx$c-3Ztv5v2SVpbkE(iQ!oKxcXGG+SjP?xtEf`m zUu-ea8Xsj}2z>I)vfz&>^6Cg@bt)>oSBqA7hRQAAP>uY?G&63L^DaN6&VPa-0e*c@ zcCXg~ebv^M+a7q#M$$tdr?aP!hUk)bWpl;79@<%_*90=532e1&`j7+E{I2PL-EfqL z3{2r$cunhx{izBSNoGc8;JsqEA|~q+@OUZ2%vOQ%;Dq*#-MZO)ojQ`VNM6$g9%I*T ze9b6#xzDiPGFz#=^LNOa*?oP0@n)gtmWk5Fv1&v!{SO4mg^32s5M9I88+wWuIt*ogb*Q7XGbFEUh>~;6xiY` zpQ#cSb)H48*yokdZMkl%@#7y2(^AtZ&Y77{dK zpt13EAgHnPjyy*7G_SylwztSx$D_9}7_`57cw9&4{&?2(WXs(VBUiiK^gEJ%JRC=& zk;o?E;^Xo<#?wvj`U!iWp3yPuF8A*%QUN=xEfpTAESxv^yTEvkLSNfO@6Z zCcAZSo|r)G9I$-EC_PnO7K}IHioNT~NtE0#j0anl4e&CE6(S9eW;mcso-tjm)DxH8 zl#BcrSR3*mI?^C@j+#vRA{ST)27R7&XT<=D=PbG;F8IB4~-#PA8E6cR`?B}Nuaibd9{>WJsvRJv zgf$l4AkOmZ7;T1T-k85C6AUq^d#mOraqQo&5_ZR*1?KbeL$bpJ(}4Z<3@xf5J6_XB zd|D^zm(7f;aEU>zKk1l8a)WPb>a!dhseU#f!_s)_sPy!BcmV*1)w}_I{i0`3X;3M@ zzRcGamcQJlVe65B_YoQIX&3J+KCqPtMh4Iv{H{m(CoK_wLr^J5Ss3#omf~Ox=anAD z3Y_2Foa{VMr&frdnh$Ir$3L#R6i$>6d@<@XP){A(dv}O=YL52Ku(^Ow!ZcHv&({3` zfIgrVN9I$Zo;tC9>_dSG7|c6ycU>UV8^ZwQuD_jt*<1-Iy<1YCWcR={ZKT-V)xK+$ zz17O;Z)-7lYXy4%@TB9m_;vJ6QQb6BTNsAWLdEc<%9a_(S(JZjH`twdD*t{$+!jVy z^arIFg5m0NmlSVtasye0W#K92Y96Mp`>{U~ p-ohnj>Fn@*;Uc@iE3qJR&i{sX>;^yf$F*AE^8aEXXl8g=`!9SGGphgq literal 0 HcmV?d00001 diff --git a/css-flexbox-2/images/flex-align.svg b/css-flexbox-2/images/flex-align.svg new file mode 100644 index 000000000000..1753e807cb0c --- /dev/null +++ b/css-flexbox-2/images/flex-align.svg @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + flex-start + + + + + + + + + flex-end + + + + + + + + + center + + + + + + + + + stretch + + + + + + foo foo foo + + + + foo foo foo + + + + foo foo foo foo foo + + + + foo foo foo + + + + baseline + + \ No newline at end of file diff --git a/css-flexbox-2/images/flex-direction-terms.svg b/css-flexbox-2/images/flex-direction-terms.svg new file mode 100644 index 000000000000..70fde881e411 --- /dev/null +++ b/css-flexbox-2/images/flex-direction-terms.svg @@ -0,0 +1,66 @@ + + + + + + cross start + + + + cross end + + + + mainstart + + + + mainend + + + flex container + + + 1 + flex item + + + + 2 + flex item + + + + + + main axis + + + + + + cross axis + + + + main size + + + + cross size + + + \ No newline at end of file diff --git a/css-flexbox-2/images/flex-flow-english.svg b/css-flexbox-2/images/flex-flow-english.svg new file mode 100644 index 000000000000..239ea7a331ff --- /dev/null +++ b/css-flexbox-2/images/flex-flow-english.svg @@ -0,0 +1,24 @@ + + + + + + A + + + + B + + + + C + + + + D + + \ No newline at end of file diff --git a/css-flexbox-2/images/flex-flow-japanese.svg b/css-flexbox-2/images/flex-flow-japanese.svg new file mode 100644 index 000000000000..78e890155454 --- /dev/null +++ b/css-flexbox-2/images/flex-flow-japanese.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/css-flexbox-2/images/flex-flow1.svg b/css-flexbox-2/images/flex-flow1.svg new file mode 100644 index 000000000000..c6986b500a3d --- /dev/null +++ b/css-flexbox-2/images/flex-flow1.svg @@ -0,0 +1,24 @@ + + + + + + 1 + + + + 2 + + + + 3 + + + + 4 + + \ No newline at end of file diff --git a/css-flexbox-2/images/flex-flow2.svg b/css-flexbox-2/images/flex-flow2.svg new file mode 100644 index 000000000000..fec933b099db --- /dev/null +++ b/css-flexbox-2/images/flex-flow2.svg @@ -0,0 +1,24 @@ + + + + + + 1 + + + + 2 + + + + 3 + + + + 4 + + \ No newline at end of file diff --git a/css-flexbox-2/images/flex-flow3.svg b/css-flexbox-2/images/flex-flow3.svg new file mode 100644 index 000000000000..70b33ec3e80e --- /dev/null +++ b/css-flexbox-2/images/flex-flow3.svg @@ -0,0 +1,24 @@ + + + + + + 1 + + + + 2 + + + + 3 + + + + 4 + + \ No newline at end of file diff --git a/css-flexbox-2/images/flex-item-determination.png b/css-flexbox-2/images/flex-item-determination.png new file mode 100644 index 0000000000000000000000000000000000000000..dfb9e843ee18c704cc6d11dce93e94171190d4a0 GIT binary patch literal 1334 zcmV-61<<}(tCILD?P|esSNC2+I9e}_0o(ViD!iVvmKJdJ`cTj;RHTW>z(+6I~i5C7P z1<4P2R|GvUhW@ct)W@ctg8s^MfJ6>O( zvEM9nRo0Q_-hSa|0W#HPFcQ;EuYXB1#(oEY44^{lkW#13rYrRPj z{>cD8gTdWUk;U2gIAaL#GZ~(BeMf*9;5PyIC0C+?7%le2{m~u#KS0}hByn1zoYiuh zNZd99K;CvJ_0*|Ms16OP)7b~{;oQ~u+kzEL5|kv_V5TX5$~y#5hrH|wC<~aGZ6g|4 zfORbzTQx(QRsUK0f;SmEZ-!#16Kn5M{yqTw5v05b5AgH*WiNICz}*p#XCzbrDN+^f za=W{ul|Wu_I^R-#B)e$#*V1&!;ll9u+Vl74`D-BA>vM&+T3;uqLtfW8ByCQCZS^_} zZ^z{C!`dtXJY32%JDbn=n_y9-%Tf7O2kr=xqxN=|1NixU>r)j30H-8pdPj~N4FbT> zA+R+^LwfG>U;vQ9vYb91AlcILXubt?$TJ5@0JvgqFlpuLg!H}UQJW=zaR-b5?2G|u zJpp%wn){%0lK`N&zcvLCzyirB2+9$^Oe)V01Pj$69O91aSa*Y7^q-~u6{s@x0D>y9xDD1ahn}h(Zl4DKFk(31h zEGZyu{W!!N$pH_L3ooCQ+hAopK(bBHb;xr?T`>98TPo9K70bkc{G;T{R;vy`ib=}w zM`%^&7XTFYeR=qbYhZ}3fxX^h@ih>^TmU5;K+fhn< z4?ww$MF8z70YG7&eU#`va7uI^*c_-4-v>rr02UdLw1ARi6D;bGhth!gvYYnSXYZN- zU{0yPl|WYN#Qnif0&INb0e(?m^e8;+@eGFwi+v%;b70jMQrNj0jcwT((B#c9+EcX& z7Im}$Ti7hOH@D1?H|?J`F`(`slJw3ykQGfVJB=qV>x}`_9Y)f@gDP+U#eFfr-|fu= zYcluue>34X2I!bs$Jgr}AWIxN{%hw9P7nryD4GUUM6i@CAh;l&(n0#r8q$CjBo*Ws z8DaIB$sbsh_nG5laUY%@%Lm|(_&@*x5P$##U_aVyQ2NVz065%j{7S!@ZLR>EI~%{! ze+)JNEdM;W(w}-80BTAffP&HoprZ5vs4IN{>PjDgg3jG68@91Rwwb z2tWV=(696X82CybfPSS9K>d|I08#oV{fa^9qx4bwD188;^ilfA1OWP5JKFMrzF8|# zKdk)#Oy07Tq;Ez?xPsmrbIj|h@5%@IW^9BjDCd;!taZm-zQt2n-wcoc3i>%(dmA}7 s2?$DV%~NQwB&X3jRQG_`mP4MF7raoC0n3)ox&QzG07*qoM6N<$g2yOoH2?qr literal 0 HcmV?d00001 diff --git a/css-flexbox-2/images/flex-order-example.png b/css-flexbox-2/images/flex-order-example.png new file mode 100644 index 0000000000000000000000000000000000000000..3e1fe6adfc3051db370a9c2209ac4c6d62359c21 GIT binary patch literal 2006 zcmb`IdpOezAHaW`#f)S}lgrk@N^ZHN+>RJ#d!@6(ac?G}MTnzP4)Rkm_giE;hAEjl zxf7a8rA(AdqBNCBt(dzM?@rJAyw7>wzu)KiKHum2d@r9rzL)2l=s+UwL?|Hu0N82w zFZ}NS0ELR|D7Z)g77SVf07&H9;jNr6Lj=qnp~`l0akF#=LobxeZzWBuZ*V{^l;S6;fYuk3Id-TdkjGLTCrgQ)jsb)h;0@BzG5 z0V0phDBKsVtyx%`Y0tLBJW~zwXYf124JG>pG;0}ODe+q1i^DuB~-4g2%*uN?lYY|tK3SevJ&hr$vk)?S? zM~ynf^W^HbQ_`knoCmoI=98b!=01`hVCug6z61|S)INfI zidkxi*chs)otvgBa=6b*70k>neIxBvIdJKYh4M>?!bq&JT?*qqA{2{wE1~v*YT|KHE}m;Z&G~O zi99_Rm$n!7_7E8jA@DA;23I(Sl-PD{YisMhX$~}0>`a&?FH1%aLiERi#|q)-h28Qq z6N@hbf;(mPe{NETrf`&Tcrvf`5}3FKT|m3SnjTxmYPC+{y(>JWN2(XwCdPw+`|+n+ znjV|vj`5`+gFV7wkWobgutN`V-h#&$fhVJ<-YbXi1|*m5{HBu|GfMBqRIG%4{Ao+_>%$FOW`$2F(mn8WF3d z+OrIztO^I7@ij!1;{$U~0g{p422heTl{DK ze-HG3ogeZZpKwvO=*Uq@(>YK`wwv*@Kr0F0CR1|8<5rI&4HZ9^*bh9>jHpO$Jid#a zgQ+ogFpXo!!+wEk$UkGf?_i{a58t8k@r?%ky`gwUU%(@Hc5;^rK16+KT2#qR4Dh{~ zIGu1P^L&m3grIV_|A6t+2T#t0%y@+n#wPBiZ9ES&WOSwmz1ef}l@MFIom^9JC3=^9 z=W^`#t4nT*=XzFhpLhK-55&VT{aOZWSXb))0JU%u^n)gQM9 zgfA+^IdEt6bT9jo@9ULjbwR}3t&F;Tj()F?mxN#=FR1gA(HCmFR(QS|9bfn@b@vJk zU&Y(&Au;^2wrux4+ybzudmHftgB^7n}ao z?Tol=&)n&K=+i;Y^?dq#qzk+jS8M=1cRFgaXy?!dN@Ya@P#dme9DhSFTGnbgLO2Yd zeBcFtN+kHd3(wQ7!iSeSUDV9IX~+*8VxmN?lkR`;dH9rg89q7Ti$fl?ZAh(-##O1qnu_r>twznPMV#26z(3DvgQKk zH3$K0MiinF?rwY|V6u;&B*b|L!ZM|u(RGfL;>qB)<)222NTYW=Pms#{#C@tk(-aZl zO!mS500ibyHu~6FiZn>RODookSrkGnNf^OgDv97V5 zm%jx!_k?Qada0R>l-1?f_m{Q4Pg)tpkiHH4n7}o!G|TSsQtE)D<9y^O4g3aO|Ip)Y z%MmuUXzl>C=1o?InR3LZCbL-q8-t0ZS+c@zLO=CTwDQX_VtRYPk=lw!l=&Ff#8<=B z%xI3mv(MGWo-vx3_8xPWrmz50jh1)xGxsA@q(Dbkh-ltV0t=DIvM;G;$CyVSZu(4# zrFY8lp*$Yq;@y}KLiweegtB^ T9nH1;`(fMJlJM2m-dFz(s?w3% literal 0 HcmV?d00001 diff --git a/css-flexbox-2/images/flex-order-page.svg b/css-flexbox-2/images/flex-order-page.svg new file mode 100644 index 000000000000..0863cb9651b4 --- /dev/null +++ b/css-flexbox-2/images/flex-order-page.svg @@ -0,0 +1,32 @@ + + + + + + <header> + + + + <footer> + + + + <nav> + + + + <article> + + + + <aside> + + \ No newline at end of file diff --git a/css-flexbox-2/images/flex-pack.svg b/css-flexbox-2/images/flex-pack.svg new file mode 100644 index 000000000000..33e742b45e4c --- /dev/null +++ b/css-flexbox-2/images/flex-pack.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + flex-start + + + + + + + + flex-end + + + + + + + + center + + + + + + + + space-between + + + + + + + + space-around + + \ No newline at end of file diff --git a/css-flexbox-2/images/multiline-balance-flex.svg b/css-flexbox-2/images/multiline-balance-flex.svg new file mode 100644 index 000000000000..0c1ef7de03aa --- /dev/null +++ b/css-flexbox-2/images/multiline-balance-flex.svg @@ -0,0 +1,24 @@ + + + + + + 1 + + + + 2 + + + + 3 + + + + 4 + + \ No newline at end of file diff --git a/css-flexbox-2/images/multiline-balance.svg b/css-flexbox-2/images/multiline-balance.svg new file mode 100644 index 000000000000..e94a8af99aa0 --- /dev/null +++ b/css-flexbox-2/images/multiline-balance.svg @@ -0,0 +1,24 @@ + + + + + + 1 + + + + 2 + + + + 3 + + + + 4 + + \ No newline at end of file diff --git a/css-flexbox-2/images/multiline-flex.svg b/css-flexbox-2/images/multiline-flex.svg new file mode 100644 index 000000000000..a3782d11ce5a --- /dev/null +++ b/css-flexbox-2/images/multiline-flex.svg @@ -0,0 +1,24 @@ + + + + + + 1 + + + + 2 + + + + 3 + + + + 4 + + \ No newline at end of file diff --git a/css-flexbox-2/images/multiline-no-flex.svg b/css-flexbox-2/images/multiline-no-flex.svg new file mode 100644 index 000000000000..9e77721925d9 --- /dev/null +++ b/css-flexbox-2/images/multiline-no-flex.svg @@ -0,0 +1,24 @@ + + + + + + 1 + + + + 2 + + + + 3 + + + + 4 + + \ No newline at end of file diff --git a/css-flexbox-2/images/printer.png b/css-flexbox-2/images/printer.png new file mode 100644 index 0000000000000000000000000000000000000000..d73f781ddca02cd133976802123232cab2a08a64 GIT binary patch literal 1959 zcmZWqX;_kp7PcC5N^zZBTAV5kvhmE<5)_XI;9jv zX^Ey{j#-(?H>QXhLS~BOf<{6mh$ONIA6%w;f86J}KhAm2^PcxCzs|X~53>uhboo*f z6B9_t?%;4EQjON~{UW2^50XNSP`z)@fgMIP7z{>lV`Bq{!=s|2#>dB9TwE3|Tv*y&PQ-Ohjd3kv>8g0|2 zO(+zqprF9g(z39yaP{id3WWj!f%NzHfBpK^&CP9KV1Ps-5sAdCtSozb`_RzPB}<|fR1)*Iq<3^b$nKI%fr`^`p-W%Ew&p5^dOAqdY1xt8bB(DI7V;lsOHgq zc$g1bB3|0rTY=^M@{JvazJU6_D}|w%Gqi)VGRZ2(!)k}DoT^Kzu~zL~D69b0AiV%2NmGL0w;Y zGyFwmI~AtQod`RF*T=$qv+xLv{npmYRqpvXRf%Lfa;$@~a;^E?mz%K<8mobmu&;7= zC3D-6Peq~l(}Zs1N8xozUOjd<{9FzarL-mzKE^;+SsA)!lF)8u!*@3;)6>`M3nv86 zLM`W^q}J%DT!J@OUb0dV;3)eNc4($9A>^1R;!}o~GW}?d-?t9+XNCfvQh=TpJ&ft) zrKB>bYX4_boHEjh_42ur&?W9(HQo{{y@%}*}QUtv%Ef_x7SwCG1 z!is`-7N<@Ze~;2>>d#o{&z8A&?x)(#dlTveEoq4uMEi@AFhpnN`EV(CvGpt+z{v!H zA8C|c4^RHCXX*ZwLyAlolA~08o)w3Q{%kmM%1zsKs3fO2cTD!0R}0G9l2p@ppKk?2 z{}k+TTa-5n^L?kOPqxr^A60AUw`R=*Enz3}$%KQM2_?rVAEQ%>RwjNx=*RD<*0cR) z>w35n4~L0SS5;i?o}IMQ^TebvnwN|Xcr;e@?6{osHimw)`xD!OP!j@|MU>)1F*m`3 z8(uZ9pPoEQCe5pnBbxdwNBz?l)L}DKcy}Ar0Yte$Q z9*7}f8DBKj+Z-DenOPyqXy80U{C{rrAppqWa{ge)&?_qXiRJX8B4WUX+vgc$E#`x% zlczHoIBY5PJO6;+H1#aw;H3n`$>e(S`DA$0r}WAD4g0t9l^OV{49%=ppEnw%x&kkC(&b&fC!y{5uOf4N9V=Qe z@2<#$HYdobPht}$sZVTD{*)d1pD_t|H1O%;?MEN15-{>GPYTTQ>O@!-Q%6o6#O!Y> z?YY;->Kd7C93iH6>Dj)C)he#F*wZ0`zh&N$oWZbHw)uVMBIVXJT)Ni7JfI{YcZ#60 zTW@?SX2d7wg6y0<{*l@zyb7r9^QmyHC1lo6H?~u2oVcWRn9P}#S;O>pDw=1JK5OED zhuy-KZKc;{SXx{{KK9_|8$$a=`}lOmJR^2gRmlr~4ch7C7992k`g@JGT<>&holUC{u0PT@dsAiFtc6;hYa*0wC&MzX)*G60hPr@#3@Yz**~2uMB?ipr zs7`WE*7|&$ob&{XAP&-SZgf zUbeNjcRW#-&!O?LWF|_Q@7w!QS1=)%p(%X2fgiB;_c}CEv9}~1ew^1Oik(|K^enrh z@h@L7O@zKo#MfjWap~VEG6=RDdwilV^cRlWcq9@}40b8mcX>bK5aD=H#1%7*U% zd)d`Oi8jAIhF}bob*AQ{s#+#Byk*fA5eo@k iH$It;t2TZeh6T&lAtO^6XRM4b%p_z7CYT-+oAqxiQY;(* literal 0 HcmV?d00001 diff --git a/css-flexbox-2/images/rel-vs-abs-flex.svg b/css-flexbox-2/images/rel-vs-abs-flex.svg new file mode 100644 index 000000000000..ce62e19da1f5 --- /dev/null +++ b/css-flexbox-2/images/rel-vs-abs-flex.svg @@ -0,0 +1,77 @@ + + + + All Space Distributed + (flex-basis:0) + + + + 1 + + + + 1 + + + + 2 + + + + + + short + + looooooong + + short + + + + Extra Space Distributed + (flex-basis:auto) + + + + short + + looooooong + + short + + + + + 1 + + 1 + + + + 1 + + 1 + + + + 2 + + 2 + + + + \ No newline at end of file diff --git a/css-flexbox-2/images/target.png b/css-flexbox-2/images/target.png new file mode 100644 index 0000000000000000000000000000000000000000..045d83d5ed6ade72559a7f042297f5944c8abf7f GIT binary patch literal 2904 zcmV-e3#asnP)2M7O1Nd5{6|IgF;Z*u$)6#r~%|IEz(>goH7i~lY${VOW}si^z_1pn~!`3({M zn3()AH2-O6{-UM*?d<--#{3!@|4vf;+1dNx8T|2sPWpQ8HX=KOqn|GBvQk(K>8H~&FJ|9N=+VrBotuU(!1018k^L_t(|0qoCH zk_1r@0KjUa+P01RA8+-&nwe(A%NrzYfglKiplF8WI9?D$Nk)_C>M9|-#*NhW6;esy;fA~*IX&dy#+*}AR8!*)>V|@o#4YZmjo}Pc zSK@BUu7bn$GVV(5;aG!O-RaT6?@g|pU zeDka&ny0GtX{od3c2!7Qb(gI~e#+MQa#0&uZSpA#53CF^-KTut_VA*Ot=p8E_#w06 zFs{l$S#-{)`V5Vwyici2aRz=QvpQ#FH0wDs+cWP^ z68!}`%dqNpfh0y)*NNWa43hhLEQ#e;$*^8{O%S;=ih?juz6R8v8}wP>4t9z0)8+o) zd%1pL{F9Lu+BvT&EIH_owor%0%sdJOBK8xBqgvwy$DFa8spzGy>&A_@3HAP4ntW7%- zmS~+*0>fQH;l4ql+s?-%tZsNMrHX0Xne^2KM19dJt*0DVDv z5#zco_9E<2TW(r>(~l560rnPtasOD zchAi=U{=EHO*Q6g9+C@+Fe15u#}~QDjv}d+p+j;+`!#`sc>bX_oBd?4;cQmx`5v)m zOfguFnPckE2GB_Hj9l-vAsC*TSJQB9QxwT*`%0&m`$YLVH9yM9n;7xtq~=ebCaR21 zmjgt~(%^N!1Qq-}b$U673+daaAJZ#mr@id8yawK(;mOpo=cLG2$RCrg|rXa>fRDBWo(z~Kaq)2Yl?}(A=Ny*4N z;y7`p-z3LWRZO$QNrtqV5WdWJOA#6mgv;#lF$Jy5fzv>sR@u3b(NDo32_I5!y525M!2X5 z28cUthSeq6Gp9g;7We1-oKvsobNA<{C^dGPbNeK3xQGdnuAZ!vJ_s2`QBX&M4mOj& zt>#wCq2!ws8`V&aQMb6h3N7G+3AlRH#dBL^$kZOD4j~ zLhbe;}Hwpz!OZdnUh2MMC!)j+8PRng}VmW@=7+w&S3bYU)$OGSvm-XrvqSfvN5@E`2Lw|LTh(i*L%Pf&9sMI1pvZVUv zj7(DwZAto#s5Gtc3R>W!aR7a^#p*TLGZ>kI7(iEEX`4j)3u05~@U0{BQezQ9y#*+x z9Ts*#X5~Y;w87F)0}y9CADJe`4>X_LjT=ZFNT@B?xs z!I+G*T7=tZ=Lp(K$e9iRUvflx0Gy-`Vp5T2*=GFPM?R%sii*n*kxm#myoS^$H%zJ& z+UnQ?Bd7wno--g4`uv>Q)~g^2at&TtN2DYHI0co(4EUlG|II8N;0rTQTqe_Io*`0! zyfXM4oZ>1S#^-=Y1^hXDlBqvgeHYtYBAGY5yqe+V%^TkTKRnXNNVg4!$#eLZP!6 zi;Bc!QP`ERGr92g?o?Nztt}d=hUu`Wa_br0PY{p3J4;Q8 z@aVhH*k4pOdBbB_XD-aaR%hc23L;y7yUsO|vPNXky+-n?W(onmk+m@L|M@KcN|$}U zdDps<<^9;+U0A&i!%zU03n8V<%*+h$r~RjT3$!Z9v2%{U4Z^5<-yX>-n8CR)j5nGg z)F(%U``V8Rzdq2t;UDO}G7ogCAG?pgICjq;jvy@c;RxIj7NUxb;tUZM3_&9sWOHQ* z8exfp=_`nXF`+&BM=O~CEd683*u&)9Aj9MwB211m@~<0IMaE|IK&ch*q>CD6@Ax165pcksHH6s z{_H^-F+^ga&O*upp(Q}3D-xXL1>P|JY9gTwk}Z+a`5EouCH^SgK}rnxz4#h3e|)Lx zu!yAI4gzpF1y@MGrf zq=k~S5}=4!%BhB53IH$#{;UgCL`KD+7l`;}pG7a%1wC{d9y0J6UC@W$PIvGlokH6O z#fZ-puWL2xprumT!#7l_HPDwx#0o`xLEg?~1?Wy>b9VmO#ql95{6sR9&fr~{bSjzf zA$&w68jHs*+jd+J(Q_T!w&L+vG$J6Z48t%C!}t$y?kd*tMB2ar0000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/css-flexbox-2/images/wp7zxxyu.gif b/css-flexbox-2/images/wp7zxxyu.gif new file mode 100644 index 0000000000000000000000000000000000000000..de0baa509d2c977e3be341a153a03ed19e1ea036 GIT binary patch literal 1731 zcmV;!20ZykNk%w1VbcOS0P_j}|JMK`9sox?0BKnOiF5#`jR3&Fz{8{f-MRq(|Nj60 z00000000000000000000EC2ui0Mi0G000F4Fv&@)y*TU5yZ>M)j$~<`XsWJk>%MR- z&vb3yc&_h!@BhG{a7Zi~kI1BQ$!t2G&?w75ty-_xtai)odcWYXcuX#v&*-#z&2GEj z@VImY0~Bnj4c9otvPcqNAjx zJf9P&rmL*2uCJx439_)Ywzs&sOtQ4PzQ4f1!Y91L#>dFX#>L9b&d<=B%+b`<*4I+g z*xTIQ-Zg(L-?C2pmYTpuvL(6DnND zu%W|;2w^~+NU@^Dix@L%+{m$`#Eu~UJ-!G@vLr_k04;NDD0R##V48*EH0RaUR0}P<3puhpJ zP$4cAI3R#PtOZ~S7z^?2fwULP8vKfP=i0s%|5o(M)-7O-QYC??S^%q7fms1`MGI5G zfwPAht{tGjE!Vg#1t_4Kd1Y77rFjZYt(mCCt^@#ZHq4r0Vhg=g3b;$T0Byc810X;^ zyEehUZQtrGIpFbJjLl6JK;2Qm!R5wjuFigNJ4C{=i*s-7Q}GAcYzGqfO}Qmq(&LdE zhFkKibNCbOo5ap>{dMZ&wd7s@fC3HZ5O~QENL~jiRd7%MlUWCxY+XrM;aLh;Cs}M& z5%85|%1s8If&)n;T32_4ryOdNjm4E)5P}GyStwFhK!gCybt85$a!AmP2<(`lKs^ei zBZ?T3h9Z1ib;Z_X2*p^TkzI|&8EgfW72`k&Rwbf_QVyA8l>)8D8Gf~W6r+Y6q8Ok= zGtyPol>mGQ8irzSSQwX60&wG3Y-V?xCyO2AUzunP0Ge0;oOKn5k`Y#<02&f@7Jwwe zaHEkLCP<%TcVR_W0H6(^p;=Wy2B3apS_!6Bp9-|2R;&sK09+@IC7N|W%68XtS(Zwd zXa-RV*{~@Rc4(H71>n~IY@8k&tz^hT=HY1y!U@`tTW0$L0dbicsa{wnXjP+-B50VR zL@J6UfrC=gMXsRw?#NVu`Ln*y((F5x{1z;!>y;hm0P?DzN_H zN#>7{>1Xk1Ins5geq9=*mtzBsNF;~iHaX?8``!tnxhR7f^Q|Hd$#Q%z_%@JT9cKD% zdy;`hadA5)i?U%gyS1se<>6N7UiM;zkZ9ELJ9Ec0r#NtdBSDBj!=CEZFuHf?w_a>? z32D&89xENFLA~l%z}r~YX_$UZYF%<%tX75Jq30eTp56Z`cUOXdbC`IegWt>@49n6d z@S7t|wyn@@%Q_nWz}D_5bwNwR`$2;gAhaxSkP_tKjapmHmWECGxHSMUfPL_a6z&{Z zhgYq489`@>$99=+VU|$b83SGS$GhMA*xu-(HaU@flC1jRK?`JjmunK#JDTQo5Ft##E!O499Yl z`Os)i|)x36tL(Rg zVXKB5qayuIWJWL95kqb)BpC&XEkgcLN?(JL=v;uuN}&;F<-c1U4mNMtEXSQf-UOmvDZWfHGcJgp`JfKPM==$c*bL}vq; z4oHwGtLYF8Q?SG(CUt2{0ol(yK;cQ4pn1wyR+A@k3?xXx`5qCW$(GVgA0@xZl3q$+ zUZrDaP|_*SdTx!L#=)mO7sLV5`Qx7e4X6|RDbRu%^q@T;C_)#?(1uPSl@5)lL?>DT zg;Ml*q8OE^MKj9LjtX?69u28T?E%t}n)IaRC@D%;%2I5ow52eOsWM(F)0*1U7c{-8 zPIuahobvRiK$QkWgG$t*=3}TvO{!8e;nSr$^{G(c1s Date: Tue, 5 May 2026 09:01:29 +0100 Subject: [PATCH 004/127] [css-forms-1] Remove select styles (#13884) These have been upstreamed to HTML so no need to duplicate them here. --- css-forms-1/Overview.bs | 142 +--------------------------------------- 1 file changed, 2 insertions(+), 140 deletions(-) diff --git a/css-forms-1/Overview.bs b/css-forms-1/Overview.bs index 330197e095ff..37d4c41bf8a1 100644 --- a/css-forms-1/Overview.bs +++ b/css-forms-1/Overview.bs @@ -828,7 +828,6 @@ textarea, button, ::file-selector-button, ::color-swatch, -select, meter, progress, fieldset, @@ -847,7 +846,6 @@ textarea, button, ::file-selector-button, ::slider-track, -select, fieldset { border: 1px solid currentColor; background-color: transparent; @@ -976,12 +974,9 @@ input[type=radio]:checked::checkmark { ## Buttons (and button-like controls) ## {#stylesheet-button} -Selects are only button-like when they're a [drop-down box](https://html.spec.whatwg.org/multipage/rendering.html#drop-down-box). - ```css button, ::file-selector-button, -select, input:is([type="color"], [type="button"], [type="reset"], [type="submit"]) { border: 1px solid currentColor; background-color: transparent; @@ -1019,21 +1014,18 @@ input:is([type="color"], [type="button"], [type="reset"], [type="submit"]) { } button:enabled:hover, -select:enabled:hover, input:is([type="color"], [type="button"], [type="reset"], [type="submit"]):enabled:hover, input[type="file"]:enabled::file-selector-button:hover { background-color: color-mix(currentColor 10%, transparent); } button:enabled:active, -select:enabled:active, input:is([type="color"], [type="button"], [type="reset"], [type="submit"]):enabled:active, input[type="file"]:enabled::file-selector-button:active { background-color: color-mix(currentColor 20%, transparent); } button:disabled, -select:disabled, input:is([type="color"], [type="button"], [type="reset"], [type="submit"]):disabled, input[type="file"]:disabled::file-selector-button { color: color-mix(currentColor 50%, transparent); @@ -1063,138 +1055,8 @@ input[type="color"] { ## Selects ## {#stylesheet-select} -```css -select option { - /* These min-size rules ensure accessibility by following WCAG rules: - * https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html - * Unset if the author provides a child button element. - * The 1lh is there to make sure that options without text don't change - * the block size of the option. */ - min-inline-size: 24px; - min-block-size: max(24px, 1lh); - - /* Centers text within the block (vertically). From OpenUI discussion: - * https://github.com/openui/open-ui/issues/1026#issuecomment-2103187647. */ - align-content: center; - - /* centering + gap between checkmark and option content */ - /* also easily reversed, when checkmark should be inline-end */ - display: flex; - align-items: center; - gap: 0.5em; - - /* Makes options with long text widen picker instead - * of making options tall. */ - white-space: nowrap; -} -select option:enabled:hover { - background-color: color-mix(currentColor 10%, transparent); -} -select option:enabled:active { - background-color: color-mix(currentColor 20%, transparent); -} -select option:disabled { - color: color-mix(currentColor 50%, transparent); -} -select option::checkmark { - content: '\2713' / ''; -} -select option:not(:checked)::checkmark { - visibility: hidden; -} - -select optgroup { - display: block; - /* font-weight makes optgroups visually distinct from options. */ - font-weight: bolder; -} - -select optgroup option { - /* Undo font-weight:bolder rule from optgroups. */ - font-weight: normal; -} - -select legend, -select option { - /* spacing ownership moves to children */ - /* space inline from border edges */ - /* this creates a full bleed hover highlight */ - padding-inline: 0.5em; -} -``` - -### Drop-down box selects ### {#stylesheet-dropdown-select} - -These styles should apply when the select is a [drop-down box](https://html.spec.whatwg.org/multipage/rendering.html#drop-down-box). - -```css -select { - field-sizing: content !important; -} - -select > button:first-child { - /* Prevents button from setting font, color, or background-color */ - all: unset; - - /* Prevents duplicate box decorations */ - display: contents; - - /* Prevents button activation behavior so select can handle events */ - interactivity: inert !important; -} - -select::picker-icon { - /* margin-inline-start pushes the icon to the right of the box */ - margin-inline-start: auto; - display: block; - content: counter(-ua-disclosure-open, disclosure-open); -} - -select::picker(select) { - /* Same properties as popover and dialog */ - color: CanvasText; - background-color: Canvas; - border: 1px solid; - - /* box-sizing is set to match the button. */ - box-sizing: border-box; - - /* Remove [popover] padding which - * prevents options from extending to edges */ - padding: 0; - - /* Anchor positioning and scrollbars */ - inset: auto; - margin: 0; - min-inline-size: anchor-size(self-inline); - min-block-size: 1lh; - /* Go to the edge of the viewport, and add scrollbars if needed. */ - max-block-size: stretch; - overflow: auto; - /* Below and span-right, by default. */ - position-area: self-block-end span-self-inline-end; - position-try-order: most-block-size; - position-try-fallbacks: - /* First try above and span-right. */ - self-block-start span-self-inline-end, - /* Then below but span-left. */ - self-block-end span-self-inline-start, - /* Then above and span-left. */ - self-block-start span-self-inline-start; -} -``` - -### List box selects ### {#stylesheet-listbox-select} - -These styles should apply when the select is a [list box](https://html.spec.whatwg.org/multipage/rendering.html#list-box). - -```css -select { - overflow: auto; - display: inline-block; - block-size: calc(max(24px, 1lh) * attr(size type(), 4)); -} -``` +See base appearance user agent styles specified in +HTML. ### Text inputs ### {#stylesheet-text-inputs} From 94eaa44999a0a09a792722ff17c5d7ce77b24233 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Tue, 5 May 2026 07:25:38 +0200 Subject: [PATCH 005/127] [css-speech-1][editorial] Replace deprecated by --- css-speech-1/Overview.bs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/css-speech-1/Overview.bs b/css-speech-1/Overview.bs index 153965e4f094..07b03467b4f7 100644 --- a/css-speech-1/Overview.bs +++ b/css-speech-1/Overview.bs @@ -752,7 +752,7 @@ The 'cue-before' and 'cue-after' properties
 	Name: cue-before, cue-after
-	Value: <> <>? | none
+	Value: <> <>? | none
 	Initial: none
 	Applies to: all elements
 	Inherited: no
@@ -775,9 +775,9 @@ The 'cue-before' and 'cue-after' properties
 	compared to SSML's audio element.
 
 	
-
<> +
<>
- The URI designates an auditory icon resource. + The [=/URL=] designates an auditory icon resource. When a user agent is not able to render the specified auditory icon (e.g. missing file resource, or unsupported audio codec), it is recommended to produce an alternative cue, such as a bell sound. @@ -1847,4 +1847,4 @@ No new privacy considerations have been reported on this specification.

Security Considerations

-No new security considerations have been reported on this specification. \ No newline at end of file +No new security considerations have been reported on this specification. From 7f4a80018c23990c22f88bee7c092d8081db7a4d Mon Sep 17 00:00:00 2001 From: Javier Contreras <38429467+jav099@users.noreply.github.com> Date: Tue, 5 May 2026 09:45:38 -0700 Subject: [PATCH 006/127] [css-gaps-1] Clarify decoration pattern continuity across flex lines #13633 (#13887) * [css-gaps-1] Clarify decoration pattern continuity across flex lines Specify that gap decoration patterns do not restart at the beginning of each flex line, but are assigned sequentially across the flexbox. Closes w3c/csswg-drafts#13754 * [css-gaps-1] Add changes entry for flex line decoration continuity Document the clarification about decoration patterns not restarting at flex line boundaries. --------- Co-authored-by: Javier Contreras --- css-gaps-1/Overview.bs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/css-gaps-1/Overview.bs b/css-gaps-1/Overview.bs index c1d38db2fedd..1d6d64f5603e 100644 --- a/css-gaps-1/Overview.bs +++ b/css-gaps-1/Overview.bs @@ -2030,6 +2030,9 @@ Assigning gap decoration values to gaps is drawn there. This preserves a consistent association between gaps and decorations across fragmented and unfragmented contexts. + Similarly, when a [=flex container=] wraps into multiple flex lines, the decoration pattern is assigned to gaps sequentially across the flexbox + and does not restart at the beginning of each flex line. +
To assign gap decoration values to a list of |gaps| using a list of |values|: @@ -2572,6 +2575,8 @@ Changes since the 2 (Issue 13697)
  • Clarified that gaps suppressed due to fragmentation still consume gap decoration values. (Issue 13754) +
  • Clarified that decoration patterns do not restart at the beginning of each flex line. + (Issue 13663)

    From 60501e835289cd8e76462395608e5c2c869a06fb Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Tue, 5 May 2026 15:36:00 -0400 Subject: [PATCH 007/127] [css-navigation-1] Drop match-pattern/params/url from :link-to() and restructure. This change: * drops the match-pattern/match-params/match-url from :link-to(), leaving the match-params behavior as the only option, * moves the at/with/to/from relation from inside the match-* function to before the route, and * drops the navigation-* prefix from the at/with/to/from relation. This is in preparation for a future change which will split :link-to() into :link-to() and :active-navigation(). --- css-navigation-1/Overview.bs | 68 +++++++++++++----------------------- 1 file changed, 24 insertions(+), 44 deletions(-) diff --git a/css-navigation-1/Overview.bs b/css-navigation-1/Overview.bs index 479c46e3a6f2..d9a8e5ef7287 100644 --- a/css-navigation-1/Overview.bs +++ b/css-navigation-1/Overview.bs @@ -431,9 +431,8 @@ by matching the relevant parts of the navigation URL to the link URL. /* match URLs like /en/movie/123 which is the English page about a movie with ID 123. Be careful to specify the language part with a "*" but the ID part with a named - :id parameter so that matching using the 'match-params' - keyword (the default) will require equal IDs but allow - differences of language. */ + :id parameter so that matching will require equal IDs + but allow differences of language. */ pattern: url-pattern("/*/movie/:id"); } @@ -447,7 +446,7 @@ by matching the relevant parts of the navigation URL to the link URL. This depends on the --movie-details-with-id route declaring the ID but not the language with a named - parameter, and the use of match-params(navigation-with). + parameter, and the use of the 'with' keyword. This means that both the of the link and the other URL of the current navigation match the URL pattern defined by @@ -457,8 +456,7 @@ by matching the relevant parts of the navigation URL to the link URL. match, containing the language, can be different.) */ .movie-container:has( - > .movie-title:link-to(--movie-details-with-id - with match-params(navigation-with))) { + > .movie-title:link-to(with --movie-details-with-id)) { view-transition-name: movie-container; @@ -479,14 +477,9 @@ and the pseudo-class matches any element where: * the target of link matches the <>, as defined below.
    -<> = <> [ with <> ]?
    +<> = [ <> ]? <>
     <> = <>
    -  // Note: <> is defining three functions
    -  // with identical syntax.
    -<> = <>( <> )
    -<> = match-pattern | match-params | match-url
    -<> = navigation-at | navigation-with |
    -                            navigation-from | navigation-to
    +<> = at | with | from | to
     
    ISSUE: Should we use ''navigation-''(''at''/''with''/''from''/''to'') or @@ -526,49 +519,36 @@ if the following steps return true: NOTE: This doesn't really matter because in this case the <> also doesn't match. -1. Let matchType be the <> of the - <>. -1. Let matchTarget be the <> argument +1. Let matchRelation be the <> argument of the <>. 1. Let navigationURL be: - : If matchTarget is ''navigation-at'', + : If matchRelation is ''at'', :: the document's [[=Document/URL=]]. - : Otherwise, if matchTarget is ''navigation-with'', + : Otherwise, if matchRelation is ''with'', :: the current other URL of the document. - : Otherwise, if matchTarget is ''navigation-from'', + : Otherwise, if matchRelation is ''from'', :: the current from URL of the document. - : Otherwise (Assert: matchTarget is ''navigation-to''), + : Otherwise (Assert: matchRelation is ''to''), :: the current to URL of the document. 1. If navigationURL is null, return false. -1. : If matchType is ''match-pattern'' - :: Return true if - the result of [=URL pattern/match|match a URL pattern=] given - urlPattern and navigationURL is not null; - otherwise return false. +1. Let navigationMatchResult be the result of + [=URL pattern/match|match a URL pattern=] given + navigationURL and urlPattern. - : If matchType is ''match-params'' - :: 1. Let navigationMatchResult be the result of - [=URL pattern/match|match a URL pattern=] given - navigationURL and urlPattern. +1. If navigationMatchResult is null, return false. - 1. If either navigationMatchResult is null, return false. +1. For each property prop of {{URLPatternResult}} that is a + {{URLPatternComponentResult}}: - 1. For each property prop of {{URLPatternResult}} that is a - {{URLPatternComponentResult}}: + 1. If {{URLPatternComponentResult/groups}} of prop of + targetMatchResult is not equal to + {{URLPatternComponentResult/groups}} of prop of + navigationMatchResult, + then return false. - 1. If {{URLPatternComponentResult/groups}} of prop of - targetMatchResult is not equal to - {{URLPatternComponentResult/groups}} of prop of - navigationMatchResult, - then return false. + ISSUE: Need to formally define equality of ordered maps. - ISSUE: Need to formally define equality of ordered maps. - - 1. Return true. - - : If matchType is ''match-url'' - :: Return true if linkTarget equals navigationURL; - otherwise return false. +1. Return true. NOTE: Some of the design discussion for this feature has been in w3c/csswg-drafts#13163. From a6a1cd92f1c8f5b361bfb3d3670b4c17e013d279 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Tue, 5 May 2026 15:49:05 -0400 Subject: [PATCH 008/127] [css-navigation-1] Restrict at in both @navigation and :link-to() to navigations. This restricts matching of at: in both @navigation and :link-to() to when a navigation is currently active. This defines the term "current at URL" to help with that, and also renames the existing "current other URL" term to "current with URL" to keep internal and author-exposed terminology consistent. --- css-navigation-1/Overview.bs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/css-navigation-1/Overview.bs b/css-navigation-1/Overview.bs index d9a8e5ef7287..2e2c389df811 100644 --- a/css-navigation-1/Overview.bs +++ b/css-navigation-1/Overview.bs @@ -268,15 +268,16 @@ as follows: : <> :: : at: <> - :: The result is whether the result of + :: The result is true if + the [=current at URL=] at of the document is non-null and [=URL pattern/match|match a URL pattern=] is non-null given urlPattern as the [=navigation location URL pattern=] of <> - and input as the document's [=Document/URL=]. + and input as at. : with: <> :: The result is true if - the [=current other URL=] other of the document is non-null and + the [=current with URL=] other of the document is non-null and [=URL pattern/match|match a URL pattern=] is non-null when given urlPattern as the [=navigation location URL pattern=] of <> @@ -523,9 +524,9 @@ if the following steps return true: of the <>. 1. Let navigationURL be: : If matchRelation is ''at'', - :: the document's [[=Document/URL=]]. + :: the current at URL of the document. : Otherwise, if matchRelation is ''with'', - :: the current other URL of the document. + :: the current with URL of the document. : Otherwise, if matchRelation is ''from'', :: the current from URL of the document. : Otherwise (Assert: matchRelation is ''to''), @@ -556,8 +557,8 @@ NOTE: Some of the design discussion for this feature has been in

    Definitions of current navigation state

    Both the ''@navigation'' rule and the '':link-to()'' pseudo-class -rely on the following definitions of -the [=current other URL=], [=current from URL=], and [=current to URL=]. +rely on the following definitions of [=current at URL=] +the [=current with URL=], [=current from URL=], and [=current to URL=]. The current from URL of a [=/document=] is a URL or null. It is defined as follows: @@ -648,10 +649,17 @@ ISSUE: The above definitions of from and to apparently don't work right if you start a same-document navigation (e.g., with {{History/pushState}}) in the middle of a cross-document navigation. -The current other URL of a [=/document=] is a URL or null. +The current at URL of a [=/document=] is a URL or null. +It is defined as follows: + +1. ISSUE: Write this! (It should be null if there is no active navigation, + and the same as the document's [=Document/URL=] if there is.) + +The current with URL of a [=/document=] is a URL or null. It is defined as follows: -1. ISSUE: Write this! +1. ISSUE: Write this! (It should be like [=current to URL=] and [=current from URL=] + but always referring to the other Document in the navigation.) The current navigation type of a [=/document=] is a {{NavigationType}} or null. It is defined as follows: From a9f3a6f533a3ceece10a83dceb40953fbe37386e Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Thu, 9 Apr 2026 11:18:02 +0800 Subject: [PATCH 009/127] [css-viewport-1] Make actual viewport the layout viewport. Signed-off-by: Shubham Gupta --- css-viewport-1/Overview.bs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/css-viewport-1/Overview.bs b/css-viewport-1/Overview.bs index 0e6be678be53..013bd2874953 100644 --- a/css-viewport-1/Overview.bs +++ b/css-viewport-1/Overview.bs @@ -92,7 +92,7 @@ The page area can be set through ''@page'' rules. This specification introduces a way of overriding the size of the viewport provided by the user agent (UA). Because of this, we need to introduce the -difference between the [=initial viewport=] and the [=actual viewport=]. +difference between the [=initial viewport=] and the [=layout viewport=].
    initial viewport
    @@ -101,23 +101,23 @@ difference between the [=initial viewport=] and the [=actual viewport=]. overridden the viewport given by the window or viewing area of the UA. Note that the [=initial viewport=] size will change with the size of the window or viewing area.

  • -
    actual viewport
    +
    layout viewport
    This is the viewport you get after processing the viewport <meta> tag.
    -ISSUE: Make [=actual viewport=] the layout viewport, define visual viewport. +ISSUE: Define visual viewport. -When the [=actual viewport=] cannot fit inside the window or -viewing area, either because the [=actual viewport=] is +When the [=layout viewport=] cannot fit inside the window or +viewing area, either because the [=layout viewport=] is larger than the [=initial viewport=] or the zoom factor -causes only parts of the [=actual viewport=] to be visible, +causes only parts of the [=layout viewport=] to be visible, the UA should offer a scrolling or panning mechanism. It is recommended that initially the upper-left corners of the -[=actual viewport=] and the window or viewing area are aligned if the +[=layout viewport=] and the window or viewing area are aligned if the base direction of the document is ltr. Similarly, that the upper-right corners are aligned when the base direction is rtl. The base direction for a document is defined as the computed value of the 'direction' From d2e87713989b0c8a99714ac68616890d9f8c2cc2 Mon Sep 17 00:00:00 2001 From: Tab Atkins-Bittner Date: Wed, 6 May 2026 16:33:47 +0000 Subject: [PATCH 010/127] [css-images-4][css-images-5] Punt the non-color uses of image() to level 5, per WG resolution. --- css-images-4/Overview.bs | 179 ++----------------------------- css-images-5/Overview.bs | 221 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 229 insertions(+), 171 deletions(-) diff --git a/css-images-4/Overview.bs b/css-images-4/Overview.bs index 06c9dac4b30b..b5a087a1ca0e 100644 --- a/css-images-4/Overview.bs +++ b/css-images-4/Overview.bs @@ -379,140 +379,16 @@ Resolution/Type Negotiation: the ''image-set()'' notation {#image-set-notation} Image Fallbacks and Annotations: the ''image()'' notation {#image-notation} --------------------------------------------------------------------------- - The ''image()'' function allows an author to: - - * use media fragments to clip out a portion of an image - * use a solid color as an image - * fallback to a solid-color image, when the image at the specified url can't be downloaded or decoded - * automatically respect the image orientation specified in the image's metadata - - The ''image()'' notation is defined as: + The ''image()'' function allows an author + to easily generate a solid-color image from any color. + Its syntax is:
    -		image() = image( <>? [ <>? , <>? ]! )
    -		<image-tags> = [ ltr | rtl ]
    -		<image-src> = [ <> | <> ]
    +		image() = image( <> )
     	
    - A <> used in ''image()'' represents a <>. - As usual for URLs in CSS, - relative URLs are resolved to an absolute URL - (as described in Values & Units [[!CSS-VALUES-3]]) - when a specified ''image()'' value is computed. - - If the image has an orientation specified in its metadata, - such as EXIF, - the UA must rotate or flip the image to correctly orient it - as the metadata specifies. - -### Image Fallbacks ### {#image-fallbacks} - - If both a URL and a <> are specified in ''image()'', - then whenever the URL represents an [=invalid image=] or [=loading image=], - the ''image()'' function renders as if the URL were not specified at all; - it generates a solid-color image as specified in [[#color-images]]. - - If just a URL is specified (no <>) - and it represents an [=invalid image=] or [=loading image=], - the ''image()'' function represents the same. - - - css-image-fallbacks-and-annotations.html - css-image-fallbacks-and-annotations002.html - css-image-fallbacks-and-annotations003.html - css-image-fallbacks-and-annotations004.html - css-image-fallbacks-and-annotations005.html - - -
    - The fallback color can be used to ensure that text is still readable - even when the image fails to load. - For example, the following legacy code works fine if the image is rectangular and has no transparency: - -
    -			body      { color: black; background: white; }
    -			p.special { color: white; background: url("dark.png") black; }
    -		
    - - When the image doesn't load, - the background color is still there to ensure that the white text is readable. - However, if the image has some transparency, - the black will be visible behind it, - which is probably not desired. - The ''image()'' function addresses this: - -
    -			body      { color: black; background: white; }
    -			p.special { color: white; background: image("dark.png", black); }
    -		
    - - Now, the black won't show at all if the image loads, - but if for whatever reason the image fails, - it'll pop in and prevent the white text from being set against a white background. -
    - - - -### Image Fragments ### {#image-fragments} - - When a URL specified in ''image()'' represents a portion of a resource - (e.g. by the use of media fragment identifiers) - that portion is clipped out of its context and used as a standalone image. - -
    - For example, given the following image and CSS: - - - [9 circles, with 0 to 8 eighths filled in] - - -
    background-image: image('sprites.svg#xywh=40,0,20,20')
    - - ...the background of the element will be the portion of the image that starts at (40px,0px) and is 20px wide and tall, - which is just the circle with a quarter filled in. -
    - - So that authors can take advantage of CSS's forwards-compatible parsing rules to provide a fallback for image slices, - implementations that support the ''image()'' notation - must support the xywh=#,#,#,# form of media fragment identifiers - for images specified via ''image()''. [[!MEDIA-FRAGS]] - -
    - Note that image fragments can also be used with the ''url()'' notation. - However, a legacy UA that doesn't understand the media fragments notation - will ignore the fragment and simply display the entirety of the image. - - Since the ''image()'' notation requires UAs to support media fragments, - authors can take advantage of CSS's forward-compatible parsing rules - to provide a fallback when using an image fragment URL: - -
    -			background-image: url('swirl.png'); /* old UAs */
    -			background-image: image('sprites.png#xywh=10,30,60,20'); /* new UAs */
    -		
    -
    - - If a URL uses a fragment identifier syntax that the implementation does not understand, - or does not consider valid for that type of image, - the URL must be treated as representing an invalid image. - - Note: This error-handling is limited to ''image()'', - and not in the definition of URL, - for legacy compat reasons. - - -### Solid-color Images ### {#color-images} - - If the ''image()'' function is specified with only a <> argument (no URL), - it represents a solid-color image of the specified color with no [=natural dimensions=]. + The ''image()'' function represents a solid-color image of the specified color + with no [=natural dimensions=].
    For example, @@ -525,47 +401,8 @@ Image Fallbacks and Annotations: the ''image()'' notation {#image-notation} as the solid color it generates always lies beneath all the background images.
    - -### Bidi-sensitive Images ### {#bidi-images} - - Before listing any <image-src>s, - the author may specify a directionality for the image, - similar to adding a dir attribute to an element in HTML. - If a directional image is used on or in an element with opposite direction, - the image must be flipped in the inline direction - (as if it was transformed by, e.g., scaleX(-1), if the inline direction is the X axis). - - Note: Absent this declaration, - images default to no directionality at all, - and thus don't care about the directionality of the surrounding element. - -
    - A list may use an arrow for a bullet that points into the content. - If the list can contain both LTR and RTL text, - though, the bullet may be on the left or the right, - and an image designed to point into the text on one side will point out of the text on the other side. - This can be fixed with code like: - -
    -			<ul style="list-style-image: image(ltr 'arrow.png');">
    -				<li dir='ltr'>My bullet is on the left!</li>
    -				<li dir='rtl'>MY BULLET IS ON THE RIGHT!</li>
    -			</ul>
    -		
    - - This should render something like: - -
    -			⇒ My bullet is on the left!
    -			  !THGIR EHT NO SI TELLUB YM ⇐
    -		
    - - In LTR list items, the image will be used as-is. - In the RTL list items, however, - it will be flipped in the inline direction, - so it still points into the content. -
    - + Note: This function previously defined a number of additional behaviors, + but those have been shifted to [[css-images-5]]. + +2D Image Values: the <> type {#image-values} +=================================================== + + ... + + + + +Image Fallbacks and Annotations: the ''image()'' notation {#image-notation} +--------------------------------------------------------------------------- + + [[css-images-4]] defines a simple form of the ''image()'' function, + which generates a solid-color dimensionless image. + This level introduces a number of additional functions. + + The ''image()'' function allows an author to: + + * use media fragments to clip out a portion of an image + * use a solid color as an image + * fallback to a solid-color image, when the image at the specified url can't be downloaded or decoded + * automatically respect the image orientation specified in the image's metadata + + The ''image()'' notation is defined as: + +
    +		image() = image( <>? [ <>? , <>? ]! )
    +		<image-tags> = [ ltr | rtl ]
    +		<image-src> = [ <> | <> ]
    +	
    + + A <> used in ''image()'' represents a <>. + As usual for URLs in CSS, + relative URLs are resolved to an absolute URL + (as described in Values & Units [[!CSS-VALUES-3]]) + when a specified ''image()'' value is computed. + + If the image has an orientation specified in its metadata, + such as EXIF, + the UA must rotate or flip the image to correctly orient it + as the metadata specifies. + +### Image Fallbacks ### {#image-fallbacks} + + If both a URL and a <> are specified in ''image()'', + then whenever the URL represents an [=invalid image=] or [=loading image=], + the ''image()'' function renders as if the URL were not specified at all; + it generates a solid-color image as specified in [[#color-images]]. + + If just a URL is specified (no <>) + and it represents an [=invalid image=] or [=loading image=], + the ''image()'' function represents the same. + + + css-image-fallbacks-and-annotations.html + css-image-fallbacks-and-annotations002.html + css-image-fallbacks-and-annotations003.html + css-image-fallbacks-and-annotations004.html + css-image-fallbacks-and-annotations005.html + + +
    + The fallback color can be used to ensure that text is still readable + even when the image fails to load. + For example, the following legacy code works fine if the image is rectangular and has no transparency: + +
    +			body      { color: black; background: white; }
    +			p.special { color: white; background: url("dark.png") black; }
    +		
    + + When the image doesn't load, + the background color is still there to ensure that the white text is readable. + However, if the image has some transparency, + the black will be visible behind it, + which is probably not desired. + The ''image()'' function addresses this: + +
    +			body      { color: black; background: white; }
    +			p.special { color: white; background: image("dark.png", black); }
    +		
    + + Now, the black won't show at all if the image loads, + but if for whatever reason the image fails, + it'll pop in and prevent the white text from being set against a white background. +
    + + + +### Image Fragments ### {#image-fragments} + + When a URL specified in ''image()'' represents a portion of a resource + (e.g. by the use of media fragment identifiers) + that portion is clipped out of its context and used as a standalone image. + +
    + For example, given the following image and CSS: + + + [9 circles, with 0 to 8 eighths filled in] + + +
    background-image: image('sprites.svg#xywh=40,0,20,20')
    + + ...the background of the element will be the portion of the image that starts at (40px,0px) and is 20px wide and tall, + which is just the circle with a quarter filled in. +
    + + So that authors can take advantage of CSS's forwards-compatible parsing rules to provide a fallback for image slices, + implementations that support the ''image()'' notation + must support the xywh=#,#,#,# form of media fragment identifiers + for images specified via ''image()''. [[!MEDIA-FRAGS]] + +
    + Note that image fragments can also be used with the ''url()'' notation. + However, a legacy UA that doesn't understand the media fragments notation + will ignore the fragment and simply display the entirety of the image. + + Since the ''image()'' notation requires UAs to support media fragments, + authors can take advantage of CSS's forward-compatible parsing rules + to provide a fallback when using an image fragment URL: + +
    +			background-image: url('swirl.png'); /* old UAs */
    +			background-image: image('sprites.png#xywh=10,30,60,20'); /* new UAs */
    +		
    +
    + + If a URL uses a fragment identifier syntax that the implementation does not understand, + or does not consider valid for that type of image, + the URL must be treated as representing an invalid image. + + Note: This error-handling is limited to ''image()'', + and not in the definition of URL, + for legacy compat reasons. + + +### Solid-color Images ### {#color-images} + + If the ''image()'' function is specified with only a <> argument (no URL), + it represents a solid-color image of the specified color with no [=natural dimensions=]. + +
    + For example, + one can use this as a simple way to "tint" a background image, + by overlaying a partially-transparent color over the top of the other image: + +
    background-image: image(rgba(0,0,255,.5)), url("bg-image.png");
    + + 'background-color' does not work for this, + as the solid color it generates always lies beneath all the background images. +
    + + +### Bidi-sensitive Images ### {#bidi-images} + + Before listing any <image-src>s, + the author may specify a directionality for the image, + similar to adding a dir attribute to an element in HTML. + If a directional image is used on or in an element with opposite direction, + the image must be flipped in the inline direction + (as if it was transformed by, e.g., scaleX(-1), if the inline direction is the X axis). + + Note: Absent this declaration, + images default to no directionality at all, + and thus don't care about the directionality of the surrounding element. + +
    + A list may use an arrow for a bullet that points into the content. + If the list can contain both LTR and RTL text, + though, the bullet may be on the left or the right, + and an image designed to point into the text on one side will point out of the text on the other side. + This can be fixed with code like: + +
    +			<ul style="list-style-image: image(ltr 'arrow.png');">
    +				<li dir='ltr'>My bullet is on the left!</li>
    +				<li dir='rtl'>MY BULLET IS ON THE RIGHT!</li>
    +			</ul>
    +		
    + + This should render something like: + +
    +			⇒ My bullet is on the left!
    +			  !THGIR EHT NO SI TELLUB YM ⇐
    +		
    + + In LTR list items, the image will be used as-is. + In the RTL list items, however, + it will be flipped in the inline direction, + so it still points into the content. +
    + + Sizing Images and Objects in CSS {#sizing} ========================================== From 30639060d74550c01766036a5ff55c81bf250394 Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 3 Apr 2026 14:47:47 -0700 Subject: [PATCH 011/127] [css-anchor-position-1] Depluralize anchors-* in 'position-visibility' and only check default anchor #10201 --- css-anchor-position-1/Overview.bs | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/css-anchor-position-1/Overview.bs b/css-anchor-position-1/Overview.bs index cee9b4434598..acf054d8ed92 100644 --- a/css-anchor-position-1/Overview.bs +++ b/css-anchor-position-1/Overview.bs @@ -2219,8 +2219,8 @@ Conditional Hiding: the 'position-visibility' property {#position-visibility}
     Name: position-visibility
    -Value: always | [ anchors-valid || anchors-visible || no-overflow ]
    -Initial: anchors-visible
    +Value: always | [ anchor-valid || anchor-visible || no-overflow ]
    +Initial: anchor-visible
     Applies to: [=absolutely positioned boxes=]
     Percentages: n/a
     Inherited: no
    @@ -2239,23 +2239,14 @@ depending on some commonly needed layout conditions.
     		(The box is displayed without regard for its anchors
     		or its overflowing status.)
     
    -	: anchors-valid
    +	: anchor-valid
     	::
    -		If any of the box's [=required anchor references=]
    -		do not resolve to a [=target anchor element=],
    +		If the box references the [=default anchor box=]
    +		(e.g. using 'position-area', 'anchor()' or 'anchor-size()' functions, or ''anchor-center''),
    +		but the [=default anchor box=] cannot be resolved,
     		the box's 'visibility' property computes to ''force-hidden''.
     
    -		Issue: What is a required anchor reference?
    -		''anchor()'' functions that don't have a fallback value;
    -		the default anchor *sometimes*?
    -		Need more detail here.
    -
    -		Issue: Any anchors are missing,
    -		or all anchors are missing?
    -		I can see use-cases for either, potentially.
    -		Do we want to make a decision here, or make it controllable somehow?
    -
    -	: anchors-visible
    +	: anchor-visible
     	::
     		If the box has a [=default anchor box=]
     		but that [=anchor box=] is [=invisible=] or [=clipped by intervening boxes=],
    @@ -2704,6 +2695,14 @@ No Privacy issues have been raised against this document.
     Changes {#changes}
     =======
     
    +Significant changes since the 27 March 2026 Working Draft:
    +* Defined ''position-visibility/anchor-valid'' to (like ''position-visibility/anchor-valid'') only check the [=default anchor box=].
    +	(Issue 10201)
    +* Renamed anchors-valid and anchors-visible
    +	to ''position-visibility/anchor-valid'' and ''position-visibility/anchor-visible''
    +	since they only reference the [=default anchor box=].
    +	(Issue 10201)
    +
     Significant changes since the 30 January 2026 Working Draft:
     * Added ''position-area/match-parent'' value to 'position-area'.
     	(Issue 8913)
    
    From 6dc702af0012f476a5604d65d78807b8b9065b74 Mon Sep 17 00:00:00 2001
    From: Sam Weinig 
    Date: Wed, 6 May 2026 08:42:06 -0700
    Subject: [PATCH 012/127] =?UTF-8?q?Updates=20'flow-tolerance'=20grammar=20?=
     =?UTF-8?q?to=20use=20``=20rather=20tha?=
     =?UTF-8?q?n=20``?=
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    
    ---
     css-grid-3/Overview.bs | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/css-grid-3/Overview.bs b/css-grid-3/Overview.bs
    index f0631b04f340..300a50be4d3a 100644
    --- a/css-grid-3/Overview.bs
    +++ b/css-grid-3/Overview.bs
    @@ -789,7 +789,7 @@ Placement Precision: the 'flow-tolerance' property
     
     	
     	Name: flow-tolerance
    -	Value: normal | <> | infinite
    +	Value: normal | <> | infinite
     	Initial: normal
     	Percentages: relative to the [=grid-axis=] [=content box=] size of the [=grid lanes container=]
     	Inherited: no
    
    From d9f3d0f3bee5c636bc5598b66f02c11cd8bcb654 Mon Sep 17 00:00:00 2001
    From: "L. David Baron" 
    Date: Wed, 6 May 2026 15:27:27 -0400
    Subject: [PATCH 013/127] [css-navigation-1] Split :active-navigation() from
     :link-to().
    
    This separates the more complex feature in the :link-to() pseudo-class
    into a separate :active-navigation() pseudo-class.
    ---
     css-navigation-1/Overview.bs | 165 +++++++++++++++++------------------
     1 file changed, 80 insertions(+), 85 deletions(-)
    
    diff --git a/css-navigation-1/Overview.bs b/css-navigation-1/Overview.bs
    index 2e2c389df811..385554205deb 100644
    --- a/css-navigation-1/Overview.bs
    +++ b/css-navigation-1/Overview.bs
    @@ -40,7 +40,7 @@ url: https://drafts.csswg.org/css-view-transitions-1/#capture-the-image
     The @route rule
     is an at-rule that associates a name with a [=URL pattern=].
     This name can be referenced in ''@navigation'' rules
    -and in '':link-to()'' pseudo-classes.
    +and in '':active-navigation()'' pseudo-classes.
     
     The syntax of the ''@route'' rule is:
     
    @@ -270,34 +270,22 @@ as follows:
     ::    : at: <>
         :: The result is true if
             the [=current at URL=] at of the document is non-null and
    -        [=URL pattern/match|match a URL pattern=] is non-null
    -        given urlPattern as
    -        the [=navigation location URL pattern=] of <>
    -        and input as at.
    +        the <> [=navigation-location/matches=] at.
     
         : with: <>
         :: The result is true if
             the [=current with URL=] other of the document is non-null and
    -        [=URL pattern/match|match a URL pattern=] is non-null when
    -        given urlPattern as
    -        the [=navigation location URL pattern=] of <>
    -        and input as other.
    +        the <> [=navigation-location/matches=] other.
     
         : from: <>
         :: The result is true if
             the [=current from URL=] from of the document is non-null and
    -        [=URL pattern/match|match a URL pattern=] is non-null when
    -        given urlPattern as
    -        the [=navigation location URL pattern=] of <>
    -        and input as from.
    +        the <> [=navigation-location/matches=] from.
     
         : to: <>
         :: The result is true if
             the [=current to URL=] to of the document is non-null and
    -        [=URL pattern/match|match a URL pattern=] is non-null when
    -        given urlPattern as
    -        the [=navigation location URL pattern=] of <>
    -        and input as to.
    +        the <> [=navigation-location/matches=] to.
     
     : <>
     ::    : between: <> and <>
    @@ -349,6 +337,13 @@ See the
     route matching explainer
     for details.
     
    +A <> is defined to
    +match a URL input if
    +[=URL pattern/match|match a URL pattern=] is non-null given
    +urlPattern as the [=navigation location URL pattern=] of the
    +<> and
    +input as input.
    +
     A document's navigation API is
     the result of the following steps on document:
     
    @@ -390,7 +385,9 @@ ISSUE: This should probably have a more formal definition of the function,
     but I can't find the formal definitions of the existing ''if()'' functions
     to model it after.
     
    -
    +
    +
    +
     
     This specification defines a new
     '':link-to()'' functional pseudo-class
    @@ -409,9 +406,22 @@ which matches any links that link to the site's homepage:
     
     
     
    +The '':link-to()'' pseudo-class takes a single argument, a <>,
    +and the pseudo-class matches any element where both:
    +* the element matches '':any-link''
    +* the <> [=navigation-location/matches=] the target of the link
    +
    +

    The ''::active-navigation()'' pseudo-class

    + +This specification defines a new +'':active-navigation()'' +functional pseudo-class +that matches link elements that link to a certain URL +that is related to a navigation that is currently active. +
    -A more interesting example of the '':link-to()'' pseudo-class +A an example of the '':active-navigation()'' pseudo-class is this example which creates a view transition between a item in a list that contains a link (in this document) and the details page for that link (in a different document). @@ -457,7 +467,7 @@ by matching the relevant parts of the navigation URL to the link URL. match, containing the language, can be different.) */ .movie-container:has( - > .movie-title:link-to(with --movie-details-with-id)) { + > .movie-title:active-navigation(with --movie-details-with-id)) { view-transition-name: movie-container; @@ -472,84 +482,69 @@ by matching the relevant parts of the navigation URL to the link URL.
    -The '':link-to()'' pseudo-class takes a single argument, a <>, +The '':active-navigation()'' pseudo-class takes a single argument, a <>, and the pseudo-class matches any element where: * the element matches '':any-link'' -* the target of link matches the <>, as defined below. +* the target of the link matches the <>, as defined below.
    -<> = [ <> ]? <>
    -<> = <>
    +<> =
    +  <>? [ <> | link-href ] ?
     <> = at | with | from | to
     
    -ISSUE: Should we use ''navigation-''(''at''/''with''/''from''/''to'') or -''navigation-''(''current''/''other''/''from''/''to'')? - -ISSUE: Should the '':link-to()'' variant that has a <> have a different name, -such as '':navigating-link()''? - -A <> matches the target of the link when both: -* the <> matches the target of the link, and -* either: - * a <> is not present, or - * the <> matches the target of the link, - with the [=URL pattern=] represented by the <> as context - -A <> represents a [=URL pattern=]. -If the <> is a <>, -then it represents the URL pattern -represented by the <> function -(see [=create a URL pattern for url-pattern()=]). -If it is a <>, then it represents the URL pattern -represented by the ''@route'' rule. - -A <> matches a URL -when [=URL pattern/match|match a URL pattern=] is non-null -given urlPattern as -the [=URL pattern=] that it represents and -input as the given URL. - -A <> matches the URL linkTarget -(with a URL Pattern urlPattern as context) -if the following steps return true: -1. Let targetMatchResult be the result of - [=URL pattern/match|match a URL pattern=] - given urlPattern and linkTarget. -1. If targetMatchResult is null, return false. - - NOTE: This doesn't really matter because - in this case the <> also doesn't match. -1. Let matchRelation be the <> argument - of the <>. -1. Let navigationURL be: - : If matchRelation is ''at'', - :: the current at URL of the document. - : Otherwise, if matchRelation is ''with'', - :: the current with URL of the document. - : Otherwise, if matchRelation is ''from'', - :: the current from URL of the document. - : Otherwise (Assert: matchRelation is ''to''), - :: the current to URL of the document. +NOTE: The ''link-href'' keyword is an explicit way to represent the default, +but there is no difference between specifying it explicitly or omitting it. + +ISSUE: Should we use ''at''/''with''/''from''/''to'' or +''current''/''other''/''from''/''to''? + +The active navigation URL for an <> is: +
    +
    If the <> is ''at'' +
    The [=current at URL=] of the document +
    If the <> is ''with'' or is omitted +
    The [=current with URL=] of the document +
    If the <> is ''from'' +
    The [=current from URL=] of the document +
    If the <> is ''to'' +
    The [=current to URL=] of the document +
    + +An <> matches the target linkTarget of the link when +the following steps return true: +1. Let navigationURL be + the [=active navigation URL=] of the <> 1. If navigationURL is null, return false. -1. Let navigationMatchResult be the result of - [=URL pattern/match|match a URL pattern=] given - navigationURL and urlPattern. +1. If a <> is present: + 1. Let targetMatchResult be the result of + [=URL pattern/match|match a URL pattern=] + given urlPattern and linkTarget. + + 1. Let navigationMatchResult be the result of + [=URL pattern/match|match a URL pattern=] given + urlPattern and navigationURL. + + 1. If navigationMatchResult or targetMatchResult is null, return false. + + 1. For each property prop of {{URLPatternResult}} that is a + {{URLPatternComponentResult}}: + + 1. If {{URLPatternComponentResult/groups}} of prop of + targetMatchResult is not equal to + {{URLPatternComponentResult/groups}} of prop of + navigationMatchResult, + then return false. -1. If navigationMatchResult is null, return false. + ISSUE: Need to formally define equality of ordered maps. -1. For each property prop of {{URLPatternResult}} that is a - {{URLPatternComponentResult}}: + 1. Return true. - 1. If {{URLPatternComponentResult/groups}} of prop of - targetMatchResult is not equal to - {{URLPatternComponentResult/groups}} of prop of - navigationMatchResult, - then return false. +1. Otherwise: - ISSUE: Need to formally define equality of ordered maps. + 1. Return true if linkTarget [=url/equals=] navigationURL. -1. Return true. + 1. Return false. NOTE: Some of the design discussion for this feature has been in w3c/csswg-drafts#13163. From 3dfb0d96cd4cb4d96297de3b76050f2dd53760f9 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Wed, 6 May 2026 15:31:25 -0400 Subject: [PATCH 014/127] [css-navigation-1][editorial] Fix typo in function name. --- css-navigation-1/Overview.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css-navigation-1/Overview.bs b/css-navigation-1/Overview.bs index 385554205deb..85ae0f5554e5 100644 --- a/css-navigation-1/Overview.bs +++ b/css-navigation-1/Overview.bs @@ -94,7 +94,7 @@ or password since they seem unlikely to be useful.
    It's possible that this syntax with init descriptors in the ''@route'' rule -would make more sense as part of the ''urlpattern()'' function +would make more sense as part of the ''url-pattern()'' function (that is, as an alternate syntax for what goes inside the function). This would also give us the option to remove the braces from From 93636fb10801b8f5cde69a269ed0f00265c20df8 Mon Sep 17 00:00:00 2001 From: Alexander Kyereboah <59938429+kyerebo@users.noreply.github.com> Date: Wed, 6 May 2026 14:57:03 -0700 Subject: [PATCH 015/127] [css-ui-4] add the `window-drag` text (#13801) * Adds the draggable CSS property - adds `window-drag` to css-ui-4 * Adds window-drag - changes the computed value - updates line width styling * Updates css-ui-4 with `window-drag` Updates the spec text with the naming resolution by the CSSWG. https://github.com/w3c/csswg-drafts/issues/13102 * Adding note about `app-region` alias * Clarifying web event dispatch behavior and initial value * Simplifying `window-drag` description * Clarifying element's draggable target * Minor tweaks Co-authored-by: Tab Atkins Jr. --------- Co-authored-by: diekus <73939538+diekus@users.noreply.github.com> Co-authored-by: Alexander Kyereboah Co-authored-by: Tab Atkins Jr. --- css-ui-4/Overview.bs | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/css-ui-4/Overview.bs b/css-ui-4/Overview.bs index db28eb8544a0..81788b6b2fca 100644 --- a/css-ui-4/Overview.bs +++ b/css-ui-4/Overview.bs @@ -4153,6 +4153,59 @@ Single-Line Text Input Controls * The content does not wrap * The 'text-overflow' property applies regardless of the value of the 'overflow' property +

    +Window Interaction

    + +

    +Moving the window: the 'window-drag' property

    + +
    +	Name: window-drag
    +	Value: none | move
    +	Initial: none
    +	Applies to: all elements
    +	Inherited: yes
    +	Percentages: N/A
    +	Computed value: as specified
    +	Canonical order: per grammar
    +	Animation type: discrete
    +	
    + + + + + An installed application's window typically has a designated area where it can be dragged to move the window. + This area is generally at the top of the window + (usually part of the titlebar, toolbar, or both), + outside of the region that the page is actually rendered in. + For installed web apps, + APIs or capabilities like [[WINDOW-CONTROLS-OVERLAY]] + can alter and remove the surfaces where users can move a window. + The 'window-drag' property allows the author to specify an area within the page + where a user can drag to move the window. + Values have the following meanings: + +
    +
    none +
    + Specifies that the element cannot be used as a drag area. + +
    move +
    + Specifies that the element's [=principal box=] can be used as a [=window drag area=]. +
    + + Note: Some UAs may support app-region as a [=legacy shorthand=] for 'window-drag'. + + When a [=box=] is a window drag area, + a drag gesture on that element initiates a window move operation + instead of normal web event processing. + The UA must not fire pointer events, mouse events, or drag events + on the element for the duration of the window move gesture. + + Note: This means the [[HTML]] <{html-global/draggable}> attribute + has no effect on elements with ''window-drag: move''; + the window move behavior takes precedence.
    From 9b703d736aef856df380632d8edb5fa19716cc92 Mon Sep 17 00:00:00 2001 From: Tab Atkins-Bittner Date: Wed, 6 May 2026 23:05:12 +0000 Subject: [PATCH 016/127] [css-values-4] Clarify/fix round(line-width) text. #13794 --- css-values-4/Overview.bs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/css-values-4/Overview.bs b/css-values-4/Overview.bs index 8c122f39528c..1eb0c4b037b3 100644 --- a/css-values-4/Overview.bs +++ b/css-values-4/Overview.bs @@ -3347,11 +3347,15 @@ Stepped Value Functions: ''round()'', ''mod()'', and ''rem()'' :: If A is non-negative and B is omitted, A is [=snapped as a border width=]. - Otherwise, identical to ''/nearest'', - except that if A is positive (non-zero) - and one of |lower B| or |upper B| is zero, - choose the non-zero one, - then [=snap as a border width=]. + Otherwise, if A is non-negative and B is specified, + identical to ''/nearest'', + except that if one of |lower B| or |upper B| is zero, + always choose the non-zero one. + Then [=snap as a border width=]. + + Otherwise (A is negative), + identical to ''/nearest''. + (No snapping occurs.) If |lower B| would be zero, From 90a89f12fa55ae193360e180e16d079a6221a9a0 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Thu, 7 May 2026 01:57:23 +0200 Subject: [PATCH 017/127] [css-shapes][editorial] Define production rule for `` (#9727) --- css-shapes-1/Overview.bs | 7 ++++++- css-shapes-2/Overview.bs | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/css-shapes-1/Overview.bs b/css-shapes-1/Overview.bs index f7764d0735a8..163ebef8ad7b 100644 --- a/css-shapes-1/Overview.bs +++ b/css-shapes-1/Overview.bs @@ -329,6 +329,11 @@ Basic Shapes The <basic-shape> type can be specified using basic shape functions. + +
    +		<> = <> | <> | <> |  <> | <>
    +	
    + When using this syntax to define shapes, the reference box is defined @@ -460,7 +465,7 @@ Supported Shapes shape-functions/xywh-function-valid.html -
    rect() = +
    rect()
    Defines a rectangle via insets from the top and left edges of the [=reference box=]. diff --git a/css-shapes-2/Overview.bs b/css-shapes-2/Overview.bs index 8fa209b74d03..90d54b081257 100644 --- a/css-shapes-2/Overview.bs +++ b/css-shapes-2/Overview.bs @@ -125,6 +125,13 @@ Basic Shapes level 1 section. + This level extends the <> functions + to include ''shape()'': + +
    +		<> = <> | <> | <> |  <> | <> | <>
    +	
    +

    Supported Shapes

    From efc0c6f847f6e2e2faad646a4387f37ee6d4e747 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Thu, 7 May 2026 02:30:26 +0200 Subject: [PATCH 018/127] [css-conditional-5] Define the block contents of `@container` with `` (#9215) --- css-conditional-5/Overview.bs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/css-conditional-5/Overview.bs b/css-conditional-5/Overview.bs index edcca5615ac8..44e184c0e084 100644 --- a/css-conditional-5/Overview.bs +++ b/css-conditional-5/Overview.bs @@ -467,7 +467,7 @@ Container Queries There are cases where the box for a [=pseudo-element=] is generated as a sibling box of its originating element's box. If we allowed querying the size of a sibling box, it would introduce layout cycles. - + For example, the ''::scroll-marker-group'' and ''::scroll-button()'' pseudo-elements generate sibling boxes of their originating element's box. These pseudo-elements will not be able to query their originating scroller @@ -1027,7 +1027,7 @@ Container Queries: the ''@container'' rule is a [=conditional group rule=] whose condition contains a container query, which is a boolean combination of [=container size queries=] and/or [=container style queries=]. - Style declarations within the <> block of an ''@container'' rule + Style declarations within the ''@container'' rule are [[css-cascade-4#filtering|filtered]] by its condition to only match when the [=container query=] is true for their element’s [=query container=]. @@ -1036,7 +1036,7 @@ Container Queries: the ''@container'' rule
     	@container <># {
    -	  <>
    +	  <>
     	}
     	
    From 1d58ee610bac3fe0416329870376a33629aac3a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Daoust?= Date: Thu, 7 May 2026 15:13:28 +0200 Subject: [PATCH 019/127] [css-navigation-1] Fix syntax of `` (#13895) The Value Definition Syntax does not allow spaces before the `?` multiplier. --- css-navigation-1/Overview.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css-navigation-1/Overview.bs b/css-navigation-1/Overview.bs index 85ae0f5554e5..97da87d57d4e 100644 --- a/css-navigation-1/Overview.bs +++ b/css-navigation-1/Overview.bs @@ -489,7 +489,7 @@ and the pseudo-class matches any element where:
     <> =
    -  <>? [ <> | link-href ] ?
    +  <>? [ <> | link-href ]?
     <> = at | with | from | to
     
    From 6dcd08f1bb13329d71146350bda5c0e24f54fa76 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 7 May 2026 09:40:20 -0400 Subject: [PATCH 020/127] [css-navigation-1] Also allow <> in <>. --- css-navigation-1/Overview.bs | 49 +++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/css-navigation-1/Overview.bs b/css-navigation-1/Overview.bs index 97da87d57d4e..e2cb2c2a99b1 100644 --- a/css-navigation-1/Overview.bs +++ b/css-navigation-1/Overview.bs @@ -224,7 +224,7 @@ with <> defined as: <> = <> : <> <> = at | with | from | to -<> = <> | <> +<> = <> | <> | <> <> = <> <> = @@ -292,14 +292,10 @@ as follows: :: The result is true if the [=current from URL=] from of the document is non-null, the [=current to URL=] to of the document is non-null, - [=URL pattern/match|match a URL pattern=] is non-null - given urlPattern as - the [=navigation location URL pattern=] of one of the two <>s - and input as from, and - [=URL pattern/match|match a URL pattern=] is non-null - given urlPattern as - the [=navigation location URL pattern=] of the other of the two <>s - and input as to. + one of the two <>s + [=navigation-location/matches=] from, + and the other of the two <>s + [=navigation-location/matches=] to. : <> :: : history: traverse @@ -321,15 +317,28 @@ as follows: It exists only for future-compatibility, so that new syntax additions do not invalidate too much of a <> in older user agents. -The navigation location URL pattern of a <> -depends on the type of <>: +A <> is defined to +match a URL input if: + +
    + +: the <> is a <> +:: [=URL pattern/match|match a URL pattern=] is non-null given + urlPattern as + the [=URL pattern=] represented by the ''@route'' rule referenced by the name and + input as input. -: <> -:: the URL pattern represented by the ''@route'' rule referenced by the name. +: the <> is a <> +:: [=URL pattern/match|match a URL pattern=] is non-null given + urlPattern as + the [=URL pattern=] represented by the function (see + [=create a URL pattern for url-pattern()=]) and + input as input. -: <> -:: The [=URL pattern=] represented by the function; see - [=create a URL pattern for url-pattern()=]. +: the <> is a <> +:: The given URL [=url/equals=] input. + +
    ISSUE: Should it also be possible to reference a name defined in a routemap? @@ -337,12 +346,6 @@ See the route matching explainer for details. -A <> is defined to -match a URL input if -[=URL pattern/match|match a URL pattern=] is non-null given -urlPattern as the [=navigation location URL pattern=] of the -<> and -input as input. A document's navigation API is the result of the following steps on document: @@ -500,7 +503,7 @@ ISSUE: Should we use ''at''/''with''/''from''/''to'' or ''current''/''other''/''from''/''to''? The active navigation URL for an <> is: -
    +
    If the <> is ''at''
    The [=current at URL=] of the document
    If the <> is ''with'' or is omitted From 7f796f78d189195919a7cf861d7adffebcb80b61 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 7 May 2026 09:47:38 -0400 Subject: [PATCH 021/127] Pull <> into its own section and rename to <>. This type is common to multiple features in this spec and thus probably belongs in its own section rather than in the section of one of the features that uses it. --- css-navigation-1/Overview.bs | 110 ++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 52 deletions(-) diff --git a/css-navigation-1/Overview.bs b/css-navigation-1/Overview.bs index e2cb2c2a99b1..1c50fd0e7e7e 100644 --- a/css-navigation-1/Overview.bs +++ b/css-navigation-1/Overview.bs @@ -35,7 +35,9 @@ url: https://drafts.csswg.org/css-view-transitions-1/#capture-the-image type: dfn; spec: css-view-transitions-1; text: capture the image;
    -

    Declaring named URL patterns: the ''@route'' rule

    +

    Defining URL patterns in CSS

    + +

    Declaring named URL patterns: the ''@route'' rule

    The @route rule is an at-rule that associates a name with a [=URL pattern=]. @@ -127,6 +129,42 @@ NOTE: The bracing syntax also allows for future expansion if needed. NOTE: Some of the design discussion for this feature has been in w3c/csswg-drafts#12594. +

    The <> value type

    + +
    +<> = <> | <> | <>
    +<> = <>
    +
    + +A <> is defined to +match a URL input if: + +
    + +: the <> is a <> +:: [=URL pattern/match|match a URL pattern=] is non-null given + urlPattern as + the [=URL pattern=] represented by the ''@route'' rule referenced by the name and + input as input. + +: the <> is a <> +:: [=URL pattern/match|match a URL pattern=] is non-null given + urlPattern as + the [=URL pattern=] represented by the function (see + [=create a URL pattern for url-pattern()=]) and + input as input. + +: the <> is a <> +:: The given URL [=url/equals=] input. + +
    + +ISSUE: Should it also be possible to reference +a name defined in a routemap? +See the +route matching explainer +for details. +

    Conditional rules for navigation queries

    Navigation queries: the ''@navigation'' rule

    @@ -222,13 +260,11 @@ with <> defined as: <> | <> -<> = <> : <> +<> = <> : <> <> = at | with | from | to -<> = <> | <> | <> -<> = <> <> = - between : <> and <> + between : <> and <> <> = history : <> <> = traverse | back | forward | reload @@ -267,35 +303,35 @@ as follows: :: The result is the result of the child subexpression. : <> -:: : at: <> +:: : at: <> :: The result is true if the [=current at URL=] at of the document is non-null and - the <> [=navigation-location/matches=] at. + the <> [=route-location/matches=] at. - : with: <> + : with: <> :: The result is true if the [=current with URL=] other of the document is non-null and - the <> [=navigation-location/matches=] other. + the <> [=route-location/matches=] other. - : from: <> + : from: <> :: The result is true if the [=current from URL=] from of the document is non-null and - the <> [=navigation-location/matches=] from. + the <> [=route-location/matches=] from. - : to: <> + : to: <> :: The result is true if the [=current to URL=] to of the document is non-null and - the <> [=navigation-location/matches=] to. + the <> [=route-location/matches=] to. : <> -:: : between: <> and <> +:: : between: <> and <> :: The result is true if the [=current from URL=] from of the document is non-null, the [=current to URL=] to of the document is non-null, - one of the two <>s - [=navigation-location/matches=] from, - and the other of the two <>s - [=navigation-location/matches=] to. + one of the two <>s + [=route-location/matches=] from, + and the other of the two <>s + [=route-location/matches=] to. : <> :: : history: traverse @@ -317,36 +353,6 @@ as follows: It exists only for future-compatibility, so that new syntax additions do not invalidate too much of a <> in older user agents. -A <> is defined to -match a URL input if: - -
    - -: the <> is a <> -:: [=URL pattern/match|match a URL pattern=] is non-null given - urlPattern as - the [=URL pattern=] represented by the ''@route'' rule referenced by the name and - input as input. - -: the <> is a <> -:: [=URL pattern/match|match a URL pattern=] is non-null given - urlPattern as - the [=URL pattern=] represented by the function (see - [=create a URL pattern for url-pattern()=]) and - input as input. - -: the <> is a <> -:: The given URL [=url/equals=] input. - -
    - -ISSUE: Should it also be possible to reference -a name defined in a routemap? -See the -route matching explainer -for details. - - A document's navigation API is the result of the following steps on document: @@ -409,10 +415,10 @@ which matches any links that link to the site's homepage: -The '':link-to()'' pseudo-class takes a single argument, a <>, +The '':link-to()'' pseudo-class takes a single argument, a <>, and the pseudo-class matches any element where both: * the element matches '':any-link'' -* the <> [=navigation-location/matches=] the target of the link +* the <> [=route-location/matches=] the target of the link

    The ''::active-navigation()'' pseudo-class

    @@ -492,7 +498,7 @@ and the pseudo-class matches any element where:
     <> =
    -  <>? [ <> | link-href ]?
    +  <>? [ <> | link-href ]?
     <> = at | with | from | to
     
    @@ -519,7 +525,7 @@ the following steps return true: 1. Let navigationURL be the [=active navigation URL=] of the <> 1. If navigationURL is null, return false. -1. If a <> is present: +1. If a <> is present: 1. Let targetMatchResult be the result of [=URL pattern/match|match a URL pattern=] given urlPattern and linkTarget. From e9f795e510debe9d7fa820e22e8cc756a9779c9d Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 7 May 2026 09:50:24 -0400 Subject: [PATCH 022/127] [css-navigation-1] Move the section on the url-pattern() function. This moves the section for the url-pattern() function into the newly created umbrella section on defining URL patterns. --- css-navigation-1/Overview.bs | 122 +++++++++++++++++------------------ 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/css-navigation-1/Overview.bs b/css-navigation-1/Overview.bs index 1c50fd0e7e7e..f7500216d3aa 100644 --- a/css-navigation-1/Overview.bs +++ b/css-navigation-1/Overview.bs @@ -129,6 +129,67 @@ NOTE: The bracing syntax also allows for future expansion if needed. NOTE: Some of the design discussion for this feature has been in w3c/csswg-drafts#12594. +

    The ''url-pattern()'' function

    + + + +The url-pattern() function represents a [=URL pattern=], +which can be used to match URLs. + +
    +<> = url-pattern( <> )
    +
    + +This function represents a [=URL pattern=] that can be created +using the steps of the create a URL pattern for url-pattern() algorithm: + +1. Let arg be the <> argument to the ''url-pattern()'' function. + +1. Let baseURL be the [=style resource base URL=] of + the rule or declaration block containing the ''url-pattern()'' function. + +
    + Do we want this to be the base URL all the time? + For use of ''url-pattern()'' in ''@navigation'', + it's likely more useful for the base URL + to be the document URL rather than the style sheet URL. + However, it would be very awkward for ''url-pattern()'' + to be inconsistent with ''url()''. + + Should we allow the base URL of ''url-pattern()'' + to be defined by the consumer? + Should we introduce document-url-pattern()? + Should we do something similar to + [[css-images-3#ambiguous-urls]] + (see )? + + Also see other proposed uses of {{URLPattern}} in CSS + in , + for '':local-link''. +
    + +1. Return the result of [=URL pattern/create|create a URL pattern=] given + arg, baseURL, and an empty [=map=]. + +NOTE: This function requires that its argument is quoted. +This differs from the ''url()'' function, +which allows its argument to be quoted or unquoted. + +To serialize a ''url-pattern()'' function f, +[=serialize a function=] f, +using [=serialize a string=] on the single argument +to serialize f's contents. + +NOTE: This is defined this way because {{URLPattern}} +intentionally does not provide a serialization. +

    The <> value type

    @@ -729,67 +790,6 @@ and other things where this section links to non-exported definitions.
     ISSUE: Generally figure out if these definitions should care about
     the [=ongoing navigate event=] or the [=transition=].
     
    -

    The ''url-pattern()'' function

    - - - -The url-pattern() function represents a [=URL pattern=], -which can be used to match URLs. - -
    -<> = url-pattern( <> )
    -
    - -This function represents a [=URL pattern=] that can be created -using the steps of the create a URL pattern for url-pattern() algorithm: - -1. Let arg be the <> argument to the ''url-pattern()'' function. - -1. Let baseURL be the [=style resource base URL=] of - the rule or declaration block containing the ''url-pattern()'' function. - -
    - Do we want this to be the base URL all the time? - For use of ''url-pattern()'' in ''@navigation'', - it's likely more useful for the base URL - to be the document URL rather than the style sheet URL. - However, it would be very awkward for ''url-pattern()'' - to be inconsistent with ''url()''. - - Should we allow the base URL of ''url-pattern()'' - to be defined by the consumer? - Should we introduce document-url-pattern()? - Should we do something similar to - [[css-images-3#ambiguous-urls]] - (see )? - - Also see other proposed uses of {{URLPattern}} in CSS - in , - for '':local-link''. -
    - -1. Return the result of [=URL pattern/create|create a URL pattern=] given - arg, baseURL, and an empty [=map=]. - -NOTE: This function requires that its argument is quoted. -This differs from the ''url()'' function, -which allows its argument to be quoted or unquoted. - -To serialize a ''url-pattern()'' function f, -[=serialize a function=] f, -using [=serialize a string=] on the single argument -to serialize f's contents. - -NOTE: This is defined this way because {{URLPattern}} -intentionally does not provide a serialization. -

    Privacy Considerations

    ISSUE: To be written. From 5bd78836177d02c787a3da1f105da64e0150f6cf Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 7 May 2026 10:04:59 -0400 Subject: [PATCH 023/127] [css-navigation-1][editorial] Fix section title. --- css-navigation-1/Overview.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css-navigation-1/Overview.bs b/css-navigation-1/Overview.bs index f7500216d3aa..e4592a7873c4 100644 --- a/css-navigation-1/Overview.bs +++ b/css-navigation-1/Overview.bs @@ -455,7 +455,7 @@ ISSUE: This should probably have a more formal definition of the function, but I can't find the formal definitions of the existing ''if()'' functions to model it after. - + From a0d5084047027ddf1d3d6b93dd0530116abbb983 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Thu, 7 May 2026 16:24:43 +0200 Subject: [PATCH 024/127] [css-shapes-1][editorial] Add to (#13894) Oversight in #9727. --- css-shapes-1/Overview.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css-shapes-1/Overview.bs b/css-shapes-1/Overview.bs index 163ebef8ad7b..ab9d65831346 100644 --- a/css-shapes-1/Overview.bs +++ b/css-shapes-1/Overview.bs @@ -331,7 +331,7 @@ Basic Shapes can be specified using basic shape functions.
    -		<> = <> | <> | <> |  <> | <>
    +		<> = <> | <> | <> |  <> | <> | <>
     	
    When using this syntax From 4aa79545565f7305730d65376f3cca7423807443 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 7 May 2026 10:36:03 -0400 Subject: [PATCH 025/127] [css-navigation-1] Add stub definitions for @navigation (phase: loading | ready | committed). --- css-navigation-1/Overview.bs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/css-navigation-1/Overview.bs b/css-navigation-1/Overview.bs index e4592a7873c4..93bf0b5c4264 100644 --- a/css-navigation-1/Overview.bs +++ b/css-navigation-1/Overview.bs @@ -319,7 +319,8 @@ with <> defined as: <> = ( <> ) | ( <> ) | <> <> = <> | <> | - <> + <> | + <> <> = <> : <> <> = at | with | from | to @@ -329,6 +330,9 @@ with <> defined as: <> = history : <> <> = traverse | back | forward | reload + +<> = phase : <> +<> = loading | ready | committed
    ISSUE: Should we use ''at''/''with''/''from''/''to'' or ''current''/''other''/''from''/''to''? @@ -406,6 +410,16 @@ as follows: : history: reload :: True if the [=current navigation type=] is {{NavigationType/reload}}. +: <> +:: : phase: loading + :: ISSUE: Needs to be defined. + : phase: ready + :: ISSUE: Needs to be defined. + + NOTE: Only applies to cross-document navigations. + : phase: committed + :: ISSUE: Needs to be defined. + : <> :: The result is false. From cb6bac6a79935ac8f091437bfca3d9d68652b8bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E4=B8=9D?= Date: Fri, 8 May 2026 05:55:40 +0800 Subject: [PATCH 026/127] [css-color-5] Change the computed value of `light-dark()` none from `linear-gradient(transparent)` to `image(transparent)` (#13897) * Change the computed value of `light-dark()` none from `linear-gradient(transparent)` to `image(transparent)` * Apply suggestion from @tabatkins --------- Co-authored-by: Tab Atkins Jr. --- css-color-5/Overview.bs | 17 +++++++++-------- css-images-4/Overview.bs | 6 +++++- css-images-5/Overview.bs | 6 +++++- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/css-color-5/Overview.bs b/css-color-5/Overview.bs index bf19e51b54b3..7936e50df33b 100644 --- a/css-color-5/Overview.bs +++ b/css-color-5/Overview.bs @@ -2808,15 +2808,10 @@ or any other color or monochrome output device which has been characterized. if the used color scheme is ''light'' or unknown, or the second image, if the used color scheme is ''dark''. - The none keyword - produces a fully transparent image - with no natural size. - It is equivalent to a single-stop gradient whose stop color is ''transparent''': - -
    -		linear-gradient(transparent)
    -	
    + The none keyword + computes to ''image(transparent)'' + (a fully transparent image with no natural size).
    For example, to maintain a legible contrast on links, @@ -2866,6 +2861,12 @@ or any other color or monochrome output device which has been characterized.
     				background-image: light-dark(url(my-light-image.png), none);
     			
    + + This is equivalent to: + +
    +				background-image: light-dark(url(my-light-image.png), image(transparent));
    +			
    diff --git a/css-images-4/Overview.bs b/css-images-4/Overview.bs index b5a087a1ca0e..632e9fd495ac 100644 --- a/css-images-4/Overview.bs +++ b/css-images-4/Overview.bs @@ -395,7 +395,11 @@ Image Fallbacks and Annotations: the ''image()'' notation {#image-notation} one can use this as a simple way to "tint" a background image, by overlaying a partially-transparent color over the top of the other image: -
    background-image: image(rgba(0,0,255,.5)), url("bg-image.png");
    +
    background-image: image(rgba(0, 0, 255, .5)), url("bg-image.png");
    + + This is equivalent to a single color stop gradient: + +
    background-image: linear-gradient(rgba(0, 0, 255, .5)), url("bg-image.png");
    'background-color' does not work for this, as the solid color it generates always lies beneath all the background images. diff --git a/css-images-5/Overview.bs b/css-images-5/Overview.bs index cedc19fed8dd..d66fb4492568 100644 --- a/css-images-5/Overview.bs +++ b/css-images-5/Overview.bs @@ -201,7 +201,11 @@ Image Fallbacks and Annotations: the ''image()'' notation {#image-notation} one can use this as a simple way to "tint" a background image, by overlaying a partially-transparent color over the top of the other image: -
    background-image: image(rgba(0,0,255,.5)), url("bg-image.png");
    +
    background-image: image(rgba(0, 0, 255, .5)), url("bg-image.png");
    + + This is equivalent to a single color stop gradient: + +
    background-image: linear-gradient(rgba(0, 0, 255, .5)), url("bg-image.png");
    'background-color' does not work for this, as the solid color it generates always lies beneath all the background images. From ed21afd9437133fd448a7146012cd2753cc8c16d Mon Sep 17 00:00:00 2001 From: "Tab Atkins Jr." Date: Thu, 7 May 2026 14:59:23 -0700 Subject: [PATCH 027/127] [css-color-adjust-1] Rework color scheme stuff to reflect f2f resolutions (#13857) * [css-color-adjust-1] Rework the color-scheme section to use the concepts of 'page color scheme' and 'element color scheme', deferring as much as possible to the page color scheme, in preparation for adjusting the behavior of the MQ. #13377 * [css-color-adjust-1] Move and fix up examples. #13377 * [css-color-adjust-1][mediaqueries-5] Specify that *all* embedded documents use the embedding element's color scheme. #7213 #7493 * [mediaqueries-5] Switch (prefers-color-scheme) to use the page color scheme. Add (ua-color-scheme) to reflect the user's actual preference. #13377 * [css-color-4][css-color-5] Use the new correct term for an element's color scheme. * [css-color-5][editorial] Fix indentation. * ws --- css-color-4/Overview.bs | 2 +- css-color-5/Overview.bs | 66 +++--- css-color-adjust-1/Overview.bs | 417 ++++++++++++++++++++------------- mediaqueries-5/Overview.bs | 119 ++++++---- 4 files changed, 363 insertions(+), 241 deletions(-) diff --git a/css-color-4/Overview.bs b/css-color-4/Overview.bs index 44af1dc168b4..4d2f44d2c4c7 100644 --- a/css-color-4/Overview.bs +++ b/css-color-4/Overview.bs @@ -1927,7 +1927,7 @@ System Colors To maintain legibility, the <> keywords also respond to - the [=used color scheme=]. + the [=element color scheme=].
    For the color form, this function computes to the computed value of the first color, - if the used color scheme is ''light'' or unknown, + if the element color scheme is ''light'', or to the computed value of the second color, - if the used color scheme is ''dark''. + if the element color scheme is ''dark''. For the image form, this function returns the first image, - if the used color scheme is ''light'' or unknown, + if the element color scheme is ''light'', or the second image, - if the used color scheme is ''dark''. + if the element color scheme is ''dark''. The none keyword computes to ''image(transparent)'' @@ -2833,41 +2833,41 @@ or any other color or monochrome output device which has been characterized. is used in dark mode. (WCAG contrast 13.28:1, AAA pass). -
    -

    Legible link text

    -

    Illegible link text

    -

    Legible link text

    -
    +
    +

    Legible link text

    +

    Illegible link text

    +

    Legible link text

    + -
    - For example, to provide easily visible list bullets - for light mode and dark mode: +
    + For example, to provide easily visible list bullets + for light mode and dark mode: -
    -			ul.fancy {
    -			    list-style-image: light-dark(
    -					url("icons/deep-maroon-ball.png"),
    -					url("icons/pale-yellow-star.png")
    -				);
    -			}
    -		
    -
    +
    +		ul.fancy {
    +			list-style-image: light-dark(
    +				url("icons/deep-maroon-ball.png"),
    +				url("icons/pale-yellow-star.png")
    +			);
    +		}
    +	
    +
    -
    - For example, a raster image is used in light mode, - while in dark mode we want a fully-transparent image. +
    + For example, a raster image is used in light mode, + while in dark mode we want a fully-transparent image. -
    -				background-image: light-dark(url(my-light-image.png), none);
    -			
    +
    +			background-image: light-dark(url(my-light-image.png), none);
    +		
    - This is equivalent to: + This is equivalent to: -
    -				background-image: light-dark(url(my-light-image.png), image(transparent));
    -			
    -
    +
    +			background-image: light-dark(url(my-light-image.png), image(transparent));
    +		
    +	
    diff --git a/css-color-adjust-1/Overview.bs b/css-color-adjust-1/Overview.bs index ab79a23479fd..6add2cb7d4d6 100644 --- a/css-color-adjust-1/Overview.bs +++ b/css-color-adjust-1/Overview.bs @@ -20,7 +20,6 @@ Editor: Tab Atkins Jr., Google, http://www.xanthir.com/contact/, w3cid 42199 Abstract: This module introduces a model and controls over automatic color adjustment by the user agent to handle user preferences, such as "Dark Mode", contrast adjustment, or specific desired color schemes. Ignored Terms: -webkit-tap-highlight-color, name, the head element WPT Path Prefix: css/css-color-adjust/ -WPT Display: open
    - The '@media/prefers-color-scheme' media feature reflects the user's - desire that the page use a light or dark color theme. + The '@media/prefers-color-scheme' media feature reflects + the user's desire that the page use a [=light color scheme|light=] or [=dark color scheme=].
    light
    - Indicates that user has expressed the preference for - a page that has a light theme (dark text on light background), - or has not expressed an active preference - (and thus should receive the "web default" of a light theme). + Indicates that the [=page color scheme=] + is a [=light color scheme=] + (dark text on light background).
    dark
    - Indicates that user has expressed the preference for - a page that has a dark theme (light text on dark background). + Indicates that the [=page color scheme=] + is a [=dark color scheme=] + (light text on dark background).
    Note: The values for this feature might be expanded in the future - (to express a more active preference for light color schemes, - or preferences for other types of color schemes like "sepia"). + (to express preferences for other types of color schemes like "sepia"). As such, the most future-friendly way to use this media feature is by negation such as ''(prefers-color-scheme: dark)'' and ''(not (prefers-color-scheme: dark))'', which ensures that new values fall into at least one of the styling blocks. @@ -3181,40 +3180,67 @@ Detecting the desire for light or dark color schemes: the '@media/prefers-color- so that '@media/prefers-color-scheme' reflects preferences appropriate to the medium rather than preferences taken out of context. - If evaluated in an embedded SVG document - using the "Secure Animated" embedding mode, - the preferred color scheme must reflect the value of the [=used color scheme=] - on the embedding node in the embedding document. - -
    - Why do this? - - While the outermost document needs to get the user's preference directly, - it's more useful for an embedded document - to use the color scheme of its surrounding embedding context, - so it matches the surrounding content. - - However, this enables communication - from the embedding document to the embedded document, - so it's currently restricted to SVG's - using the "Secure Animated" mode, - which can't load external resources - or run script, - and thus can't respond to the color scheme - in any way observable to the outside world. - - Whether or not to do similar for iframes, - and under what conditions, - is being discussed in - Issue 7213. -
    + + prefers-color-scheme-svg-as-image.html + prefers-color-scheme-svg-image-normal-with-meta-dark.html + prefers-color-scheme-svg-image-normal-with-meta-light.html + prefers-color-scheme-svg-image-normal.html + prefers-color-scheme-svg-image.html + prefers-color-scheme.html + + +

    +Detecting Specifically the User's Preferred Color Scheme: the '@media/ua-prefers-color-scheme' feature

    + +
    +	Name: ua-color-scheme
    +	Value: light | dark
    +	For: @media
    +	Type: discrete
    +	
    + + The '@media/prefers-color-scheme' media query reflects the [=page color scheme=], + which will generally reflect a user's [=preferred color scheme=], + but might not if the page overrides that. + (This is often done at the user's behest, + with a page-specific light/dark-mode toggle + to implement a user's desire for a particular page or origin + to render light or dark, + regardless of their general color scheme preference.) + Also, embedded documents such as iframes + automatically match the color scheme of the parent document + rather than the user's preference. + + There are some use-cases for nevertheless detecting the user's actual general preference, + and the '@media/ua-color-scheme' [=media feature=] reflects that, + ignoring the effect of anything on the page, + the effects of being an embedded document, + etc. + +
    +
    light +
    + Indicates that the user's [=preferred color scheme=] + is a [=light color scheme=] + (dark text on light background), + or that the user has no preference. + + (If the user has not expressed an active preference, + they will also receive the "web default" of a light theme). + +
    dark +
    + Indicates that the user's [=preferred color scheme=] + is a [=dark color scheme=] + (light text on dark background). +
    This feature, like the other 'prefers-*' features, previously had a no-preference value - to indicate an author not expressing an active preference. + to indicate a user not expressing an active preference. However, user agents converged on expressing the "default" behavior - as a ''light'' preference, + as a [=light color scheme=] preference, and never matching no-preference. If a future user agent wishes to expose a difference @@ -3222,14 +3248,9 @@ Detecting the desire for light or dark color schemes: the '@media/prefers-color- please contact the CSSWG to discuss this.
    - - prefers-color-scheme-svg-as-image.html - prefers-color-scheme-svg-image-normal-with-meta-dark.html - prefers-color-scheme-svg-image-normal-with-meta-light.html - prefers-color-scheme-svg-image-normal.html - prefers-color-scheme-svg-image.html - prefers-color-scheme.html - + Issue: The CSSWG has not officially decided on a name for this feature, + and so it might change in the future. +

    Detecting the desire for reduced data usage when loading a page: the '@media/prefers-reduced-data' feature

    @@ -3398,8 +3419,8 @@ This is modeled after the [[#prefers-color-scheme]]. The get valid values for colorScheme algorithm, when invoked, must run these steps: 1. Let |validValues| be a new empty [=sequence=]. - 1. Add ''light'' to |validValues|. - 1. Add ''dark'' to |validValues|. + 1. Add "light" to |validValues|. + 1. Add "dark" to |validValues|. 1. Return |validValues|. From 8102aa683ccd431b904d2933bf5abb0149ce84df Mon Sep 17 00:00:00 2001 From: Callum Law Date: Sat, 9 May 2026 06:32:40 +1200 Subject: [PATCH 028/127] [css-values-4] Properly handle simplification of sum nodes containing negated sum nodes #13020 (#13069) * [css-values-4] Remove erroneous tag * [css-values-4] Properly handle simplification of sum nodes containing negated sum nodes #13020 A WPT test already exists in the form of css/css-values/calc-nesting-002.html * ws --------- Co-authored-by: Tab Atkins Jr. --- css-values-4/Overview.bs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/css-values-4/Overview.bs b/css-values-4/Overview.bs index 1eb0c4b037b3..50a1b14b87e1 100644 --- a/css-values-4/Overview.bs +++ b/css-values-4/Overview.bs @@ -4937,7 +4937,28 @@ Simplification (0 - value). 2. If |root|'s child is a Negate node, return the child's child. - 3. Return |root|. + 3. If |root|'s child is a Sum node: + + 1. Let |negated grandchildren| be an empty list + + 2. For each |grandchild| of the child's children: + + 1. If |grandchild| is a numeric value, + create an equivalent numeric value, + but with the value negated + (0 - value), + and append the result to |negated grandchildren|. + + 2. If |grandchild| is a Negate node + append |grandchild|'s child to |negated grandchildren| + + 3. Otherwise, + create a Negate node with |grandchild| as its child, + and append the result to |negated grandchildren| + + 3. Return a Sum node with |negated grandchildren| as its children + + 4. Return |root|. 7. If |root| is an Invert node: From c196082de8b8fe30e89f095d67e0262f084f35f8 Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 8 May 2026 14:55:28 -0400 Subject: [PATCH 029/127] [css-values-4] Define snapping negative lengths as line width --- css-values-4/Overview.bs | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/css-values-4/Overview.bs b/css-values-4/Overview.bs index 50a1b14b87e1..de027cc305d2 100644 --- a/css-values-4/Overview.bs +++ b/css-values-4/Overview.bs @@ -1790,19 +1790,17 @@ Distance Units: the <> type (This algorithm is called by individual properties explicitly.)
    - To snap a length as a border width + To snap a length as a line width given a <> |len|: - 1. Assert: |len| is non-negative. - - 2. If |len| is an integer number of [=device pixels=], + 1. If |len| is an integer number of [=device pixels=], do nothing. - 3. If |len| is greater than zero, but less than 1 [=device pixel=], - round |len| up to 1 [=device pixel=]. + 2. If the absolute value of |len| is greater than zero, but less than 1 [=device pixel=], + round it away from zero to 1 [=device pixel=]. - 4. If |len| is greater than 1 [=device pixel=], - round it down to the nearest integer number of [=device pixels=]. + 4. If the absolute value of |len| is greater than 1 [=device pixel=], + round it towards zero to the nearest integer number of [=device pixels=].

    @@ -3344,18 +3342,13 @@ Stepped Value Functions: ''round()'', ''mod()'', and ''rem()''

    :: Choose whichever of |lower B| and |upper B| that has the smallest absolute difference from 0. : line-width - :: If A is non-negative and B is omitted, - A is [=snapped as a border width=]. + :: If B is omitted, + A is [=snapped as a line width=]. - Otherwise, if A is non-negative and B is specified, - identical to ''/nearest'', + Otherwise round as for ''/nearest'', except that if one of |lower B| or |upper B| is zero, - always choose the non-zero one. - Then [=snap as a border width=]. - - Otherwise (A is negative), - identical to ''/nearest''. - (No snapping occurs.) + the non-zero one is chosen, + and the final result is [=snapped as a line width=]. If |lower B| would be zero, @@ -5671,6 +5664,12 @@ Recent Changes (This is a subset of [[#additions-L3]].) + Substantial changes since 12 March 2024 Working Draft: + * Adapt the [=snap as a line width=] algorithm to handle negative numbers. + (Issue 13795) + + ISSUE: Finish this list. + Substantial changes since 18 December 2023 WD: * Added the ''clamp()/none'' values to ''clamp()'', @@ -5719,7 +5718,7 @@ Recent Changes
    • Added [[#component-functions]] to formally define the way that [=functional notation=] syntaxes are defined. (Issue 2921) -
    • Added algorithm for [=snap as a border width=], +
    • Added algorithm for [=snap as a line width=], to reflect the interoperable rules for rendering consistent stroke widths. (Issue 5210)
    • Clarified grammar and [=computed value=] of ''mix()''. From d9675fd208d3a2e6c110a43946d5ac3c6748da0b Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 8 May 2026 15:04:17 -0400 Subject: [PATCH 030/127] [css-values-4] Fix bad wording in identifier dfn #12982 --- css-values-4/Overview.bs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/css-values-4/Overview.bs b/css-values-4/Overview.bs index de027cc305d2..2105f269e21e 100644 --- a/css-values-4/Overview.bs +++ b/css-values-4/Overview.bs @@ -668,9 +668,17 @@ Textual Data Types (which includes character set conversion and [[css-syntax-3#escaping|escaping]]). [[!UNICODE]] [[!CSS-SYNTAX-3]] + [=Strings=], denoted by <string>, + are sequences of characters representing arbitrary textual data. + When written literally, + they are delimited by double quotes or single quotes, + and correspond to the <> production. [[!CSS-SYNTAX-3]]. + CSS identifiers, generically denoted by <ident>, - consist of a sequence of characters conforming to the <> grammar. [[!CSS-SYNTAX-3]] + represent names, + and are written as an unquoted sequence of (potentially escaped) characters + corresponding to the <> grammar. [[!CSS-SYNTAX-3]] Identifiers cannot be quoted; otherwise they would be interpreted as strings. CSS properties accept two classes of [=CSS/identifiers=]: @@ -867,11 +875,11 @@ Prefixed Author-defined Identifiers: the <> type

      Quoted Strings: the <> type

      - [=Strings=] are denoted by <string>. + [=Strings=], denoted by <string>, + are sequences of characters representing arbitrary textual data. When written literally, - they consist of a sequence of characters delimited by double quotes or single quotes, - corresponding to the <> production - in the CSS Syntax Module [[!CSS-SYNTAX-3]]. + they are delimited by double quotes or single quotes, + and correspond to the <> production. [[!CSS-SYNTAX-3]].
      Double quotes cannot occur inside double quotes, unless From a15676f47ecc6838b555210f0f1e32c77dee8239 Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 8 May 2026 16:54:12 -0400 Subject: [PATCH 031/127] [css-values-5] Clarify coordinated list shorthand serialization #13500 --- css-values-4/Overview.bs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/css-values-4/Overview.bs b/css-values-4/Overview.bs index 2105f269e21e..28484012bedd 100644 --- a/css-values-4/Overview.bs +++ b/css-values-4/Overview.bs @@ -5502,7 +5502,7 @@ Appendix A: Coordinating List-Valued Properties these are used together to define a single effect, such as a background image layer or an animation. - The [=coordinated value list=] is assembled as follows: + The [=used value|used=] [=coordinated value list=] is assembled as follows: * The length of the [=coordinated value list=] is determined by the number of items specified in one particular [=coordinating list property=], @@ -5521,6 +5521,24 @@ Appendix A: Coordinating List-Valued Properties * The [=computed values=] of the [=coordinating list properties=] are not affected by such truncation or repetition. +
      + A shorthand that represents a [=coordinated value list=] + as a single list collecting corresponding values into each item + cannot represent [=coordinating list property=] longhands + that have varying list lengths in their values. + Thus, if any longhands have mismatched list lengths + (excepting any longhands that have their initial value, + and thus can be omitted from the shorthand syntax), + the CSSOM representation of the shorthand's value will return the empty string. + +

      In the 'background' shorthand, + the first value in the list combines the first values from 'background-image', 'background-position, 'background-attachment', etc; + the second value combines the second values; and so on. + This syntax can only represent its longhands when they have equal-length lists + (or are their initial value); + if the longhands are individually set to different lengths, + the CSSOM representation of 'background' is just "" (the empty string). +

      Appendix B: IANA Considerations

      From f07719abd3175dcb85601392681a2e17dfea4dcb Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 8 May 2026 17:11:13 -0400 Subject: [PATCH 032/127] [css-overflow-3] Update intro --- css-overflow-3/Overview.bs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/css-overflow-3/Overview.bs b/css-overflow-3/Overview.bs index 7b02a033ee6c..d294469ef626 100644 --- a/css-overflow-3/Overview.bs +++ b/css-overflow-3/Overview.bs @@ -91,11 +91,12 @@ Introduction which makes sense when the author's intent is that the content not be shown. - This specification introduces the long-standing de-facto 'overflow-x' and 'overflow-y' properties, + This specification defines the long-standing de-facto 'overflow-x' and 'overflow-y' properties, adds a ''overflow/clip'' value, + introduces an 'overflow-clip-margin' property, and defines overflow handling more fully. - - [Something something 'max-lines'.] + It also introduces control over smooth scrolling via 'scroll-behavior' + and for reserving space for the scrollbar via 'scrollbar-gutter'. Note: This specification also reproduces the definition of the 'text-overflow' property previously defined in [[CSS-UI-3]], From 0a14f0297342e59dd7aaef199390d1b13993df9e Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 8 May 2026 17:27:58 -0400 Subject: [PATCH 033/127] [css-overflow-3] overflow propagation only applies to 'overflow' longhands, move section --- css-overflow-3/Overview.bs | 64 ++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/css-overflow-3/Overview.bs b/css-overflow-3/Overview.bs index d294469ef626..abd5ceab9617 100644 --- a/css-overflow-3/Overview.bs +++ b/css-overflow-3/Overview.bs @@ -619,6 +619,37 @@ Overflow in Print and Other Static Media for example, e-book readers paginate content, but are interactive. +

      +Overflow Viewport Propagation

      + + UAs must apply the 'overflow' values + set on the root element to the viewport + when the root element’s 'display' value is not ''display/none''. + However, + when the root element is an [[!HTML]] <{html}> element + (including XML syntax for HTML) + whose 'overflow' value is ''overflow/visible'' (in both axes), + and that element has as a child + a <{body}> element whose 'display' value is also not ''display/none'', + user agents must instead apply the 'overflow' values + of the first such child element to the viewport. + The element from which the value is propagated must then have + a used 'overflow' value of ''overflow/visible''. + + Note: Using [=containment=] on the HTML <{html}> or <{body}> elements disables + this special handling of the HTML <{body}> element. + See the [[CSS-CONTAIN-1#contain-property]] for details. + + Note: ''overflow: hidden'' on the root element + might not clip everything outside the [=Initial Containing Block=] + if the ICB is smaller than the viewport, + which can happen on mobile. + + If ''overflow/visible'' is applied to the viewport, + it must be interpreted as ''overflow/auto''. + If ''overflow/clip'' is applied to the viewport, + it must be interpreted as ''overflow/hidden''. +

      Expanding Clipping Bounds: the 'overflow-clip-margin' property

      @@ -677,39 +708,6 @@ Expanding Clipping Bounds: the 'overflow-clip-margin' property It now also affects [=scroll containers=], but only to shrink the clipping edge. - -

      -Overflow Viewport Propagation

      - - UAs must apply the 'overflow-*' values - set on the root element to the viewport - when the root element’s 'display' value is not ''display/none''. - However, - when the root element is an [[!HTML]] <{html}> element - (including XML syntax for HTML) - whose 'overflow' value is ''overflow/visible'' (in both axes), - and that element has as a child - a <{body}> element whose 'display' value is also not ''display/none'', - user agents must instead apply the 'overflow-*' values - of the first such child element to the viewport. - The element from which the value is propagated must then have - a used 'overflow' value of ''overflow/visible''. - - Note: Using [=containment=] on the HTML <{html}> or <{body}> elements disables - this special handling of the HTML <{body}> element. - See the [[CSS-CONTAIN-1#contain-property]] for details. - - Note: ''overflow: hidden'' on the root element - might not clip everything outside the [=Initial Containing Block=] - if the ICB is smaller than the viewport, - which can happen on mobile. - - If ''overflow/visible'' is applied to the viewport, - it must be interpreted as ''overflow/auto''. - If ''overflow/clip'' is applied to the viewport, - it must be interpreted as ''overflow/hidden''. - -

      Smooth Scrolling: the 'scroll-behavior' Property

      From 6dc4b57ae2549cd1fe1a58ca3431ec9d1c59f5c1 Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 8 May 2026 17:35:15 -0400 Subject: [PATCH 034/127] [css-overflow-3] Make new subsection for scroll-behavior and friends --- css-overflow-3/Overview.bs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/css-overflow-3/Overview.bs b/css-overflow-3/Overview.bs index abd5ceab9617..9a72ae1d9c1d 100644 --- a/css-overflow-3/Overview.bs +++ b/css-overflow-3/Overview.bs @@ -708,6 +708,18 @@ Expanding Clipping Bounds: the 'overflow-clip-margin' property It now also affects [=scroll containers=], but only to shrink the clipping edge. +

      +Scrolling Behaviors and Animations

      + +CSS provides several controls over how scrolling behaves when triggered. + * CSS Scroll Snap allows defining "snap positions", + which are scroll positions to which the [=scroll container=] is biased to land. + * CSS Overscroll Behavior + allows controlling what happens when scrolling past the end of the scrollable area. + * 'scroll-behavior', defined below, controls whether programmatic scrolling animates smoothly or not. + + Note: For animating other things in conjunction with scrolling, see [[SCROLL-ANIMATIONS-1]]. +

      Smooth Scrolling: the 'scroll-behavior' Property

      From bc4cffe1c9b2f785f9cddf93f397db034715d7ab Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 8 May 2026 17:41:35 -0400 Subject: [PATCH 035/127] [css-overflow-3] Move scrollable overflow details out from the intro --- css-overflow-3/Overview.bs | 218 +++++++++++++++++++------------------ 1 file changed, 111 insertions(+), 107 deletions(-) diff --git a/css-overflow-3/Overview.bs b/css-overflow-3/Overview.bs index 9a72ae1d9c1d..350e4217d3e2 100644 --- a/css-overflow-3/Overview.bs +++ b/css-overflow-3/Overview.bs @@ -216,110 +216,7 @@ Scrollable Overflow scrollable overflow rectangle is the minimal rectangle whose axes are aligned to the box's axes and that contains the scrollable overflow area. - - The scrollable overflow area is the union of: -
        -
      • - The [=scroll container=]’s own [=padding box=]. - -
      • - All [=line boxes=] directly contained by the [=scroll container=]. - -
      • - The border boxes - of all boxes for which it is the containing block - and whose border boxes are positioned not wholly - in the [=unreachable scrollable overflow region=], - accounting for transforms by projecting each box onto - the plane of the element that establishes its 3D rendering context. - [[!CSS3-TRANSFORMS]] - - Issue: Is this description of handling transforms - sufficiently accurate? - - Border boxes with zero area - do not affect the [=scrollable overflow area=]. - -
      • - The margin areas of grid item and flex item boxes - for which the box establishes a containing block. - - The UA may additionally include - the margin areas of other boxes - for which the box establishes a containing block; - however, - the conditions under which such margin areas are included - is undefined in this level. - This needs further testing and investigation; - is therefore deferred in this draft. - -
      • - The scrollable overflow areas of all of the above boxes - (including zero-area boxes - and accounting for transforms as described above), - provided they themselves have ''overflow: visible'' - (i.e. do not themselves trap the overflow) - and that scrollable overflow is not already clipped - (e.g. by the 'clip' property or the 'contain' property). - - Note: The 'mask-*' properties [[!CSS-MASKING-1]] - do not affect the scrollable overflow area. - - ISSUE(8607): Need to evaluate what should/should not clip [=scrollable overflow=]. - -
      • - Additional padding added - to the [=scrollable overflow rectangle=] - as necessary to enable scroll positions - that satisfy the requirements of both - ''place-content: start'' and ''place-content: end'' alignment. - - Note: This padding represents, - within the [=scrollable overflow rectangle=], - the box’s own padding - so that when its content is scrolled to its end, - there is padding between the edge of its [=in-flow=] (or floated) content - and the border edge of the box. - It typically ends up being exactly the same size as the box's own padding, - except in a few cases-- - such as when an [=out-of-flow=] positioned element, - or the visible overflow of a descendent, - has already increased the size of the [=scrollable overflow rectangle=] - outside the conceptual “content edge” of the [=scroll container=]’s content. - -
        - -
        - Issue: Replace this image with a proper SVG. -
        -
        - -
      - - Additionally, due to Web-compatibility constraints - (caused by authors exploiting legacy bugs to surreptitiously hide content from visual readers but not search engines and/or speech output), - UAs must clip any content in the [=unreachable scrollable overflow region=]. - - Note: The [=content-distribution properties=] can - [[css-align-3#overflow-scroll-position|alter the unreachable scrollable overflow region]] - to ensure that a [=scroll container=]’s [=alignment subject=] - is reachable after alignment. - [[CSS-ALIGN-3]] - - + See [[#scrollable-overflow-calculation]] for details. Note: The scrollable overflow rectangle is always a rectangle in the box's own coordinate system, but might be non-rectangular @@ -700,16 +597,123 @@ Expanding Clipping Bounds: the 'overflow-clip-margin' property * the [=overflow clip edge=] is clamped to stay within the element's [=padding box=]. (This does not affect the [=computed value|computed=] or [=used value=] of this property.) - * the ''border-box'' value - behaves as ''padding-box'' + * the ''overflow-clip-margin/border-box'' value + behaves as ''overflow-clip-margin/padding-box'' and ignores any specified offset. Note: This property was previously defined to only affect ''overflow: clip''. It now also affects [=scroll containers=], but only to shrink the clipping edge. +

      +Calculating the Scrollable Overflow Area

      + + The scrollable overflow area of a [=scroll container=] is the union of: +
        +
      • + The [=scroll container=]’s own [=padding box=]. + +
      • + All [=line boxes=] directly contained by the [=scroll container=]. + +
      • + The border boxes + of all boxes for which it is the containing block + and whose border boxes are positioned not wholly + in the [=unreachable scrollable overflow region=], + accounting for transforms by projecting each box onto + the plane of the element that establishes its 3D rendering context. + [[!CSS3-TRANSFORMS]] + + Issue: Is this description of handling transforms + sufficiently accurate? + + Border boxes with zero area + do not affect the [=scrollable overflow area=]. + +
      • + The margin areas of grid item and flex item boxes + for which the box establishes a containing block. + + The UA may additionally include + the margin areas of other boxes + for which the box establishes a containing block; + however, + the conditions under which such margin areas are included + is undefined in this level. + This needs further testing and investigation; + is therefore deferred in this draft. + +
      • + The scrollable overflow areas of all of the above boxes + (including zero-area boxes + and accounting for transforms as described above), + provided they themselves have ''overflow: visible'' + (i.e. do not themselves trap the overflow) + and that scrollable overflow is not already clipped + (e.g. by the 'clip' property or the 'contain' property). + + Note: The 'mask-*' properties [[!CSS-MASKING-1]] + do not affect the scrollable overflow area. + + ISSUE(8607): Need to evaluate what should/should not clip [=scrollable overflow=]. + +
      • + Additional padding added + to the [=scrollable overflow rectangle=] + as necessary to enable scroll positions + that satisfy the requirements of both + ''place-content: start'' and ''place-content: end'' alignment. + + Note: This padding represents, + within the [=scrollable overflow rectangle=], + the box’s own padding + so that when its content is scrolled to its end, + there is padding between the edge of its [=in-flow=] (or floated) content + and the border edge of the box. + It typically ends up being exactly the same size as the box's own padding, + except in a few cases-- + such as when an [=out-of-flow=] positioned element, + or the visible overflow of a descendent, + has already increased the size of the [=scrollable overflow rectangle=] + outside the conceptual “content edge” of the [=scroll container=]’s content. + +
        + +
        + Issue: Replace this image with a proper SVG. +
        +
        + +
      + + Additionally, due to Web-compatibility constraints + (caused by authors exploiting legacy bugs to surreptitiously hide content from visual readers but not search engines and/or speech output), + UAs must clip any content in the [=unreachable scrollable overflow region=]. + + Note: The [=content-distribution properties=] can + [[css-align-3#overflow-scroll-position|alter the unreachable scrollable overflow region]] + to ensure that a [=scroll container=]’s [=alignment subject=] + is reachable after alignment. + [[css-align-3]] + + +

      -Scrolling Behaviors and Animations

      +Scrolling Behaviors and Animations CSS provides several controls over how scrolling behaves when triggered. * CSS Scroll Snap allows defining "snap positions", From 912cac79ec0cbe713aa40662421a4800942d66d6 Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 8 May 2026 18:02:49 -0400 Subject: [PATCH 036/127] [css-overflow-3][editorial] Improvements to scrolling terminology section structure --- css-overflow-3/Overview.bs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/css-overflow-3/Overview.bs b/css-overflow-3/Overview.bs index 350e4217d3e2..fe0a36ec4ac9 100644 --- a/css-overflow-3/Overview.bs +++ b/css-overflow-3/Overview.bs @@ -234,8 +234,9 @@ Scrolling Overflow (through which the scrollable overflow area can be viewed) coincides with its padding box, and is called the scrollport. - A box’s nearest scrollport - is the [=scrollport=] of its nearest [=scroll container=] ancestor. + A box’s nearest scroll container + is the its nearest [=scroll container=] ancestor in the [=containing block chain=]. + (See [[#overflow-properties]] for control over whether a box clips or scrolls its overflow.) Scrolling operations can be initiated by the user (for example, by manipulating a scrollbar, swiping a touchscreen, or using keyboard controls) @@ -262,12 +263,6 @@ Scrolling Overflow Unless otherwise specified, it is the [=block-start=] [=inline-start=] corner of the [=scrollable overflow rectangle=]. (For example, in a [=flex container=] it is the [=main-start=] [=cross-start=] corner.) - Unless otherwise adjusted - (e.g. [[css-align-3#overflow-scroll-position|by content alignment]] [[css-align-3]]), - the area beyond the [=scroll origin=] in either axis - is considered the unreachable scrollable overflow region: - content rendered here is not accessible to the reader, - see [[#scrollable]]. A [=scroll container=] is said to be scrolled to its [=scroll origin=] when its [=scroll origin=] coincides with the corresponding corner of its [=scrollport=]. This [=scroll position=], the scroll origin position, @@ -290,6 +285,13 @@ Scrolling Overflow or away from the [=scroll origin=] is not defined. Should each API define its coordinate model? + Unless otherwise adjusted + (e.g. [[css-align-3#overflow-scroll-position|by content alignment]] [[css-align-3]]), + the area beyond the [=scroll origin=] in either axis + is considered the unreachable scrollable overflow region: + content rendered here is not accessible to the reader, + see [[#scrollable]]. + The root viewport, which scrolls the page [=canvas=], uses the principal writing mode for determining its [=scroll origin=] and [=initial scroll position=]. From 83012c0bfbf18a13b4bc5373c27b89650739c7dd Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 8 May 2026 18:03:11 -0400 Subject: [PATCH 037/127] [css-overflow-3] Add per-axis subtypes of scroll containers --- css-overflow-3/Overview.bs | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/css-overflow-3/Overview.bs b/css-overflow-3/Overview.bs index fe0a36ec4ac9..80049cb22d95 100644 --- a/css-overflow-3/Overview.bs +++ b/css-overflow-3/Overview.bs @@ -321,15 +321,34 @@ Scrolling Overflow -->

      -Scrolling and Clipping Overflow

      +Clipping and Scrolling Overflow + + The properties in this chapter specify whether and where a box’s [=overflow=] is clipped; + if so, whether it is a [=scroll container=]; + and if so, in which axis(es) it is allowed to scroll, + thus which of the following types of [=scroll container=] it is: + +
      +
      single-axis scroll container +
      + A [=scroll container=] that can scroll in only one axis. + +
      dual-axis scroll container +
      + A [=scroll container=] that can scroll in both axes. + +
      block-axis scroll container +
      inline-axis scroll container +
      x-axis scroll container +
      y-axis scroll container +
      + A [=scroll container=] that can scroll in the specified axis, + regardless of whether it can also scroll in the other axis. +

      Managing Overflow: the 'overflow-x', 'overflow-y', and 'overflow' properties

      - These properties specify whether a box’s [=overflow=] is clipped, - and if so, - whether it is a [=scroll container=]. -
       		Name: overflow-x, overflow-y, overflow-block, overflow-inline
       		Value: visible | hidden | clip | scroll | auto
      
      From d59e6f8a7e81009d335038517defac39bd082e26 Mon Sep 17 00:00:00 2001
      From: fantasai 
      Date: Fri, 8 May 2026 18:40:48 -0400
      Subject: [PATCH 038/127] [css-overflow-3] Allow single-axis scrollability
       #12289
      
      ---
       css-overflow-3/Overview.bs | 61 ++++++++++++++++++++++----------------
       1 file changed, 35 insertions(+), 26 deletions(-)
      
      diff --git a/css-overflow-3/Overview.bs b/css-overflow-3/Overview.bs
      index 80049cb22d95..44f1310bd665 100644
      --- a/css-overflow-3/Overview.bs
      +++ b/css-overflow-3/Overview.bs
      @@ -235,7 +235,7 @@ Scrolling Overflow
       	coincides with its padding box,
       	and is called the scrollport.
       	A box’s nearest scroll container
      -	is the its nearest [=scroll container=] ancestor in the [=containing block chain=].
      +	is the nearest [=scroll container=] ancestor in the [=containing block chain=].
       	(See [[#overflow-properties]] for control over whether a box clips or scrolls its overflow.)
       
       	Scrolling operations can be initiated by the user
      @@ -325,24 +325,24 @@ Clipping and Scrolling Overflow
       
       	The properties in this chapter specify whether and where a box’s [=overflow=] is clipped;
       	if so, whether it is a [=scroll container=];
      -	and if so, in which axis(es) it is allowed to scroll,
      +	and if so, in which axis(es) it is allowed to scroll (its scrollable axis(es)),
       	thus which of the following types of [=scroll container=] it is:
       
       	
      -
      single-axis scroll container +
      single-axis scroll container
      - A [=scroll container=] that can scroll in only one axis. + A [=scroll container=] that is scrollable in only one axis. -
      dual-axis scroll container +
      dual-axis scroll container
      - A [=scroll container=] that can scroll in both axes. + A [=scroll container=] that is scrollable in both axes. -
      block-axis scroll container -
      inline-axis scroll container -
      x-axis scroll container -
      y-axis scroll container +
      block-axis scroll container +
      inline-axis scroll container +
      x-axis scroll container +
      y-axis scroll container
      - A [=scroll container=] that can scroll in the specified axis, + A [=scroll container=] that is scrollable in the specified axis, regardless of whether it can also scroll in the other axis.
      @@ -398,7 +398,6 @@ Managing Overflow: the 'overflow-x', 'overflow-y', and 'overflow' properties
      There is no special handling of overflow, that is, the box’s content is rendered outside the box if positioned there. - The box is not a scroll container.
      hidden
      @@ -410,8 +409,7 @@ Managing Overflow: the 'overflow-x', 'overflow-y', and 'overflow' propertiesscroll container. + for example using the mechanisms defined in [[CSSOM-VIEW]].
      clip
      @@ -422,8 +420,7 @@ Managing Overflow: the 'overflow-x', 'overflow-y', and 'overflow' propertiesscroll container. + through any mechanism. Unlike ''hidden'', this value does not cause the element to establish a new formatting context. @@ -435,8 +432,8 @@ Managing Overflow: the 'overflow-x', 'overflow-y', and 'overflow' properties
      This value indicates that the content is clipped to the [=overflow clip edge=], - but can be scrolled into view - (and therefore the box is a scroll container). + but can be scrolled into view. + Furthermore, if the user agent uses a scrolling mechanism that is visible on the screen (such as a scroll bar or a panner), that mechanism should be displayed @@ -458,21 +455,28 @@ Managing Overflow: the 'overflow-x', 'overflow-y', and 'overflow' properties The ''overflow/scroll'', ''overflow/auto'', and ''overflow/hidden'' values - are known as the scrollable values of 'overflow'. + are known as the scrollable values of 'overflow'. + They cause the box to be a [=scroll container=] + and the affected axis to be a [=scrollable axis=]. + A [=block box=] that becomes a [=scroll container=] + also establishes an [=independent formatting context=]. + The ''overflow/visible'' and ''overflow/clip'' values are known as the non-scrollable values. + However, if the other axis specifies a [=scrollable value=], + a specified value of ''visible'' + [=computed value|computes=] to ''overflow/auto'', + enabling scrolling in its axis. + If neither axis computes to a [=scrollable value=], + the box is not a [=scroll container=]. + If only one axis computes to a [=scrollable value=] + (i.e. the other axis is ''overflow/clip''), + the box is a [=single-axis scroll container=]. - The ''visible''/''overflow/clip'' values of 'overflow' - compute to ''overflow/auto''/''hidden'' (respectively) - if one of 'overflow-x' or 'overflow-y' is neither ''visible'' nor ''overflow/clip''. On [=replaced elements=], a [=computed value|computed=] ''overflow/hidden'' value further resolves to a [=used value=] of ''overflow/clip''. - If the computed value of 'overflow' on a block box - is neither ''overflow/visible'' nor ''overflow/clip'' nor a combination thereof, - it [=establishes an independent formatting context=] for its contents. - User agents must also support the overlay keyword as a [=legacy value alias=] of ''overflow/auto''. @@ -1334,6 +1338,11 @@ ellipsis interaction with scrolling interfaces This appendix is informative. + Significant changes since the 7 October 2025 Working Draft: + * Allow combining ''overflow: clip'' behavior in one axis with scrolling in the other, + to allow single-axis trapping for e.g. [=sticky positioning=]. + (Issue 12289) + Significant changes since the 29 March 2023 Working Draft: * Define that ''overflow: hidden'' is treated as ''overflow: clip'' on [=replaced elements=]. From f764ae34b63b8b493f6511abfe5bfd927d13ae79 Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 8 May 2026 19:14:55 -0400 Subject: [PATCH 039/127] [css-overflow-3] Clarify effects of clipping on scrollable overflow #8607 --- css-overflow-3/Overview.bs | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/css-overflow-3/Overview.bs b/css-overflow-3/Overview.bs index 44f1310bd665..72f833032ea6 100644 --- a/css-overflow-3/Overview.bs +++ b/css-overflow-3/Overview.bs @@ -633,19 +633,19 @@ Expanding Clipping Bounds: the 'overflow-clip-margin' property

      Calculating the Scrollable Overflow Area

      - The scrollable overflow area of a [=scroll container=] is the union of: + The scrollable overflow area of a box is the union of:
      • - The [=scroll container=]’s own [=padding box=]. + Its own [=padding box=].
      • - All [=line boxes=] directly contained by the [=scroll container=]. + All [=line boxes=] it directly contains.
      • The border boxes of all boxes for which it is the containing block and whose border boxes are positioned not wholly - in the [=unreachable scrollable overflow region=], + within its [=unreachable scrollable overflow region=] (if any), accounting for transforms by projecting each box onto the plane of the element that establishes its 3D rendering context. [[!CSS3-TRANSFORMS]] @@ -671,17 +671,14 @@ Calculating the Scrollable Overflow Area
      • The scrollable overflow areas of all of the above boxes - (including zero-area boxes - and accounting for transforms as described above), - provided they themselves have ''overflow: visible'' - (i.e. do not themselves trap the overflow) - and that scrollable overflow is not already clipped - (e.g. by the 'clip' property or the 'contain' property). - - Note: The 'mask-*' properties [[!CSS-MASKING-1]] - do not affect the scrollable overflow area. + (including zero-area boxes), + clipped to their [=overflow clip edge=] + if 'overflow' is not ''overflow/visible'' or 'contain' applies ''contain/paint'', + and accounting for transforms as described above. - ISSUE(8607): Need to evaluate what should/should not clip [=scrollable overflow=]. + Note: The 'clip', 'clip-path', and 'mask-*' properties [[!CSS-MASKING-1]] + do not affect the scrollable overflow area. + Only effects that clip to the [=overflow clip edge=] are taken into account.
      • Additional padding added From 94d1c067304e80d462099e709ed9638d6d11c3d2 Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 8 May 2026 19:18:10 -0400 Subject: [PATCH 040/127] [css-overflow-3] Move note about transforms to clarify its intent --- css-overflow-3/Overview.bs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/css-overflow-3/Overview.bs b/css-overflow-3/Overview.bs index 72f833032ea6..1bdd2368ab22 100644 --- a/css-overflow-3/Overview.bs +++ b/css-overflow-3/Overview.bs @@ -218,11 +218,6 @@ Scrollable Overflow and that contains the scrollable overflow area. See [[#scrollable-overflow-calculation]] for details. - Note: The scrollable overflow rectangle is always a rectangle - in the box's own coordinate system, but might be non-rectangular - in other coordinate systems due to transforms [[CSS3-TRANSFORMS]]. - This means scrollbars can sometimes appear when not actually necessary. -

        Scrolling Overflow

        @@ -670,7 +665,7 @@ Calculating the Scrollable Overflow Area is therefore deferred in this draft.
      • - The scrollable overflow areas of all of the above boxes + The [=scrollable overflow rectangles=] of all of the above boxes (including zero-area boxes), clipped to their [=overflow clip edge=] if 'overflow' is not ''overflow/visible'' or 'contain' applies ''contain/paint'', @@ -680,6 +675,11 @@ Calculating the Scrollable Overflow Area do not affect the scrollable overflow area. Only effects that clip to the [=overflow clip edge=] are taken into account. + Note: The [=scrollable overflow rectangle=] is always a rectangle + in its box's own coordinate system, but might be non-rectangular + in ancestor coordinate systems due to transforms [[CSS3-TRANSFORMS]]. + This means scrollbars can sometimes appear when not actually necessary. +
      • Additional padding added to the [=scrollable overflow rectangle=] From 41ec95a8c5ea25f9c7190c1d2d625e947ee41924 Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 8 May 2026 19:24:31 -0400 Subject: [PATCH 041/127] [css-overflow-3] overflow only applies to replaced elements in L4 --- css-overflow-3/Overview.bs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/css-overflow-3/Overview.bs b/css-overflow-3/Overview.bs index 1bdd2368ab22..33bcc36480a4 100644 --- a/css-overflow-3/Overview.bs +++ b/css-overflow-3/Overview.bs @@ -468,14 +468,13 @@ Managing Overflow: the 'overflow-x', 'overflow-y', and 'overflow' propertiesoverlay keyword as a [=legacy value alias=] of ''overflow/auto''. + Note: The 'overflow' properties are expanded to apply to [=replaced elements=] + in Level 4. +

        Interaction of 'visibility' and 'overflow'

        From 53d6722b123cba9c9ac37e4ae1a78eb144ecd25f Mon Sep 17 00:00:00 2001 From: fantasai Date: Fri, 8 May 2026 19:31:25 -0400 Subject: [PATCH 042/127] [css-overflow-3] Clarify application to tables --- css-overflow-3/Overview.bs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/css-overflow-3/Overview.bs b/css-overflow-3/Overview.bs index 33bcc36480a4..5de3123cac55 100644 --- a/css-overflow-3/Overview.bs +++ b/css-overflow-3/Overview.bs @@ -124,6 +124,11 @@ Module Interactions and [[!CSS-UI-3]] section 5.2. Overflow Ellipsis: the text-overflow property. + When applied to 'display: table' elements, + the properties defined in this module apply to the [=table grid box=] + (not the [=table wrapper box=]). + [[!CSS2]] [[!CSS-TABLES-3]] +

        From 33de10f1de526c572619abf7f16eea99d55ac5a5 Mon Sep 17 00:00:00 2001 From: Chris Lilley Date: Wed, 27 May 2026 16:09:26 -0400 Subject: [PATCH 069/127] [selectors-4][editorial] WPT --- selectors-4/Overview.bs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/selectors-4/Overview.bs b/selectors-4/Overview.bs index 16519be82156..6d1d764b2a8c 100644 --- a/selectors-4/Overview.bs +++ b/selectors-4/Overview.bs @@ -1679,12 +1679,14 @@ The Relational Pseudo-class: '':has()''

        invalidation/defined-in-has.html invalidation/dir-pseudo-class-in-has.html invalidation/empty-pseudo-in-has.html + invalidation/empty-pseudo-in-has-display-none.html invalidation/fullscreen-pseudo-class-in-has.html invalidation/has-append-first-node.html invalidation/has-complexity.html invalidation/has-css-nesting-shared.html invalidation/has-in-adjacent-position.html invalidation/has-in-ancestor-position.html + invalidation/has-in-is-non-subject-compound.html invalidation/has-in-parent-position.html invalidation/has-in-sibling-position.html invalidation/has-invalidation-after-removing-non-first-element.html @@ -2956,6 +2958,7 @@ User Action Pseudo-classes active-toplayer-001.html + active-after-relayouts.html focus-within-toplayer-001.html hover-toplayer-001.html toplayer-transition-001.html @@ -3230,6 +3233,7 @@ Media Playback State: the '':playing'', '':paused'', and '':seeking'' pseudo-cla media/media-playback-state.html media/media-loading-state.sub.html + media/media-playing-paused-style-invalidation.html The :playing pseudo-class represents an element @@ -3416,6 +3420,7 @@ The '':enabled'' and '':disabled'' Pseudo-classes invalidation/enabled-disabled.html + invalidation/option-disabled-when-ancestor-changes.html pseudo-enabled-disabled.html @@ -3725,6 +3730,7 @@ Tree-Structural pseudo-classes selectors-empty-001.xml + invalidation/empty-pseudo-in-has-display-none.html The :empty pseudo-class represents From d4cdbfe4913cbddd8ac603245651c19d0c2ccb3a Mon Sep 17 00:00:00 2001 From: Chris Lilley Date: Wed, 27 May 2026 16:19:02 -0400 Subject: [PATCH 070/127] [selectors-4][editorial] Removed At Risk: the column combinator as it is now in Selectors 5. --- selectors-4/Overview.bs | 1 - 1 file changed, 1 deletion(-) diff --git a/selectors-4/Overview.bs b/selectors-4/Overview.bs index 6d1d764b2a8c..1c5b5d28cedc 100644 --- a/selectors-4/Overview.bs +++ b/selectors-4/Overview.bs @@ -23,7 +23,6 @@ Former Editor: Peter Linss Former Editor: John Williams Abstract: Selectors are patterns that match against elements in a tree, and as such form one of several technologies that can be used to select nodes in a document. Selectors have been optimized for use with HTML and XML, and are designed to be usable in performance-critical code. They are a core component of CSS (Cascading Style Sheets), which uses Selectors to bind style properties to elements in the document. Abstract: Selectors Level 4 describes the selectors that already exist in [[!SELECT]], and further introduces new selectors for CSS and other languages that may need them. -At Risk: the column combinator At Risk: [=user action pseudo-classes=] applying to non-[=tree-abiding pseudo-elements=] Ignored Terms: function token, Document, DocumentFragment, math, h1, shadow tree, querySelector(), quirks mode, button, a, span, object, p, div, q, area, link, label, input, html, em, li, ol, pre, CSS Value Definition Syntax Ignored Vars: identifier, i From c41c832335f2580d656831d27a2d18394106c470 Mon Sep 17 00:00:00 2001 From: Chris Lilley Date: Wed, 27 May 2026 16:37:07 -0400 Subject: [PATCH 071/127] [selectors-4][editorial] Update changes since Jan 2026 WD --- selectors-4/Overview.bs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/selectors-4/Overview.bs b/selectors-4/Overview.bs index 1c5b5d28cedc..5326c40b9371 100644 --- a/selectors-4/Overview.bs +++ b/selectors-4/Overview.bs @@ -5153,6 +5153,32 @@ while still preserving as much of the usefulness of '':visited'' as pos

        Changes

        +

        +Changes since the 22 January 2026 Working Draft +

        + + Significant changes since the + 22 January 2026 + Working Draft: + + * Used infra terminology for ascii case insentivity + ( Issue13427) + * Responded to review feedback on BCP 47 language codes + (Issue 13647) + * Added example showing the difference between general case-insensitivity + and strict ASCII case insensitivity + (Issue 13645) + * Defined language range as BCP 47 extended language range + (Issue 13646) + * Changed introductory :lang example from (zh, "*-hant") to (sr, "*-Cyrl") + (Issue 13644) + * Moved the column combinator to Selectors 5 + * Clarified that language codes must be well-formed to match + (Issue 8720) + * Reworded constraints on language ranges + (Issue 8720) + +

        Changes since the 11 November 2022 Working Draft

        From a346e6dc30f9cbd053515eac2944337921728c2a Mon Sep 17 00:00:00 2001 From: Chris Lilley Date: Wed, 27 May 2026 16:45:40 -0400 Subject: [PATCH 072/127] typo --- selectors-4/Overview.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selectors-4/Overview.bs b/selectors-4/Overview.bs index 5326c40b9371..b7ebb62786ae 100644 --- a/selectors-4/Overview.bs +++ b/selectors-4/Overview.bs @@ -5185,7 +5185,7 @@ Changes since the 11 November 2022 Working Draft Significant changes since the 11 November 2022 Working Draft: * Defined language range as BCP 47 extended language range - (Issue 13646>) + (Issue 13646) * Removed the at-risk status from '':read-write'' and '':has()'' * Added '':popover-open'' pseudo-class. (Issue 8637) From 4f2b1f13312d48dc362e4c37f3ce29cb7183c093 Mon Sep 17 00:00:00 2001 From: Chris Lilley Date: Wed, 27 May 2026 16:47:41 -0400 Subject: [PATCH 073/127] spelling --- selectors-4/Overview.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selectors-4/Overview.bs b/selectors-4/Overview.bs index b7ebb62786ae..3c66770acee6 100644 --- a/selectors-4/Overview.bs +++ b/selectors-4/Overview.bs @@ -5161,7 +5161,7 @@ Changes since the 22 January 2026 Working Draft 22 January 2026 Working Draft: - * Used infra terminology for ascii case insentivity + * Used infra terminology for ascii case insensitivity ( Issue13427) * Responded to review feedback on BCP 47 language codes (Issue 13647) From bb56a2074f3c36661fe82c15e0afb0453ccef86c Mon Sep 17 00:00:00 2001 From: Koji Ishii Date: Thu, 28 May 2026 17:23:41 +0900 Subject: [PATCH 074/127] [css-sizing-4] Update responsive-iframes-explainer.md (#13961) Replaced `X-Frame-Options` with `Content-Security-Policy` for the [feedback]. Also updated the CSS property to the resolved one. [feedback]: https://groups.google.com/a/chromium.org/g/blink-dev/c/zBx_uoW7jRQ/m/Ilm304IyBQAJ --- css-sizing-4/responsive-iframes-explainer.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/css-sizing-4/responsive-iframes-explainer.md b/css-sizing-4/responsive-iframes-explainer.md index a1c0912328f7..464487f10cb6 100644 --- a/css-sizing-4/responsive-iframes-explainer.md +++ b/css-sizing-4/responsive-iframes-explainer.md @@ -29,9 +29,9 @@ In general, there is a lot of demand for this feature, as evidenced by: ## Solution -The embedding document opts in via the `contain-intrinsic-size: from-element` CSS property on the `