<pre class='metadata'>
Title: CSS Box Alignment Module Level 3
Shortname: css-align
Level: 3
Group: csswg
Status: ED
Work Status: Refining
ED: https://drafts.csswg.org/css-align/
TR: https://www.w3.org/TR/css-align-3/
Editor: Elika J. Etemad / fantasai, Invited Expert, http://fantasai.inkedblade.net/contact, w3cid 35400
Editor: Tab Atkins Jr., Google, http://xanthir.com/contact/, w3cid 42199
Previous Version: https://www.w3.org/TR/2018/WD-css-align-3-20180830/
Previous Version: https://www.w3.org/TR/2018/WD-css-align-3-20180423/
Previous Version: https://www.w3.org/TR/2017/WD-css-align-3-20170906/
Previous Version: https://www.w3.org/TR/2017/WD-css-align-3-20170720/
Previous Version: https://www.w3.org/TR/2017/WD-css-align-3-20170515/
Previous Version: https://www.w3.org/TR/2017/WD-css-align-3-20170407/
Previous Version: https://www.w3.org/TR/2017/WD-css-align-3-20170215/
Previous Version: https://www.w3.org/TR/2016/WD-css-align-3-20160614/
Previous Version: https://www.w3.org/TR/2016/WD-css-align-3-20160519/
Previous Version: https://www.w3.org/TR/2014/WD-css-align-3-20141218/
Previous Version: https://www.w3.org/TR/2013/WD-css3-align-20130514/
Previous Version: https://www.w3.org/TR/2012/WD-css3-align-20120612/
Abstract: This module contains the features of <a href="https://www.w3.org/TR/CSS/">CSS</a> relating to the alignment of boxes within their containers in the various CSS box layout models: block layout, table layout, flex layout, and grid layout. (The alignment of text and inline-level content is defined in [[CSS-TEXT-3]] and [[CSS-INLINE-3]].)
Ignored Terms: table cell, stretch, scrollable overflow region, static position, static-position containing block, static positions
At Risk: ''[ first | last ]? baseline''
At Risk: the <<overflow-position>> keywords
At Risk: the scrollable-area safety trigger into ''safe'' mode when no <<overflow-position>> is specified
At Risk: the ''legacy'' keyword for 'justify-items'
At Risk: the effect of the <a>box alignment properties</a> on absolutely-positioned boxes with ''left/auto'' offsets
</pre>

<pre class=link-defaults>
spec:css2; type:property;
	text:vertical-align
	text:max-width
	text:max-height
	text:min-width
	text:min-height
spec:css-cascade-3; type:value; text:initial
spec:css-display-3; type:property; text:display
spec:css-flexbox-1; type:dfn;
	text:flex line
	text:static-position rectangle
spec:css-fonts-3; type:dfn; text:first available font
spec:css-grid-1; type:dfn;
	text:collapsed gutter
spec:css-inline-3; type:property;
	text:dominant-baseline
	text:alignment-baseline
spec:css-multicol-1; type:dfn;
	text:multi-column container
	text:column box
spec:css-overflow-3; type:dfn; text:scroll container
spec:css-position-3; type:property; text:left
spec:css-writing-modes-3; type:dfn; text:dominant baseline
spec:selectors-3; type:dfn; text:first formatted line
spec:css2; type:dfn; text:line box
</pre>

<style>
.issue th:first-child { text-align: left !important; }
[rowspan] > img { float: right; }
[rowspan] { vertical-align: middle; }
table small { display: block; }

table.align-details { width: 100%; }
.align-details th {
	font: inherit;
	font-style: italic;
	white-space: nowrap; width: 1em;
	vertical-align: baseline; }
.align-details td { vertical-align: baseline; }
</style>

<h2 id="intro">
Introduction</h2>

	CSS Levels 1 and 2 allowed for the alignment of text via 'text-align'
	and the alignment of blocks by balancing ''margin/auto'' margins.
	However, except in table cells,
	vertical alignment was not possible.
	As CSS adds further capabilities,
	the ability to align boxes in various dimensions becomes more critical.
	This module attempts to create a cohesive and common box alignment model to share among all of CSS.

	Note: The alignment of text and inline-level content is defined in [[CSS-TEXT-3]] and [[CSS-INLINE-3]].

	Note: This specification is not intended to change any of the behavior
	defined in <a href="https://www.w3.org/TR/CSS2/">CSS2.1</a>
	when the properties defined here are set to their initial values.
	If implementors or anyone else notices a discrepancy,
	please report this to the CSSWG as an error.

	<em>This section (above) is not normative.</em>

<h3 id="placement">
Module interactions</h3>

	This module adds some new alignment capabilities
	to the block layout model described in [[!CSS2]] <a href="https://www.w3.org/TR/CSS2/visuren.html">chapters 9</a>
	and <a href="https://www.w3.org/TR/CSS2/visudet.html">10</a>
	and defines the interaction of these properties
	with the alignment of table cell content using 'vertical-align',
	as defined in [[!CSS2]] <a href="https://www.w3.org/TR/CSS2/tables.html#height-layout">chapter 17</a>.

	The interaction of these properties with
	Grid Layout [[!CSS-GRID-1]]
	and Flexible Box Layout [[!CSS-FLEXBOX-1]]
	is defined in their respective modules.
	The property definitions here supersede those in [[!CSS-FLEXBOX-1]]
	(which have a smaller, earlier subset of permissible values).

	No properties in this module apply to the <code>::first-line</code>
	or <code>::first-letter</code> pseudo-elements.

<h3 id="values">
Values</h3>

	This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from [[!CSS2]].
	Value types not defined in this specification are defined in CSS Values & Units [[!CSS-VALUES-3]].
	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 <a>CSS-wide keywords</a> keywords as their property value.
	For readability they have not been repeated explicitly.

<h3 id="partial">
Partial Implementations</h3>

	Since it is expected that support for the features in this module
	will be deployed in stages corresponding to the various layout models affected,
	it is hereby clarified that
	the <a href="https://www.w3.org/TR/CSS/#partial">rules for partial implementations</a>
	that require treating as invalid any unsupported feature
	apply to any alignment keyword
	which is not supported across all layout modules to which it applies
	for layout models in which the implementation supports the property in general.

	For example,
	if an implementation supports 'align-self' in [[CSS-GRID-1]] and [[CSS-FLEXBOX-1]],
	then it must treat ''align-content/start'' as invalid
	unless it is supported in both grid and flex containers.
	However if that same implementation does not support 'align-self' for block-level elements at all,
	then a lack of implementation of ''align-self: start''
	does not trigger this requirement to treat it as invalid.

<h2 id="overview">
Overview of Alignment Properties</h2>

	The <dfn export>box alignment properties</dfn> in CSS are a set of 6 properties
	that control alignment of boxes within other boxes.
	They can be described along two axises:

	<ul>
		<li>which dimension they apply to ([=main axis|main=]/[=inline axis|inline=] vs. [=cross axis|cross=]/[=block axis|block=]), and
		<li>whether they control the position of the box within its parent, or the box's content within itself.
	</ul>

	Note: This specification uses the terms “justify” and “align” to distinguish
	between alignment in the main/inline and cross/block dimensions, respectively.
	The choice is somewhat arbitrary, but having the two terms allows for
	a consistent naming scheme that works across all of CSS's layout models
	(including [[css-flexbox-1#box-model]])

	The following table summarizes the <a>box alignment properties</a>
	and the display types they can apply to.

	<table class=data>
	<colgroup span=1></colgroup>
	<colgroup span=2></colgroup>
	<colgroup span=1></colgroup>
	<thead>
		<tr>
			<th>Common
			<th>Axis
			<th>Aligns
			<th>Applies to
	<tbody>
		<tr>
			<th>'justify-content'
			<td>main/inline
			<td rowspan=2>
				<img src="images/content-example.svg" width=106 height=106 alt="">
				content within element
				<small>(effectively adjusts padding)</small>
			<td rowspan=2>[=block containers=], <a>flex containers</a>, and <a>grid containers</a>
		<tr>
			<th>'align-content'
			<td>cross/block
	<tbody>
		<tr>
			<th>'justify-self'
			<td>inline
			<td rowspan=2>
				<img src="images/self-example.svg" width=106 height=106 alt="">
				element within parent
				<small>(effectively adjusts margins)</small>
			<td>block-level boxes, absolutely-positioned boxes, and <a>grid items</a>
		<tr>
			<th>'align-self'
			<td>cross/block
			<td>absolutely-positioned boxes, <a>flex items</a>, and <a>grid items</a>
	<tbody>
		<tr>
			<th>'justify-items'
			<td>inline
			<td rowspan=2>
				<img src="images/items-example.svg" width=106 height=106 alt="">
				items inside box
				<small>(controls child items&rsquo; ''align/justify-self: auto'')</small>
			<td>[=block containers=] and <a>grid containers</a>
		<tr>
			<th>'align-items'
			<td>cross/block
			<td><a>flex containers</a> and <a>grid containers</a>
	</table>

	Note: The '*-items' properties don't affect the element itself.
	When set on a container,
	they specify the interpretation of any ''*-self: auto'' used on children of the container element.

<h2 id='terms'>
Alignment Terminology</h2>

	Since this module defines alignment properties for all layout modes in CSS,
	some abstract terminology is introduced:

	<dl>
		<dt><dfn export>alignment subject</dfn>
		<dd>
			The <a>alignment subject</a> is the thing or things being aligned by the property.
			For 'justify-self' and 'align-self',
			the <a>alignment subject</a> is the margin box of the box the property is set on,
			and assumes the <a>writing mode</a> of that box.
			For 'justify-content' and 'align-content',
			the <a>alignment subject</a> is defined by the layout mode
			and refers to some aspect of its contents;
			it also assumes the <a>writing mode</a> of the box the property is set on.

		<dt><dfn export>alignment container</dfn>
		<dd>
			The <a>alignment container</a> is the rectangle that the <a>alignment subject</a> is aligned within.
			This is defined by the layout mode,
			but is usually the <a>alignment subject</a>’s containing block,
			and assumes the [=writing mode=] of the box establishing the containing block.

		<dt><dfn export>fallback alignment</dfn>
		<dd>
			Some alignments can only be fulfilled in certain situations
			or are limited in how much space they can consume;
			for example, ''space-between'' can only operate when there is more than one <a>alignment subject</a>,
			and baseline alignment, once fulfilled, might not be enough to absorb all the excess space.
			In these cases a fallback alignment takes effect
			(as defined below)
			to fully consume the excess space.
	</dl>

<h2 id='alignment-values'>
Alignment Keywords</h2>

	All of the alignment properties use a common set of keyword values,
	which are defined in this section.
	Keywords fall into three categories:

	<dl>
		<dt><a href="#positional-values">positional alignment</a>
		<dd>These keywords define alignment as an absolute position within the <a>alignment container</a>.

		<dt><a href="#baseline-values">baseline alignment</a>
		<dd>These keywords define alignment as a relationship
			among the baselines of multiple [=alignment subjects=] within an <a>alignment context</a>.

		<dt><a href="#distribution-values">distributed alignment</a>
		<dd>These keywords define alignment as a distribution of space among <a>alignment subjects</a>.
	</dl>

<h3 id='positional-values'>
Positional Alignment: the ''center'', ''start'', ''end'', ''self-start'', ''self-end'', ''flex-start'', ''flex-end'', ''left'', and ''right'' keywords</h3>

	The <dfn>positional alignment</dfn> keywords specify a position for an <a>alignment subject</a>
	with respect to its <a>alignment container</a>.

	Values have the following meanings:

	<dl dfn-type="value">
		<dt><dfn for="<self-position>, <content-position>">center</dfn> <small>([[#self-alignment|self]], [[#content-distribution|content]])</small>
		<dd>Centers the <a>alignment subject</a> within its <a>alignment container</a>.

		<dt><dfn for="<self-position>, <content-position>">start</dfn> <small>([[#self-alignment|self]], [[#content-distribution|content]])</small>
		<dd>Aligns the <a>alignment subject</a> to be flush with the <a>alignment container</a>’s start edge in the appropriate axis.

		<dt><dfn for="<self-position>, <content-position>">end</dfn> <small>([[#self-alignment|self]], [[#content-distribution|content]])</small>
		<dd>Aligns the <a>alignment subject</a> to be flush with the <a>alignment container</a>’s end edge in the appropriate axis.

		<dt><dfn for="<self-position>">self-start</dfn> <small>([[#self-alignment|self]])</small>
		<dd>Aligns the <a>alignment subject</a> to be flush with the edge of the <a>alignment container</a>
			corresponding to the <a>alignment subject</a>’s start side in the appropriate axis.

		<dt><dfn for="<self-position>">self-end</dfn> <small>([[#self-alignment|self]])</small>
		<dd>Aligns the <a>alignment subject</a> to be flush with the edge of the <a>alignment container</a>
			corresponding to the <a>alignment subject</a>’s end side in the appropriate axis.

		<dt><dfn for="<self-position>, <content-position>">flex-start</dfn> <small>([[#self-alignment|self]], [[#content-distribution|content]])</small>
		<dd><strong>Only used in flex layout.</strong> [[!CSS-FLEXBOX-1]]
			Aligns the <a>alignment subject</a> to be flush with the edge of the <a>alignment container</a>
			corresponding to the <a>flex container</a>’s main-start or cross-start side, as appropriate.

			When used outside of a <a>flex formatting context</a>, this value behaves as ''start''.
			That is, on boxes that are not <a>flex items</a>
			(or pretending to be <a>flex items</a>,
			such as when determining the static position of an absolutely-positioned box
			that is a child of a <a>flex container</a>),
			this value behaves as ''start'' when used in the <a>self-alignment properties</a>,
			and on boxes that are not <a>flex containers</a>,
			this value behaves as ''start'' when used in the <a>content-distribution properties</a>.

		<dt><dfn for="<self-position>, <content-position>">flex-end</dfn> <small>([[#self-alignment|self]], [[#content-distribution|content]])</small>
		<dd><strong>Only used in flex layout.</strong>
			Aligns the <a>alignment subject</a> to be flush with the edge of the <a>alignment container</a>
			corresponding to the <a>flex container</a>’s main-end or cross-end side, as appropriate.

			When used outside of a <a>flex formatting context</a>, this value behaves as ''end''.
			That is, on boxes that are not <a>flex items</a>
			(or pretending to be <a>flex items</a>,
			such as when determining the static position of an absolutely-positioned box
			that is a child of a <a>flex container</a>),
			this value behaves as ''end'' when used in the <a>self-alignment properties</a>,
			and on boxes that are not <a>flex containers</a>,
			this value behaves as ''end'' when used in the <a>content-distribution properties</a>.

		<dt><dfn for="justify-content, justify-self, justify-items">left</dfn> <small>(only 'justify-*')</small>
		<dd>Aligns the <a>alignment subject</a> to be flush with
			the <a>alignment container</a>’s <a href="https://www.w3.org/TR/css3-writing-modes/#line-left">line-left</a>
			or <a>physical left</a> edge,
			whichever is in the appropriate axis.

			If the property's axis is not parallel with either left↔right axis,
			this value behaves as ''start''.
			<span class=note>Currently, the only case where the property's axis
			is not parallel with either left↔right axis
			is in a column flexbox.</span>

		<dt><dfn for="justify-content, justify-self, justify-items">right</dfn> <small>(only 'justify-*')</small>
		<dd>Aligns the <a>alignment subject</a> to be flush with
			the <a>alignment container</a>’s <a href="https://www.w3.org/TR/css3-writing-modes/#line-right">line-right</a>
			or <a>physical right</a> edge,
			whichever is in the appropriate axis.

			If the property's axis is not parallel with either left↔right axis,
			this value behaves as ''start''.
			<span class=note>Currently, the only case where the property's axis
			is not parallel with either left↔right axis
			is in a column flexbox.</span>
	</dl>

	Two grammar terms are used to denote certain subsets of these values:

	<dl>
		<dt><<self-position>>
		<dd>
			This set is used by 'justify-self' and 'align-self'
			to align the box within its <a>alignment container</a>,
			and also by 'justify-items' and 'align-items'
			(to specify default values for 'justify-self' and 'align-self').
			<pre class='prod'>
				<dfn>&lt;self-position></dfn> = center | start | end | self-start | self-end |
								flex-start | flex-end
			</pre>
		<dt><<content-position>>
		<dd>
			This set is used by 'justify-content' and 'align-content'
			to align the box's contents within itself.

			<pre class='prod'>
				<dfn>&lt;content-position></dfn> = center | start | end | flex-start | flex-end
			</pre>
	</dl>

	Note: ''left'' and ''right'' are excluded from <<self-position>> and <<content-position>>,
	despite being valid [=positional alignment=] values for 'justify-content'/'justify-self'/'justify-items',
	because they are not allowed in the 'align-*' properties.
	They are instead explicitly included in the 'justify-*' properties’ grammars.

	<aside class=example>
		The ''<self-position>/start'' and ''<self-position>/end'' keywords
		are <a>flow-relative</a>:
		they use the <a>writing mode</a> to determine which side to align to.

		<figure>
			<img src="images/start-inline-tb.svg"
			     style="background: white; padding: 8px;"
			     title="inline-axis 'start' alignment in various writing systems"
			     alt="Inline-axis 'start' alignment:
			     Horizontal Latin and Chinese are left-aligned,
			     while Arabic and Hebrew are right-aligned.">
			<img src="images/end-inline-tb.svg"
			     style="background: white; padding: 8px;"
			     title="inline-axis 'end' alignment in various writing systems"
			     alt="Inline-axis 'end' alignment:
			     Horizontal Latin and Chinese are right-aligned,
			     while Arabic and Hebrew are left-aligned.">
			<figcaption>
				''<self-position>/start'' vs ''<self-position>/end'' in the <a>inline axis</a>
				(<a href="#flexbox-exception">typically<sup>†</sup></a> 'justify-*')
			</figcaption>
		</figure>

		The ''<self-position>/left'' and ''<self-position>/right'' keywords
		are absolute (not <a>flow-relative</a>).

		<figure>
			<img src="images/left-inline-tb.svg"
			     style="background: white; padding: 8px;"
			     title="'left' alignment in various writing systems"
			     alt="Inline-axis 'left' alignment:
			     Horizontal text is left-aligned, regardless of writing system.">
			<img src="images/right-inline-tb.svg"
			     style="background: white; padding: 8px;"
			     title="'right' alignment in various writing systems"
			     alt="Inline-axis 'right' alignment:
			     Horizontal text is right-aligned, regardless of writing system.">
			<figcaption>
				''<self-position>/left'' vs ''<self-position>/right''
			</figcaption>
		</figure>

		The ''<self-position>/start'' and ''<self-position>/end'' keywords
		have meaning in both the <a lt="inline axis">inline</a> and <a lt="block axis">block</a> axes:
		''<self-position>/start'' always orients to the start of the text
		(top left for left-to-right/top-to-bottom languages like English)
		while ''<self-position>/end'' always orients to the end of the text.

		<figure>
			<img src="images/start-block-tb.svg"
			     style="background: white; padding: 8px; padding-bottom: calc(8px + 23px);"
			     title="block-axis 'start' alignment in various writing systems"
			     alt="Block-axis 'start' alignment:
			     Horizontal text is top-aligned in the vertical axis.">
			<img src="images/end-block-tb.svg"
			     style="background: white; padding: 8px; padding-top: calc(8px + 23px);"
			     title="block-axis 'end' alignment in various writing systems"
			     alt="Block-axis 'bottom' alignment:
			     Horizontal text is bottom-aligned in the vertical axis.">
			<figcaption>
				''<self-position>/start'' vs ''<self-position>/end'' in the <a>block axis</a>
				(<a href="#flexbox-exception">typically<sup>†</sup></a> 'align-*')
			</figcaption>
		</figure>

		The ''<self-position>/start'' and ''<self-position>/end'' keywords
		use the <a>writing mode</a> of the <a>alignment container</a>,
		to help keep things consistent.
		But if alignment using the <a>alignment subject</a>’s <a>writing mode</a> is needed,
		the ''<self-position>/self-start'' and ''<self-position>/self-end'' keywords can be used.

		<figure>
			<img src="images/self-v-context-start-tb.svg"
			     style="background: white; padding: 8px;"
			     title="inline-axis 'start' alignment with LTR context"
			     alt="Inline-axis 'start' alignment in an LTR container:
			     Alignment uses the context’s start direction, so
			     the (RTL) Arabic and Hebrew items
			     are left-aligned alongside the (LTR) Latin and Chinese.">
			<img src="images/self-v-context-self-start-tb.svg"
			     style="background: white; padding: 8px;"
			     title="inline-axis 'self-start' alignment with LTR context"
			     alt="Inline-axis 'self-start' alignment in an LTR container:
			     Horizontal Latin and Chinese items are right-aligned,
			     while Arabic and Hebrew items are left-aligned.">
			<figcaption>
				''<self-position>/start'' vs ''<self-position>/self-start'' on the individual items
			</figcaption>
		</figure>
	</aside>

	<aside class=example>
		The behavior of the alignment keywords is analogous in <a>vertical writing modes</a>:
		''<self-position>/start'' and ''<self-position>/end''
		are relative to the start/end of the text in the relevant axis.
		The ''<self-position>/left'' and ''<self-position>/right'' keywords
		are interpreted as <a>line-left</a> and <a>line-right</a>,
		relative to the “left” and “right” sides of LTR/RTL text.

		<figure>
			<img src="images/start-inline-rl.svg"
			     style="background: white; padding: 8px;"
			     title="inline-axis 'start' alignment in various writing systems"
			     alt="Inline-axis 'start' alignment in vertical-rl writing:
			     Vertical Latin and Chinese are top-aligned,
			     while Arabic and Hebrew are bottom-aligned.">
			<img src="images/end-inline-rl.svg"
			     style="background: white; padding: 8px;"
			     title="inline-axis 'end' alignment in various writing systems"
			     alt="Inline-axis 'end' alignment in vertical-rl writing:
			     Vertical Latin and Chinese are top-aligned,
			     while Arabic and Hebrew are bottom-aligned.">
			<figcaption>
				''<self-position>/start'' vs ''<self-position>/end'' in the <a>inline axis</a>
				(<a href="#flexbox-exception">typically<sup>†</sup></a> 'justify-*')
			</figcaption>
		</figure>

		<figure>
			<img src="images/left-inline-rl.svg"
			     style="background: white; padding: 8px; padding-bottom: calc(8px + 23px);"
			     title="'left' alignment in various writing systems"
			     alt="Inline-axis 'left' alignment in vertical-rl writing:
			     Vertical text is top-aligned, regardless of writing system.">
			<img src="images/right-inline-rl.svg"
			     style="background: white; padding: 8px; padding-top: calc(5px + 23px); padding-bottom: 5px;"
			     title="'right' alignment in various writing systems"
			     alt="Inline-axis 'right' alignment in vertical-rl writing:
			     Vertical text is bottom-aligned, regardless of writing system.">
			<figcaption>
				''<self-position>/left'' vs ''<self-position>/right''
			</figcaption>
		</figure>

		<figure>
			<img src="images/start-block-rl.svg"
			     style="background: white; padding: 8px;"
			     title="block-axis 'start' alignment in various writing systems"
			     alt="Block-axis 'start' alignment in vertical-rl writing:
			     Vertical text is top-aligned in the vertical axis.">
			<img src="images/end-block-rl.svg"
			     style="background: white; padding: 8px;"
			     title="block-axis 'end' alignment in various writing systems"
			     alt="Block-axis 'bottom' alignment in vertical-rl writing:
			     Vertical text is bottom-aligned in the vertical axis.">
			<figcaption>
				''<self-position>/start'' vs ''<self-position>/end'' in the <a>block axis</a>
				(<a href="#flexbox-exception">typically<sup>†</sup></a> 'align-*')
			</figcaption>
		</figure>

		<figure>
			<img src="images/self-v-context-start-rl.svg"
			     style="background: white; padding: 8px; padding-bottom: calc(8px + 30px);"
			     title="inline-axis 'start' alignment with LTR context"
			     alt="Inline-axis 'start' alignment in a vertical-rl LTR container:
			     Alignment uses the context’s start direction, so
			     the (RTL) Arabic and Hebrew items
			     are top-aligned alongside the (LTR) Latin and Chinese.">
			<img src="images/self-v-context-self-start-rl.svg"
			     style="background: white; padding: 8px;"
			     title="inline-axis 'self-start' alignment with LTR context"
			     alt="Inline-axis 'self-start' alignment in a vertical-rl LTR container:
			     Horizontal Latin and Chinese items are top-aligned,
			     while Arabic and Hebrew items are bottom-aligned.">
			<figcaption>
				''<self-position>/start'' vs ''<self-position>/self-start'' on the individual items
			</figcaption>
		</figure>
	</aside>

	<div class=note id=flexbox-exception>
		For most layout models (block, table, grid, etc),
		the 'justify-*' properties always align things in the <a>inline axis</a>,
		while the 'align-*' properties always align things in the <a>block axis</a>.

		Flexbox, on the other hand, has 'justify-*' align things in the <a>main axis</a>
		and 'align-*' align things in the <a>cross axis</a>.
		This depends on the value of 'flex-direction':
		when 'flex-direction' is ''flex-direction/row'' or ''flex-direction/row-reverse'',
		it matches the other layout modes
		(<a>inline axis</a> with 'justify-*', <a>block axis</a> with 'align-*');
		when 'flex-direction' is ''flex-direction/column'' or ''flex-direction/column-reverse'',
		it has the opposite correspondence.
	</div>

	<p class='issue'>
		Make it easier to understand the dual-axis nature of "start" and "end" wrt orthogonal flows.

<h3 id='baseline-values'>
Baseline Alignment: the ''baseline'' keyword and ''first''/''last'' modifiers</h3>

	See [[css-writing-modes-3#intro-baselines]].

	<dfn export>Baseline alignment</dfn> is a form of positional alignment
	that aligns multiple <a>alignment subjects</a>
	within a <a>shared alignment context</a>
	(such as cells within a row)
	by matching up their <a>alignment baselines</a>.
	If the position of the <a>alignment subjects</a> within a <a>baseline-sharing group</a>
	is not fully constrained by <a>baseline alignment</a>
	(i.e., they could be shifted within their respective <a>alignment containers</a>
	while maintaining baseline-alignment),
	they are [=fallback alignment|fallback-aligned=] insofar as possible while preserving their <a>baseline alignment</a>.

	The baseline alignment keywords are represented with the <<baseline-position>> grammar term:

	<pre class='prod'>
		<dfn>&lt;baseline-position></dfn> = [ first | last ]? baseline
	</pre>

	The ''first'' and ''last'' values give a box a <dfn export>baseline alignment preference</dfn>:
	either “first” or “last”, respectively,
	defaulting to “first”.

	Values have the following meanings:

	<dl dfn-type=value dfn-for="justify-self, justify-items, align-content, align-self, align-items, <baseline-position>">
		<dt><dfn>baseline</dfn>
		<dd>
			Computes to ''first baseline'', defined below.

		<dt><dfn lt="first baseline | first">first baseline</dfn>
		<dd>
			Specifies participation in <dfn dfn for export>first-baseline alignment</dfn>:
			aligns the <a>alignment baseline</a> of the box's <a>first baseline set</a>
			with the corresponding baseline
			of its [=baseline-sharing group=].
			See [[#align-by-baseline]] for more details.

			The <a>fallback alignment</a> for ''first baseline'' is
			''safe self-start'' (for [=self-alignment=])
			or ''safe start'' (for [=content-distribution=]).

		<dt><dfn lt="last baseline | last">last baseline</dfn>
		<dd>
			Specifies participation in <dfn dfn for export>last-baseline alignment</dfn>:
			aligns the <a>alignment baseline</a> of the box's <a>last baseline set</a>
			with the corresponding baseline
			of its [=baseline-sharing group=].̣
			See [[#align-by-baseline]] for more details.

			The <a>fallback alignment</a> for ''last baseline'' is
			''safe self-end'' (for [=self-alignment=])
			or ''safe end'' (for [=content-distribution=]).
	</dl>

	When specified for 'align-content',
	these values trigger <a>baseline content-alignment</a>,
	shifting the content of the box within its content box,
	and may also affect the sizing of the box itself.
	See [[#baseline-align-content]].

	When specified for 'align-self'/'justify-self',
	these values trigger <a>baseline self-alignment</a>,
	shifting the entire box within its container,
	which may affect the sizing of its container.
	See [[#baseline-align-self]].

	If both <a>baseline content-alignment</a> <em>and</em> <a>baseline self-alignment</a> are specified in the same axis on the same box,
	only <a>baseline self-alignment</a> is honored in that axis;
	the content-alignment in that axis must be treated as ''start''.

	<p class='issue'>Add example images here.

	If a box does not belong to a <a>shared alignment context</a>,
	then the <a>fallback alignment</a> is used.
	For example, ''align-content: baseline'' on a block box
	falls back to ''align-content/start'' alignment.
	The [=fallback alignment=] is also used to align the [=baseline-sharing group=]
	within its [=alignment container=].

	Note: Because they are equivalent, and ''baseline'' is shorter,
	the CSSOM serializes ''first baseline'' as ''baseline''.
	See [[cssom-1#serializing-css-values]].

	Note: For the somewhat-related 'vertical-align' property,
	due to inconsistent design decisions in CSS2.1,
	''baseline'' is not equivalent to ''first baseline''
	as an inline-level box’s <a>baseline alignment preference</a> depends on 'display'.
	(E.g., ''inline-block'' uses its last baseline by default,
	while ''inline-table'' uses its first baseline by default.)

<h3 id='distribution-values'>
Distributed Alignment: the ''<content-distribution>/stretch'', ''space-between'', ''space-around'', and ''space-evenly'' keywords</h3>

	The <dfn export>distributed alignment</dfn> values are used by 'justify-content' and 'align-content'
	to disperse a container’s extra space among its <a>alignment subjects</a>.

	<figure>
		<img src="images/distribute.svg" alt="space-between | space-around | space-evenly | stretch">
		<figcaption>The <a>distributed alignment</a> values</figcaption>
	</figure>

	When space cannot be distributed in this way,
	these values behave as their <a>fallback alignment</a>.
	Each distribution value has an associated default <a>fallback alignment</a>.
	(A future level of this module may allow the <a>fallback alignment</a> to be specified explicitly.)

	<dl dfn-type="value" dfn-for="align-content, justify-content, <content-distribution>">
		<dt><dfn>space-between</dfn>
		<dd>
			The <a>alignment subjects</a> are evenly distributed in the <a>alignment container</a>.
			The first <a>alignment subject</a> is placed flush with the start edge of the <a>alignment container</a>,
			the last <a>alignment subject</a> is placed flush with the end edge of the <a>alignment container</a>,
			and the remaining <a>alignment subjects</a> are distributed so that the spacing between any two adjacent <a>alignment subjects</a> is the same.

			<figure>
				<img src="images/space-between.svg"
				     alt="For example, given three items, all excess space is split in two and distributed: one half between the first two and one half between the last two items.">
			</figure>

			The default [=fallback alignment=] for this value is ''flex-start''.
			<span class='note'>(For layout modes other than flex layout, ''flex-start'' is identical to ''start''.)</span>

		<dt><dfn>space-around</dfn>
		<dd>
			The <a>alignment subjects</a> are evenly distributed in the <a>alignment container</a>,
			with a half-size space on either end.
			The <a>alignment subjects</a> are distributed so that the spacing between any two adjacent <a>alignment subjects</a> is the same,
			and the spacing before the first and after the last <a>alignment subject</a> is half the size of the other spacing.

			<figure>
				<img src="images/space-around.svg"
				     alt="For example, given three items, all excess space is split into sixths and distributed: one sixth at the start, one at the end, and two sixths (one third) each between the first two and between the last two items.">
			</figure>

			The default [=fallback alignment=] for this value is ''center''.

		<dt><dfn>space-evenly</dfn>
		<dd>
			The <a>alignment subjects</a> are evenly distributed in the <a>alignment container</a>,
			with a full-size space on either end.
			The <a>alignment subjects</a> are distributed so that the spacing between any two adjacent <a>alignment subjects</a>,
			before the first <a>alignment subject</a>,
			and after the last <a>alignment subject</a>
			is the same.

			<figure>
				<img src="images/space-evenly.svg"
				     alt="For example, given three items, all excess space is split into fourths and distributed: to the start, to the end, to between the first two, and to between the last two items.">
			</figure>

			The default [=fallback alignment=] for this value is ''center''.

		<dt><dfn>stretch</dfn>
		<dd>
			If the combined size of the <a>alignment subjects</a> is less than the size of the <a>alignment container</a>,
			any <css>auto</css>-sized <a>alignment subjects</a> have their size increased equally (not proportionally),
			while still respecting the constraints imposed by 'max-height'/'max-width'
			(or equivalent functionality),
			so that the combined size exactly fills the <a>alignment container</a>.

			<figure>
				<img src="images/space-stretch.svg"
				     alt="For example, given three items, all excess space is split into thirds and distributed: one third to each item.">
			</figure>

			The default [=fallback alignment=] for this value is ''flex-start''.
			<span class='note'>(For layout modes other than flex layout, ''flex-start'' is identical to ''start''.)</span>
	</dl>

	These values are represented with the <<content-distribution>> grammar term:

	<pre class='prod'><dfn>&lt;content-distribution></dfn> = space-between | space-around | space-evenly | stretch</pre>

<h3 id='overflow-values'>
Overflow Alignment: the ''safe'' and ''unsafe'' keywords and scroll safety limits</h3>

	When the <a>alignment subject</a> is larger than the <a>alignment container</a>,
	it will overflow.
	Some alignment modes, if honored in this situation,
	may cause data loss:
	for example, if the contents of a sidebar are centered,
	when they overflow they may send part of their boxes past the viewport's start edge,
	which can't be scrolled to.

	<div class='example'>
		The figure below illustrates the difference in “safe” versus “unsafe” centering,
		using a column flexbox as an example:

		<figure>
			<style>
			.cross-auto-figure > div {
				margin: 0 auto;
				width: 70px;
				background: #888;
				padding: 0 .5em;
				border-radius: 1em;
				border: 1px solid transparent;
			}
			.cross-auto-figure > div > div {
				border-spacing: 0;
				display: table;
				background: #ddd;
				color: black;
				text-align: center;
				margin: .5em auto;
				padding: .5em;
				border-radius: .5em;
			}
			</style>
			<div style="display:table; margin: 0 auto 1em;">
				<div style="display:table-cell; padding-right: 50px;" class='cross-auto-figure'>
					<div>
						<div>About</div>
						<div style="white-space: nowrap; margin-left: -31px;">Authoritarianism</div>
						<div>Blog</div>
					</div>
				</div>
				<div style="display:table-cell; padding-left: 50px;" class='cross-auto-figure'>
					<div>
						<div>About</div>
						<div style="white-space: nowrap;">Authoritarianism</div>
						<div>Blog</div>
					</div>
				</div>
			</div>
			<figcaption>
				The items in the figure on the right all strictly centered,
				even if the one that is too long to fit overflows on both sides,
				while those in the figure on the left are centered unless they overflow,
				in which case all the overflow goes off the end edge.
				If the container was placed
				against the left edge of the page,
				the “safe” behavior would be more desirable,
				as the long item would be fully readable,
				rather than clipped by the left edge of the screen.
				In other circumstances,
				the “unsafe” centering behavior might be better,
				as it correctly centers all the items.
			</figcaption>
		</figure>
	</div>

	To control this situation,
	an <dfn export>overflow alignment</dfn> mode can be explicitly specified.
	“Unsafe” alignment honors the specified alignment mode in overflow situations, even if it causes data loss,
	while “safe” alignment changes the alignment mode in overflow situations in an attempt to avoid data loss.
	The default behavior is to contain the alignment subject within the scrollable area,
	though at the time of writing this safety feature is not yet implemented.

	<pre class='prod'><dfn>&lt;overflow-position></dfn> = unsafe | safe</pre>

	<dl dfn-type="value" dfn-for="<overflow-position>">
		<dt><dfn>safe</dfn>
		<dd>
			If the size of the <a>alignment subject</a> overflows the <a>alignment container</a>,
			the <a>alignment subject</a> is instead aligned as if the alignment mode were ''start''.

		<dt><dfn>unsafe</dfn>
		<dd>
			Regardless of the relative sizes of the <a>alignment subject</a> and <a>alignment container</a>,
			the given alignment value is honored.

		<dt>(no value specified)
		<dd>
			If the <a>overflow alignment</a> isn't explicitly specified,
			the default <a>overflow alignment</a> is a blend of “safe” and “unsafe”
			in that an overflowing <a>alignment subject</a> is allowed to overflow its <a>alignment container</a>,
			but if this would cause it to also overflow
			the <a>scrollable overflow region</a> of its nearest ancestor <a>scroll container</a>
			(thus extending into the “unscrollable” region),
			then its overflow in that direction is limited
			by biasing any remaining overflow to the opposite side.

			Issue: It may not be Web-compatible to implement the “smart” default behavior
			(though we hope so, and believe it to be likely),
			so UAs should pass any feedback on this point to the WG.
			UAs that have not implemented the “smart” default behavior
			must behave as ''unsafe''.
	</dl>


<!--
                   ██████   ███████  ██    ██ ████████ ████████ ██    ██ ████████
 ██   ██          ██    ██ ██     ██ ███   ██    ██    ██       ███   ██    ██
  ██ ██           ██       ██     ██ ████  ██    ██    ██       ████  ██    ██
█████████ ███████ ██       ██     ██ ██ ██ ██    ██    ██████   ██ ██ ██    ██
  ██ ██           ██       ██     ██ ██  ████    ██    ██       ██  ████    ██
 ██   ██          ██    ██ ██     ██ ██   ███    ██    ██       ██   ███    ██
                   ██████   ███████  ██    ██    ██    ████████ ██    ██    ██
-->

<h2 id='content-distribution'>
Content Distribution: Aligning a Box’s Contents Within Itself</h2>

	<dfn export id="content-distribute">Content-distribution</dfn> controls alignment of the box's content within its content box.
	It is specified by the <dfn export>content-distribution properties</dfn> 'align-content' and 'justify-content'
	(and their 'place-content' shorthand).

	<div class="figure">
		<img alt="Diagram showing that the alignment of the content within the element is affected." src="images/content-example.svg" width=212 height=212>
	</div>

<h3 id='align-justify-content'>
The 'justify-content' and 'align-content' Properties</h3>

	<pre class="propdef">
	Name: align-content
	Value: normal | <<baseline-position>> |  <<content-distribution>> | <<overflow-position>>? <<content-position>>
	Initial: normal
	Applies to: block containers, multicol containers, flex containers, and grid containers
	Inherited: no
	Percentages: n/a
	Computed value: specified keyword(s)
	Animation type: discrete
	</pre>

	<pre class="propdef">
	Name: justify-content
	Value: normal | <<content-distribution>> | <<overflow-position>>? [ <<content-position>> | left | right ]
	Initial: normal
	Applies to: multicol containers, flex containers, and grid containers
	Inherited: no
	Percentages: n/a
	Computed value: specified keyword(s)
	Animation type: discrete
	</pre>

	Aligns the contents of the box as a whole (as the <a>alignment subject</a>)
	within the box itself (as the <a>alignment container</a>):
	along the inline/row/main axis of the box (for 'justify-content')
	or the block/column/cross axis of the box (for 'align-content').
	Values other than <dfn value for="justify-content, align-content">normal</dfn> are defined in [[#alignment-values]], above.

	For all layout modes,
	the <a>alignment subject</a> and <a>alignment container</a>
	both assume the <a>writing mode</a> of the box the '*-content' property is set on.

### Block Containers (Including Table Cells)### {#distribution-block}

	<table class="data align-details">
		<tr>
			<th><a>Alignment Container</a>
			<td>
				The <a>block container</a>’s content box.
		<tr>
			<th><a lt="alignment subject">Alignment Subject(s)</a>
			<td>
				The entire contents of the block, as a unit.
		<tr>
			<th>'align-content' Axis
			<td>
				The <a>block axis</a>.
				If a <<content-distribution>> is specified
				its <a>fallback alignment</a> is used instead.
		<tr>
			<th>'justify-content' Axis
			<td>
				Does not apply to and has no effect on <a>block containers</a>.
		<tr>
			<th>''justify-content/normal'' Behavior
			<td>
				All values other than ''justify-content/normal'' force the block container to [=establish an independent formatting context=].

				For table cells, the behavior of the ''justify-content/normal'' depends on the computed value of 'vertical-align':
				''vertical-align/top'' makes it behave as ''start'',
				''vertical-align/middle'' makes it behave as ''center'',
				''vertical-align/bottom'' makes it behave as ''end'',
				and all other values make it behave as ''baseline''.
				[[!CSS2]]

				''justify-content/normal'' otherwise behaves as ''start''.
	</table>

### Multicol Containers ### {#distribution-multicol}

	<table class="data align-details">
		<tr>
			<th><a>Alignment Container</a>
			<td>
				The <a>multi-column container</a>’s content box.
		<tr>
			<th><a lt="alignment subject">Alignment Subject(s)</a>
			<td>
				The column boxes,
				with any spacing inserted between column boxes
				added to the relevant column gaps.
		<tr>
			<th>'align-content' Axis
			<td>
				The <a>block axis</a>,
				treating the column boxes
				(and any column-spanning elements),
				as a singular unit.
				If a <<content-distribution>> is specified
				its <a>fallback alignment</a> is used instead.
		<tr>
			<th>'justify-content' Axis
			<td>
				The <a>inline axis</a>.
		<tr>
			<th>''justify-content/normal'' Behavior
			<td>
				''justify-content/normal'' behaves as ''justify-content/stretch'';
				both are defined as described in the column-sizing rules
				of [[!CSS-MULTICOL-1]].

				In the case of multi-column containers with a non-''column-width/auto'' 'column-width',
				'justify-content' values other than ''justify-content/normal'' or ''justify-content/stretch''
				cause the columns to take their specified 'column-width'
				rather than stretching to fill the container.
				The column boxes are then aligned as specified by 'justify-content'.
	</table>

### Flex Containers ### {#distribution-flex}

	<table class="data align-details">
		<tr>
			<th><a>Alignment Container</a>
			<td>
				The <a>flex container</a>’s content box.
		<tr>
			<th><a lt="alignment subject">Alignment Subject(s)</a>
			<td>
				For 'justify-content',
				the <a>flex items</a> in each <a>flex line</a>.

				For 'align-content',
				the <a>flex lines</a>.
				Note, this only has an effect on <a>multi-line flex containers</a>.
		<tr>
			<th>'align-content' Axis
			<td>
				The <a>cross axis</a>.
		<tr>
			<th>'justify-content' Axis
			<td>
				The 'justify-content' property applies along the <a>main axis</a>,
				but since stretching in the <a>main axis</a> is controlled by 'flex',
				''<content-distribution>/stretch'' behaves as ''flex-start''.
		<tr>
			<th>''justify-content/normal'' Behavior
			<td>
				''justify-content/normal'' behaves as ''<content-distribution>/stretch''.
	</table>

	See [[!CSS-FLEXBOX-1]] for details.

### Grid Containers ### {#distribution-grid}

	<table class="data align-details">
		<tr>
			<th><a>Alignment Container</a>
			<td>
				The <a>grid container</a>’s content box.
		<tr>
			<th><a lt="alignment subject">Alignment Subject(s)</a>
			<td>
				The <a>grid tracks</a> in the appropriate axis,
				with any spacing inserted between tracks
				added to the relevant <a>gutters</a>,
				and treating <a>collapsed gutters</a>
				as a single opportunity for space insertion.
		<tr>
			<th>'align-content' Axis
			<td>
				The <a>block axis</a>,
				aligning the <a>grid rows</a>.
		<tr>
			<th>'justify-content' Axis
			<td>
				The <a>inline axis</a>,
				aligning the <a>grid columns</a>.
		<tr>
			<th>''justify-content/normal'' Behavior
			<td>
				''justify-content/normal'' behaves as ''justify-content/stretch''.
	</table>

	See [[!CSS-GRID-1]] for details.

<h3 id='place-content'>
Content-Distribution Shorthand: the 'place-content' property</h3>

	<pre class="propdef">
	Name: place-content
	Value: <<'align-content'>> <<'justify-content'>>?
	Initial: normal
	Applies to: block containers, flex containers, and grid containers
	Inherited: no
	Percentages: n/a
	Computed value: see individual properties
	Animation type: discrete
	</pre>

	This <a>shorthand property</a> sets both the 'align-content' and 'justify-content' properties in one declaration.
	The first value is assigned to 'align-content'.
	The second value is assigned to 'justify-content';
	if omitted, it is copied from the first value,
	unless that value is a <<baseline-position>>
	in which case it is defaulted to ''start''.

<h3 id="overflow-scroll-position">
Overflow and Scroll Positions</h3>

	When the <a>content-distribution properties</a> are set
	on a <a>scroll container</a> with an overflowing <a>alignment subject</a>,
	rather than shifting the layout positions of its content,
	they instead change its <a>initial scroll position</a>
	so that the initially-visible content
	of the <a>scroll container</a>
	satisfies the [[#alignment-values|expected alignment]]
	of the <a>alignment subject</a> and <a>alignment container</a>.

	Note: The presence of scrollbars can change the size of the [=scroll container’s=] content box,
	and thus the size of the [=alignment container=]
	and/or [=alignment subject=].

	<div class='example'>
		For example,
		if a scrollable flex container is set to ''justify-content: flex-end''
		(or ''justify-content: flex-start'' with ''flex-flow: row-reverse''),
		it will be initially displayed scrolled all the way to the main-end edge of its content,
		and its content will appear to overflow its main-start edge.
	</div>

	Because the <a>scroll container</a>’s end-edge padding
	is not always included in the <a>scrollable overflow region</a>
	(see [[css-overflow-3#scrollable]]),
	performing such alignment might require
	that the <a>alignment subject</a> be positioned
	in a way that would normally not be possible just by scrolling.
	To resolve this problem
	(and be consistent across alignment values),
	all non-''align-content/normal'' values of 'align-content'/'justify-content'
	cause the <a>scrollable overflow region</a> to be extended
	in the relevant axis
	however much would be required to make it possible to scroll
	to a position satisfying ''align-content/end'' alignment in that axis.
	(In general, this means that the <a>scroll container</a>’s padding
	is added to the bounding rectangle of its in-flow children
	on <em>both</em> sides of the <a>scrollable overflow region</a>.
	See [[css-overflow-3]] for details.)

	<figure>
		<img src="images/scroll-align-padding.jpg" alt="">
		<figcaption>
			Issue: Replace this image with a proper SVG.
		</figcaption>
	</figure>

	ISSUE: Coordinate wording with css-overflow once it's less of a mess.

	None of this changes how scroll coordinates are assigned:
	the origin is still where it would be in a ''align-content/start''-aligned container,
	it just might be initially positioned outside the <a>scrollport</a>.

	Note: The <a>alignment subject</a> is not necessarily
	identical to the <a>scrollable overflow region</a>:
	content overflowing the <a>alignment subject</a>,
	such as an absolutely-positioned or out-of-flow element,
	grows the <a>scrollable overflow region</a> but not the <a>alignment subject</a>,
	thus an ''align-content/end''-aligned <a>scroll container</a>
	might not be initially scrolled all the way to the bottom.

	<figure>
		<img src="images/scroll-align-overflow.jpg" alt="">
		<figcaption>
			Overflow is not part of the <a>alignment subject</a>,
			even for a <a>scroll container</a>.

			Issue: Replace this image too.
		</figcaption>
	</figure>


<h3 id="baseline-align-content">
Baseline Content-Alignment</h3>

	The content of boxes participating in row-like layout contexts (<a>shared alignment contexts</a>)
	can be baseline-aligned to each other.
	<dfn export lt="baseline content-alignment|first-baseline content-alignment|last-baseline content-alignment">Baseline content-alignment</dfn> effectively increases the <strong>padding</strong> on the box
	to align the <a>alignment baseline</a> of its contents
	with that of other baseline-aligned boxes in its <a>baseline-sharing group</a>.

	[=Baseline content-alignment=] can only apply if the 'align-content' axis
	is parallel with the box's [=block axis=]
	(i.e. it does not apply to “column” [=flex containers=]);
	otherwise the [=fallback alignment=] is used.


	The set of boxes that participate in <a>baseline content-alignment</a>
	depends on the layout model:

	<dl>
		<dt>Table Cells:
		<dd>
			A <a>table cell</a> participates in
			first/last <a>baseline content-alignment</a>
			in its startmost/endmost row
			if its inline axis is parallel to that of the table itself and
			its computed 'align-content' is ''first baseline'' (''last baseline'').

			Note: <a>Baseline content-alignment</a>
			of cells sharing a column is not supported;
			however this may be added in a future level
			if there is sufficient demand and implementer interest.

		<dt>Flex Items:
		<dd>
			A <a>flex item</a> participates in
			first/last <a>baseline content-alignment</a>
			in its flex line if
			its computed 'align-content' is ''first baseline''/''last baseline''
			and its <a>inline axis</a> is parallel to the <a>main axis</a>.

		<dt>Grid Items:
		<dd>
			A <a>grid item</a> participates in
			first/last <a>baseline content-alignment</a>
			in its startmost/endmost row or column
			(whichever is parallel to its <a>inline axis</a>)
			and if its computed 'align-content' is ''first baseline''/''last baseline''.
	</dl>

	Additionally, if <a>self-alignment</a> applies to the box in an axis,
	in order to participate in <a>baseline content-alignment</a> in that axis
	it must also have a <dfn noexport>coordinated self-alignment preference</dfn>;
	that is:

	* The relevant <a>self-alignment property</a>
		behaves as either ''align-self/stretch'' or ''self-start''/''self-end''
		given a <a>baseline alignment preference</a> of ”first”/“last”.
		For this purpose,
		the ''start'', ''end'', ''flex-start'', and ''flex-end'' values
		are treated as either ''self-start'' or ''self-end'',
		whichever they end up equivalent to.
	* Its used self-alignment is not affected by its [=overflow alignment=].
		(That is, the used self-alignment is what would result from an ''unsafe'' [=overflow alignment=].)

	<!-- This is because such a box is no longer guaranteed to line up the relevant edge with its siblings -->
	It otherwise takes its <a>fallback alignment</a>.

	See [[#align-by-baseline]] for exact details.
	<a>Baseline content-alignment</a> can increase the intrinsic size of the box.

<!--
                   ██████  ████████ ██       ████████
 ██   ██          ██    ██ ██       ██       ██
  ██ ██           ██       ██       ██       ██
█████████ ███████  ██████  ██████   ██       ██████
  ██ ██                 ██ ██       ██       ██
 ██   ██          ██    ██ ██       ██       ██
                   ██████  ████████ ████████ ██
-->

<h2 id='self-alignment'>
Self-Alignment: Aligning the Box Within Its Parent</h2>

	<dfn export id="self-align">Self-alignment</dfn> controls alignment of the box within its containing block.
	It is specified by the <dfn export>self-alignment properties</dfn> 'align-self' and 'justify-self'
	(and their 'place-self' shorthand).

	<div class="figure">
		<img alt="Diagram showing that the alignment of the element within its containing block is affected." src="images/self-example.svg" width=212 height=212>
	</div>

<h3 id='justify-self-property'>
Inline-Axis (or Main-Axis) Alignment: the 'justify-self' property</h3>

	<pre class="propdef">
	Name: justify-self
	Value: auto | normal | stretch | <<baseline-position>> | <<overflow-position>>? [ <<self-position>> | left | right ]
	Initial: auto
	Applies to: block-level boxes, absolutely-positioned boxes, and grid items
	Inherited: no
	Percentages: n/a
	Computed value: specified keyword(s)
	Animation type: discrete
	</pre>

	Justifies the box (as the [=alignment subject=])
	within its containing block (as the [=alignment container=])
	along the inline/row/main axis of the [=alignment container=]:
	the box's outer edges are aligned within its <a>alignment container</a>
	<a href="#alignment-values">as described by its alignment value</a>.
	Values have the following meanings:

	<dl dfn-type=value dfn-for=justify-self>
		: <dfn>auto</dfn>
		::
			Behaves as ''justify-self/normal'' if the box has no parent,
			or when determining the actual position of an absolutely positioned box.
			It behaves as the computed 'justify-items' value of the parent box
			(minus any ''legacy'' keywords)
			otherwise
			(including when determining the <em>static</em> position
			of an absolutely positioned box).

		: <dfn>normal</dfn>
		::
			Represents the “default” alignment for the layout mode.
			Its behavior depends on the layout mode, as described below.

		: <dfn>stretch</dfn>
		::
			When the box’s computed 'width'/'height' (as appropriate to the axis) is ''width/auto''
			and neither of its margins (in the appropriate axis) are ''margin/auto'',
			sets the box’s used size to the length necessary to make its outer size
			as close to filling the <a>alignment container</a> as possible
			while still respecting the constraints imposed by 'min-height'/'min-width'/'max-height'/'max-width'.

			Unless otherwise specified, this value falls back to ''flex-start'' generally,
			and to ''self-start'' or ''self-end''
			if the box has also specified
			<a>first baseline</a> or <a>last baseline</a> <a>baseline content-alignment</a> (respectively)
			in the same axis.

			Note: The ''justify-self/stretch'' keyword can cause elements to shrink,
			to fit their container.

		: <<baseline-position>>
		::
			Indicates <a>baseline self-alignment</a>,
			as defined in [[#baseline-values]],
			[[#baseline-align-self]],
			and [[#baseline-rules]].

		: <<overflow-position>>? <<self-position>>
		::
			Defined in [[#alignment-values]], above.
	</dl>

	Values other than ''justify-self/stretch'' cause a 'width'/'height' of ''width/auto''
	to be treated as ''width/fit-content''.

	Note: ''margin/auto'' margins,
	because they effectively adjust the size of the margin area,
	take precedence over 'justify-self'.

### Block-Level Boxes ### {#justify-block}

	<table class="data align-details">
		<tr>
			<th>'justify-self' Axis
			<td>
				The block’s <a>containing block’s</a> <a>inline axis</a>.
		<tr>
			<th><a>Alignment Container</a>
			<td>
				The block's <a>containing block</a>,
				except that for block-level elements that establish a <a>block formatting context</a>
				and are placed next to a float,
				the <a>alignment container</a> is reduced by the space taken up by the float,
				assuming the <a>writing mode</a> of the <a>containing block</a>.
		<tr>
			<th><a>Alignment Subject</a>
			<td>
				The block's margin box,
				assuming the <a>writing mode</a> of the block.
		<tr>
			<th>''justify-self/normal'' Behavior
			<td>
				Behaves as ''justify-self/stretch''.
		<tr>
			<th>Other Details
			<td>
				In terms of CSS2.1 block-level formatting [[!CSS2]],
				the rules for “over-constrained” computations in <a href="https://www.w3.org/TR/CSS2/visudet.html#blockwidth">section 10.3.3</a>
				are ignored in favor of alignment as specified here
				and the used value of the margin properties are therefore not adjusted to correct for the over-constraint.

				This property does not apply to floats.
	</table>

	<div class="example">
		The effect of these rules is that an auto-sized block-level table,
		for example, can be aligned while still having side margins.
		If the table's max-content size is narrower than its containing block,
		then it is shrink-wrapped to that size and aligned as specified.
		If the table's max-content size is wider, then it fills its containing block,
		and the margins provide appropriate spacing from the containing block edges.
	</div>

### Absolutely-Positioned Boxes ### {#justify-abspos}

	This section describes the effect of 'justify-self'
	on how the margin box of an absolutely-positioned box
	is positioned with respect to its (absolute-positioning) containing block.

	<table class="data align-details">
		<tr>
			<th>'justify-self' Axis
			<td>
				The block’s containing block’s <a>inline axis</a>.
		<tr>
			<th><a>Alignment Container</a>
			<td>
				The box's <a>containing block</a>,
				as modified by the inset properties ('top'/'right'/'bottom'/'left'),
				assuming the <a>writing mode</a> of the <a>containing block</a>.
				If both inset properties in the relevant axis are ''left/auto'',
				then use the box’s <a>static position rectangle</a>
				(i.e. set both insets to the box’s <a>static position</a>).
		<tr>
			<th><a>Alignment Subject</a>
			<td>
				The box's margin box,
				assuming the <a>writing mode</a> of the box.
		<tr>
			<th>''justify-self/normal'' Behavior
			<td>
				* For replaced absolutely-positioned boxes, the ''justify-self/normal'' keyword behaves as ''start''.
				* For all other absolutely-positioned boxes, ''justify-self/normal'' behaves as stretch.
					Additionally, if neither inset in this axis is ''top/auto'',
					but 'width' ('height', for <a>vertical writing modes</a>) is ''width/auto'',
					''margin/auto'' margins are treated as zero.

					(In non-''justify-self/normal'' cases, ''margin/auto'' margins are prioritized over the <a>self-alignment properties</a>, as usual.)

				Note: This somewhat bizarre behavior is required for compatibility with the behavior specified in CSS 2.1.
		<tr>
			<th>Other Details
			<td>
				In terms of CSS2.1 formatting [[!CSS2]],
				the rules for “over-constrained” computations in <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width">section 10.3.7</a>
				are ignored in favor of alignment as specified here,
				and the used value of the inset properties are not adjusted to correct for the over-constraint.

				Values other than ''justify-self/stretch'' or ''justify-self/normal''
				cause <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width">non-replaced absolutely-positioned boxes</a>
				to use <a>fit-content sizing</a> for calculating ''width/auto'' sizes
				in the affected axis.

				Note that ''justify-self/stretch'' <em>does</em> cause replaced absolutely-positioned boxes
				to fill their containing block
				just as non-replaced ones do.

				Note: If only one inset property is ''top/auto'',
				the computations in <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width">CSS2 section 10.3.7</a>
				fully determine its size and position,
				and 'justify-self' has no effect.
				(If both are ''top/auto'',
				then the box is statically-positioned,
				see above,
				and can be aligned within the <a>static position rectangle</a>.)
	</table>

### Table Cells ### {#justify-cell}

	This property does not apply to table cells,
	because their position and size is fully constrained by table layout.

### Flex Items ### {#justify-flex}

	This property does not apply to <a>flex items</a>,
	because there is more than one item in the <a>main axis</a>.
	See 'flex' for stretching and 'justify-content' for <a>main-axis</a> alignment. [[!CSS-FLEXBOX-1]]

### Grid Items ### {#justify-grid}

	<table class="data align-details">
		<tr>
			<th>'justify-self' Axis
			<td>
				The grid’s [=inline axis=].
		<tr>
			<th><a>Alignment Container</a>
			<td>
				The <a>grid item’s</a> <a>grid area</a>,
				assuming the <a>writing mode</a> of the <a>grid container</a>.
		<tr>
			<th><a>Alignment Subject</a>
			<td>
				The <a>grid item’s</a> margin box,
				assuming the <a>writing mode</a> of the <a>grid item</a>.
		<tr>
			<th>''justify-self/normal'' Behavior
			<td>
				Effectively ''justify-self/stretch'' for items with no intrinsic aspect ratio,
				and ''justify-self/start'' for items with an intrinsic aspect ratio:
				see <a href="https://www.w3.org/TR/css-grid-1/#grid-item-sizing">Grid Item Sizing</a> in [[!CSS-GRID-1]].
				The resulting box is start-aligned.
	</table>

	See [[!CSS-GRID-1]] for details.

<h3 id='align-self-property'>
Block-Axis (or Cross-Axis) Alignment: the 'align-self' property</h3>

	<pre class="propdef">
	Name: align-self
	Value: auto | normal | stretch | <<baseline-position>> | <<overflow-position>>? <<self-position>>
	Initial: auto
	Applies to: flex items, grid items, and absolutely-positioned boxes
	Inherited: no
	Percentages: n/a
	Computed value: specified keyword(s)
	Animation type: discrete
	</pre>

	Aligns the box (as the [=alignment subject=])
	within its containing block (as the [=alignment container=])
	along the block/column/cross axis of the [=alignment container=]:
	the box's outer edges are aligned within its <a>alignment container</a>
	<a href="#alignment-values">as described by its alignment value</a>.
	Values have the following meanings:

	<dl dfn-type=value dfn-for=align-self>
		: <dfn>auto</dfn>
		::
			Behaves as ''align-self/normal'' if the box has no parent,
			or when determining the actual position of an absolutely positioned box.
			It behaves as the computed 'align-items' value of the parent box
			(minus any ''legacy'' keywords)
			otherwise
			(including when determining the <em>static</em> position
			of an absolutely positioned box).

		: <dfn>normal</dfn>
		::
			Represents the “default” alignment for the layout mode,
			as defined below.

		: <dfn>stretch</dfn>
		::
			As defined for 'justify-self' in [[#justify-self-property]].

		: <<baseline-position>>
		::
			Indicates <a>baseline self-alignment</a>,
			as defined in [[#baseline-values]],
			[[#baseline-align-self]],
			and [[#baseline-rules]].

		: <<overflow-position>>? <<self-position>>
		::
			Defined in [[#alignment-values]], above.
	</dl>

	Note: ''margin/auto'' margins,
	because they effectively adjust the size of the margin area,
	take precedence over 'align-self'.

### Block-Level Boxes ### {#align-block}

	The 'align-self' property does not apply to block-level boxes
	(including floats),
	because there is more than one item in the <a>block axis</a>.

### Absolutely-Positioned Boxes ### {#align-abspos}

	This section describes the effect of 'align-self'
	on how the margin box of an absolutely-positioned box
	which is not statically-positioned
	is positioned with respect to its (absolute-positioning) containing block.

	<table class="data align-details">
		<tr>
			<th>'align-self' Axis
			<td>
				The box’s <a>containing block’s</a> <a>block axis</a>.
		<tr>
			<th><a>Alignment Container</a>
			<td>
				The box's <a>containing block</a>,
				as modified by the inset properties
				('top'/'right'/'bottom'/'left'),
				assuming the <a>writing mode</a> of the <a>containing block</a>.
				If both inset properties in the relevant axis are ''left/auto'',
				then use the box’s <a>static position rectangle</a>
				(i.e. set both insets to the box’s <a>static position</a>).
		<tr>
			<th><a>Alignment Subject</a>
			<td>
				The box’s margin box,
				assuming the <a>writing mode</a> of the box.
		<tr>
			<th>''align-self/normal'' Behavior
			<td>
				* For replaced absolutely-positioned boxes, the ''align-self/normal'' keyword behaves as ''start''.
				* For all other absolutely-positioned boxes, ''align-self/normal'' behaves as stretch.
					Additionally, if neither inset in this axis is ''top/auto'',
					but 'width' ('height', for <a>vertical writing modes</a>) is ''width/auto'',
					''margin/auto'' margins are treated as zero.

					(In non-''align-self/normal'' cases, ''margin/auto'' margins are prioritized over the <a>self-alignment properties</a>, as usual.)

				Note: This somewhat bizarre behavior is required for compatibility with the behavior specified in CSS 2.1.
		<tr>
			<th>Other Details
			<td>
				In terms of CSS2.1 formatting [[!CSS2]],
				the rules for "over-constrained" computations in <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-height">section 10.6.4</a>
				are ignored in favor of alignment as specified here
				and the used value of the inset properties are not adjusted to correct for the over-constraint.

				Values other than ''justify-self/stretch'' or ''justify-self/normal''
				cause <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-height">non-replaced absolutely-positioned boxes</a>
				to use <a>fit-content sizing</a> for calculating ''height/auto'' sizes
				in the affected axis.

				Note that ''justify-self/stretch'' does cause replaced absolutely-positioned boxes
				to fill their containing block
				just as non-replaced ones do.

				Note: If only one inset property is ''top/auto'',
				the computations in <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-height">CSS2 section 10.6.4</a>
				fully determine its size and position,
				and 'align-self' has no effect.
				(If both are ''top/auto'',
				then the box is statically-positioned,
				see above,
				and can be aligned within the <a>static position rectangle</a>.)

	</table>

### Table Cells ### {#align-cell}

	This property does not apply to table cells,
	because their position and size is fully constrained by table layout.

### Flex Items ### {#align-flex}

	<table class="data align-details">
		<tr>
			<th>'align-self' Axis
			<td>
				The <a>flex container’s</a> <a>cross axis</a>.
		<tr>
			<th><a>Alignment Container</a>
			<td>
				The <a>flex line</a> the <a>flex item</a> is in,
				assuming the <a>writing mode</a> of the <a>flex container</a>.
		<tr>
			<th><a>Alignment Subject</a>
			<td>
				The <a>flex item’s</a> margin box,
				assuming the <a>writing mode</a> of the <a>flex item</a>.
		<tr>
			<th>''align-self/normal'' Behavior
			<td>
				Behaves as ''align-self/stretch''.
	</table>

	See [[!CSS-FLEXBOX-1]] for details.

### Grid Items ### {#align-grid}

	<table class="data align-details">
		<tr>
			<th>'align-self' Axis
			<td>
				The grid’s [=block axis=].
		<tr>
			<th><a>Alignment Container</a>
			<td>
				The [=grid item’s=] <a>grid area</a>,
				assuming the <a>writing mode</a> of the <a>grid container</a>.
		<tr>
			<th><a>Alignment Subject</a>
			<td>
				The <a>grid item’s</a> margin box,
				assuming the <a>writing mode</a> of the <a>grid item</a>.
		<tr>
			<th>''align-self/normal'' Behavior
			<td>
				Behaves as ''align-self/stretch'' for non-replaced items.
				For replaced items,
				see <a href="https://www.w3.org/TR/css-grid-1/#grid-item-sizing">Grid Item Sizing</a> in [[!CSS-GRID-1]].
	</table>

<h3 id='place-self-property'>
Self-Alignment Shorthand: the 'place-self' property</h3>

	<pre class="propdef">
	Name: place-self
	Value: <<'align-self'>> <<'justify-self'>>?
	Initial: auto
	Applies to: block-level boxes, absolutely-positioned boxes, and grid items
	Inherited: no
	Percentages: n/a
	Computed value: see individual properties
	Animation type: discrete
	</pre>

	This <a>shorthand property</a> sets
	both the 'align-self' and 'justify-self' properties
	in a single declaration.
	The first value is assigned to 'align-self'.
	The second value is assigned to 'justify-self';
	if omitted, it is copied from the first value.

<h3 id="baseline-align-self">
Baseline Self-Alignment</h3>

	Boxes participating in row-like layout contexts (<a>shared alignment contexts</a>)
	can be baseline-aligned to each other.
	<dfn export lt="baseline self-alignment|first-baseline self-alignment|last-baseline self-alignment">Baseline self-alignment</dfn> effectively increases the <strong>margins</strong> on the box
	to align its <a>alignment baseline</a>
	with that of other baseline-aligned boxes in its <a>baseline-sharing group</a>.

	The set of boxes that participate in <a>baseline self-alignment</a>
	depends on the layout model:

	<dl>
		<dt>Flex Items:
		<dd>
			A <a>flex item</a> participates in
			first/last <a>baseline self-alignment</a>
			in its flex line
			if its computed 'align-self' is ''first baseline''/''last baseline''.
			See [[!CSS-FLEXBOX-1]] for details.

		<dt>Grid Items:
		<dd>
			A <a>grid item</a> participates in
			first/last <a>baseline self-alignment</a>
			in its startmost/endmost row or column
			if its 'align-self' or 'justify-self' property (respectively)
			computes to ''first baseline''/''last baseline''.
	</dl>

	See [[#align-by-baseline]] for exact details.
	<a>Baseline self-alignment</a> can increase the intrinsic size contribution of the box.

<h3 id="abspos-sizing">
Effects on Sizing of Absolutely Positioned Boxes with Static-Position Insets</h3>

	For absolutely-positioned boxes
	whose inline-axis offsets are both ''left/auto'',
	the <a>available space</a> for calculating the <a>inline size</a>
	is also affected by alignment.

	Note: In [[CSS2]], the [=available space=] is keyed off of the the 'direction' property
	of the <a>static-position containing block</a>.
	(See <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width">CSS2&sect;10.3.7</a>
	and <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-replaced-width">CSS2&sect;10.3.8</a>.)
	Fundamentally these rules set one of the ''left/auto'' insets
	(by default, the start-edge inset)
	to the corresponding edge of the <a>static position rectangle</a>
	and the other to the corresponding edge of the <a>containing block</a>
	(i.e. set the inset to zero).
	Just as the <a>self-alignment properties</a>
	replace the <a>containing block</a>’s 'direction' lookup for placement,
	they also replace this lookup for sizing,
	as specified here.

	Thus,
	when interpreting the rules in
	<a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width">CSS2&sect;10.3.7</a>
	and <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-replaced-width">CSS2&sect;10.3.8</a>,
	wherever the 'direction' property of the <a>static-position containing block</a> is referenced,
	instead reference the value of the 'align-self' or 'justify-self' property
	(whichever is defined to apply to the relevant axis),
	treating left-equivalent alignment as defined for ''ltr''
	and right-equivalent alignment as defined for ''rtl''.
	Treat ''justify-self/normal'' as ''start''
	and any <a>distributed alignment</a> value as its <a>fallback alignment</a>.

	In the case of ''justify-self/center'' alignment,
	the [=available space=] for the box is
	double the distance between the center of the [=static position rectangle=]
	and the closest edge of the [=containing block=]
	in the relevant axis.

	<figure>
		<img src="images/place-content-abspos.svg" width=480 height=330
		     alt="Start alignment sizes into the space between
		          the start edge of the static-position rectangle and the end edge of the containing block.
		          End alignment sizes into the space between
		          the end edge of the static-position rectangle and the start edge of the containing block.
		          Center alignment sizes into the space between
		          the two edges of the static-position rectangle.">
		<figcaption>
			Instead of always sizing
			within the available space between
			the <a>inline-start</a> <a>static position</a>
			and the <a>inline-end</a> <a>containing block</a> edge
			as specified in [[CSS2]],
			an absolutely-positioned element with ''left/auto'' insets
			will be sized with reference to
			the <a>static position rectangle</a>’s edge(s)
			<em>most appropriate</em> to its specified <a>self-alignment</a>.
		</figcaption>
	</figure>

	<div class="example">
		For example,
		when the box’s <a>containing block</a>’s 'direction' is ''ltr''
		and its own 'justify-self' is ''justify-content/end'',
		apply the rules for ''direction: rtl'';
		when 'direction' is ''rtl'' and 'justify-content' is ''justify-content/space-between'',
		apply the rules for ''direction: rtl'';
		etc.
		For the case of ''justify-content/center'' (or its equivalent),
		set both sides to match the <a>static position</a>.
		The absolutely-positioned box is then sized into
		the resulting space (floored at zero).
	</div>


	Note: The 'align-self'/'justify-self' properties
	can also modify additional aspects of sizing:
	for example, ''justify-self: stretch'' will replace
	“shrink-to-fit” (<a lt="fit-content sizing">fit-content</a>) sizing into the <a>available space</a>
	with <a>stretch-fit sizing</a> (consuming all of the <a>available space</a>).
	This is an independent effect from the available space adjustment here.

	Note: This only affect how [=available space=] is calculated
	for sizing the absolutely-positioned box;
	its alignment is as specified in previous sections.

<!--
                  ████ ████████ ████████ ██     ██  ██████
 ██   ██           ██     ██    ██       ███   ███ ██    ██
  ██ ██            ██     ██    ██       ████ ████ ██
█████████ ███████  ██     ██    ██████   ██ ███ ██  ██████
  ██ ██            ██     ██    ██       ██     ██       ██
 ██   ██           ██     ██    ██       ██     ██ ██    ██
                  ████    ██    ████████ ██     ██  ██████
-->

<h2 id='default-alignment'>
Default Alignment</h2>

	The 'align-items' and 'justify-items' properties
	(and their 'place-items' shorthand)
	set the default 'align-self' and 'justify-self' behavior of the element’s child boxes.

	<div class="figure">
		<img alt="Diagram showing that the alignment of grid items within the element is affected." src="images/items-example.svg" width=212 height=212>
	</div>

<h3 id='justify-items-property'>
Inline-Axis (or Main-Axis) Alignment: the 'justify-items' property</h3>

	<pre class="propdef">
	Name: justify-items
	Value: normal | stretch | <<baseline-position>> | <<overflow-position>>? [ <<self-position>> | left | right ] | legacy | legacy && [ left | right | center ]
	Initial: legacy
	Applies to: all elements
	Inherited: no
	Percentages: n/a
	Computed value: specified keyword(s), except for ''justify-items/legacy'' (see prose)
	Animation type: discrete
	</pre>

	This property specifies the default 'justify-self' for all of the child boxes
	(including anonymous boxes)
	participating in this box's formatting context.
	Values have the following meanings:

	<dl dfn-type="value" dfn-for="justify-items">
		<dt><dfn>legacy</dfn>
		<dd>
			This keyword causes the value to effectively inherit into descendants.

			If the ''legacy'' keyword appears on its own
			(without an accompanying ''left'', ''right'', or ''<content-position>/center'' keyword):
			if the <a>inherited value</a> of ''justify-items'' includes the ''legacy'' keyword,
			this value computes to the <a>inherited value</a>;
			otherwise it computes to ''justify-items/normal''.

			When ''justify-self:auto'' references the value of 'justify-items',
			only the alignment keyword, not the ''legacy'' keyword, is referenced by it.
			It exists to implement the legacy alignment behavior of HTML's <code>&lt;center></code> element and <code>align</code> attribute.
	</dl>

	Other values have no special handling and are merely referenced by 'justify-self'.

<h3 id='align-items-property'>
Block-Axis (or Cross-Axis) Alignment: the 'align-items' property</h3>

	<pre class="propdef">
	Name: align-items
	Value: normal | stretch | <<baseline-position>> | [ <<overflow-position>>? <<self-position>> ]
	Initial: normal
	Applies to: all elements
	Inherited: no
	Percentages: n/a
	Computed value: specified keyword(s)
	Animation type: discrete
	</pre>

	This property specifies the default 'align-self' for all of the child boxes
	(including anonymous boxes)
	participating in this box's formatting context.

	Values have no special handling and are merely referenced by 'align-self'.

<h3 id='place-items-property'>
Self-Alignment Shorthand: the 'place-items' property</h3>

	<pre class="propdef">
	Name: place-items
	Value: <<'align-items'>> <<'justify-items'>>?
	Initial: see individual properties
	Applies to: all elements
	Inherited: no
	Percentages: n/a
	Computed value: see individual properties
	Animation type: discrete
	</pre>

	This <a>shorthand property</a> sets
	both the 'align-items' and 'justify-items' properties
	in a single declaration.
	The first value is assigned to 'align-items'.
	The second value is assigned to 'justify-items';
	if omitted, it is copied from the first value.


<!--
 ██████      ███    ████████   ██████
██    ██    ██ ██   ██     ██ ██    ██
██         ██   ██  ██     ██ ██
██   ████ ██     ██ ████████   ██████
██    ██  █████████ ██              ██
██    ██  ██     ██ ██        ██    ██
 ██████   ██     ██ ██         ██████
-->

<h2 id='gaps'>
Gaps Between Boxes</h2>

While 'margin' and 'padding' can be used to specify visual spacing around individual boxes,
it's sometimes more convenient to globally specify spacing between adjacent boxes
within a given layout context,
particularly when the spacing is different between boxes
as opposed to between the first/last box and the container's edge.

The 'gap' property,
and its 'row-gap' and 'column-gap' sub-properties,
provide this functionality for
<a href="http://www.w3.org/TR/css3-multicol/">multi-column</a>,
<a href="http://www.w3.org/TR/css-flexbox/">flex</a>,
and <a href="http://www.w3.org/TR/css-grid/">grid layout</a>.

<h3 id='column-row-gap'>
Row and Column Gutters: the 'row-gap' and 'column-gap' properties</h3>

	<pre class='propdef'>
	Name: row-gap, column-gap
	Value: normal | <<length-percentage>>
	Initial: normal
	Applies to: <a>multi-column containers</a>, <a>flex containers</a>, <a>grid containers</a>
	Inherited: no
	Percentages: refer to corresponding dimension of the content area
	Computed value: specified keyword, else a computed <<length-percentage>> value
	Animation type: by computed value type
	</pre>

	These properties specify fixed-length <dfn export lt="gutter">gutters</dfn>
	between items in the container,
	adding space between them--
	in a manner to the ''justify-content/space-between'' keyword
	of the <a>content-distribution properties</a>,
	but of a fixed size instead of as a fraction of remaining space.
	The 'column-gap' property specifies spacing between “columns”,
	separating boxes in the container's <a>inline axis</a>
	similar to <a>inline-axis</a> margin;
	while 'row-gap' indicates spacing between “rows”,
	separating boxes in the container's <a>block axis</a>.

	Values have the following meanings:

	<dl dfn-type=value dfn-for="row-gap, column-gap, gap">
		: <<length-percentage>>
		::
			Specifies a gap between “rows” or “columns”,
			as defined by the layout modes to which it applies;
			see subsections below for details.

			Negative values are invalid.
			<a href="https://www.w3.org/TR/css-sizing-3/#percentage-sizing">As in the min size properties and margins/paddings</a> [[CSS-SIZING-3]],
			percentages resolve against zero
			for determining intrinsic size contributions,
			but resolve against the box’s content box
			when laying out the box’s contents.

		: <dfn>normal</dfn>
		:: The ''gap/normal'' represents
			a used value of ''1em'' on <a>multi-column containers</a>,
			and a used value of ''0px'' in all other contexts.
	</dl>

	Gutters effect a minimum spacing between items:
	additional spacing may be added by 'justify-content'/'align-content'.
	Such additional space effectively increases the size of these <a>gutters</a>.

	The exact handling of these properties varies by layout container:

	<dl>
		<dt id="gap-multicol"><a>multi-column containers</a>
		<dd>
			'column-gap' specifies the [=gutter=] between adjacent <a>column boxes</a>.
			See [[CSS-MULTICOL-1]] for details on how this affects the layout of multicol elements.
			'row-gap' does not currently apply.

		<dt id="gap-flex"><a>flex containers</a>
		<dd>
			When applied to the <a>main axis</a>
			(e.g. 'column-gap' in a ''flex-flow/row'' <a>flex container</a>),
			indicates minimum spacing between items
			(as if an additional fixed-size margin were inserted
			between adjacent <a>flex items</a>
			in a single line).

			When applied to the <a>cross axis</a>
			(e.g. 'row-gap' in a ''flex-flow/row'' <a>flex container</a>),
			indicates minimum spacing between adjacent <a>flex lines</a>.

		<dt id="gap-grid"><a>grid containers</a>
		<dd>
			The 'row-gap' and 'column-gap' properties,
			when specified on a <a>grid container</a>,
			define the [=gutters=] between <a>grid rows</a> and <a>grid columns</a>,
			respectively.
			See [[css-grid-1#gutters]] for precise details.
	</dl>

	Note: Table boxes do not use the 'gap' properties
	to specify separation between their cells.
	Instead, they use the 'border-spacing' property,
	which has slightly different functionality:
	it inherits,
	and it also specifies the additional spacing between the outermost cells
	and the border of the table
	(similar to ''space-evenly'' rather than ''space-between'').

<h3 id='gap-shorthand'>
Gap Shorthand: the 'gap' property</h3>

	<pre class='propdef'>
	Name: gap
	Value: <<'row-gap'>> <<'column-gap'>>?
	Initial: see individual properties
	Applies to: <a>multi-column containers</a>, <a>flex containers</a>, <a>grid containers</a>
	Inherited: no
	Percentages: refer to corresponding dimension of the content area
	Computed value: see individual properties
	Animation type: by computed value type
	</pre>

	This property is a <a>shorthand</a> that sets 'row-gap' and 'column-gap' in one declaration.
	If <<'column-gap'>> is omitted,
	it's set to the same value as <<'row-gap'>>.

	<div class='example'>
		<figure>
			<img src="images/gutters-gaps.svg" alt="A diagram showing how margins and padding add to the visible gutter size" width="500" height="616">
		</figure>

		Note: The 'gap' property is only one component of the visible “gutter” or “alley” created between boxes.
		Margins, padding, or the use of distributed alignment
		may increase the visible separation between boxes
		beyond what is specified in 'gap'.
	</div>

<h3 id='gap-legacy'>
Legacy Gap Properties: the 'grid-row-gap', 'grid-column-gap', and 'grid-gap' properties</h3>

	The Grid Layout module was originally written with its own set of [=gutter=] properties,
	before all such properties were unified into the existing 'row-gap'/'column-gap' naming.
	For compatibility with legacy content,
	those legacy property names must be supported as aliases:

	* <dfn property>grid-row-gap</dfn> must be treated as a shorthand for the 'row-gap' property
	* <dfn property>grid-column-gap</dfn> must be treated as a shorthand for the 'column-gap' property
	* <dfn property>grid-gap</dfn> must be treated as a shorthand for the 'gap' property

	In all three cases, the legacy properties must take the same grammar as the property they are aliasing,
	and just "forward" the value to their aliased property.

<!--
████████     ███     ██████  ████████ ██       ████ ██    ██ ████████
██     ██   ██ ██   ██    ██ ██       ██        ██  ███   ██ ██
██     ██  ██   ██  ██       ██       ██        ██  ████  ██ ██
████████  ██     ██  ██████  ██████   ██        ██  ██ ██ ██ ██████
██     ██ █████████       ██ ██       ██        ██  ██  ████ ██
██     ██ ██     ██ ██    ██ ██       ██        ██  ██   ███ ██
████████  ██     ██  ██████  ████████ ████████ ████ ██    ██ ████████
-->

<h2 id='baseline-rules'>
Baseline Alignment Details</h2>

	Boxes in a <a>baseline-sharing group</a> are aligned to each other
	using their <a>alignment baselines</a>.
	For example, in horizontal writing modes,
	specifying ''align-content: baseline'' on table cells in the same row
	will align the baselines of their <a>first formatted lines</a>.
	This section defines exactly how baseline alignment is performed
	in consideration of the myriad baselines and <a>writing modes</a>
	that exist in internationalized modern CSS.

	A <dfn export>baseline set</dfn> is
	a set of baselines (alphabetic, central, etc.)
	associated with a common baseline table.
	Typically, a typesetting tradition will use only one of these,
	but different writing systems use different baselines,
	and mixing writing systems can result in using more than one
	within a single line.
	Refer to [[css-writing-modes-3#intro-baselines]]
	for more information on baselines and writing modes.

<h3 id='baseline-export'>
Determining the Baselines of a Box</h2>

	Each box,
	for a given axis,
	has a <dfn export lt="first baseline set|first baselines">first baseline set</dfn>
	(and <dfn export lt="last baseline set|last baselines">last baseline set</dfn>)
	that nominally corresponds to the <a>baseline set</a> of
	the first/last line of text within the box.
	The <dfn export>alignment baseline</dfn> is one of these,
	usually the dominant baseline associated with the <a>shared alignment context</a>.
	(See the 'dominant-baseline' and 'alignment-baseline' properties in [[CSS-INLINE-3]].)

	The first and last <a>baseline sets</a> of a box
	are determined differently based on the layout model, as follows:

	<dl>
		<dt>block containers
		<dd>
			The first/last [=baseline set=] of a <a>block container</a>
			is <a>generated</a> from the dominant first/last baseline
			of the first/last in-flow line box in the block container,
			or is taken from the first/last in-flow block-level child in the block container
			that contributes a set of first/last baselines,
			whichever comes first/last.
			If there is no such line box or child,
			then the block container has no [=baseline set=].

			However, for legacy reasons,
			if an ''inline-block''
			is a [=scroll container=]
			or contains no in-flow [=line boxes=],
			its first and last [=baseline sets=]
			are [=synthesized=] from its [=margin box=].

		<dt>multi-column containers
		<dd>
			The first [=baseline set=] of a <a>multi-column container</a>
			is <a>generated</a> from the dominant first baseline
			of the first in-flow line box in the first column box,
			or is taken from the first in-flow block-level child
			that contributes a set of first baselines,
			whichever comes first.
			If there is no such line box or child,
			then the multi-column container has no first [=baseline set=].

			Multi-column containers have no last [=baseline set=].

		<dt>tables
		<dd>
			The first/last [=baseline set=] of a table box
			is the first/last [=baseline set=] of its first/last row.

			When finding the first/last baseline set of an inline-block,
			any baselines contributed by table boxes must be skipped.
			(This quirk is a legacy behavior from [[CSS2]].)

		<dt>table rows
		<dd>
			If any cells in the row participate in
			''first baseline''/''last baseline'' alignment
			along the [=inline axis=],
			the first/last [=baseline set=] of the row
			is <a>generated</a> from their shared <a>alignment baseline</a>
			and the row's <a>first available font</a>,
			after alignment has been performed.
			Otherwise, the first/last [=baseline set=] of the row
			is <a>synthesized</a> from the lowest and highest content edges of the cells in the row.
			[[!CSS2]]

		<dt>flex containers
		<dd>
			See <a href="https://www.w3.org/TR/css3-flexbox/#flex-baselines">Flex Baselines</a> in [[!CSS-FLEXBOX-1]].

		<dt>grid containers
		<dd>
			See <a href="https://www.w3.org/TR/css3-grid-layout/#grid-baselines">Grid Baselines</a> in [[!CSS-GRID-1]].
	</dl>

	To <dfn local-lt=generate|generated export>generate baselines</dfn> for a box from a single baseline,
	use the baseline table from the font settings and <a>first available font</a> of that box,
	and align that baseline set to the given single baseline.

	To <dfn lt="synthesize baseline|synthesized baseline" local-lt=synthesize|synthesized export>synthesize baselines</dfn> from a rectangle (or two parallel lines),
	synthesize the alphabetic baseline from the <a>line-under</a> line,
	and the central baseline by averaging the positions of the two edges or lines.
	See [[css-inline-3#baseline-synthesis]] for rules on synthesizing additional baselines.

	Note: The edges used to <a>synthesize</a> baselines from a box
	depend on their <a>formatting context</a>:
	inline-level boxes <a>synthesize</a> from their margin edges [[CSS-INLINE-3]],
	table cells <a>synthesize</a> from their content edges [[CSS2]],
	and grid and flex items <a>synthesize</a> from their border edges [[CSS-GRID-1]] [[CSS-FLEXBOX-1]].

	In general, the <a>writing mode</a> of the box, shape, or other object being aligned
	is used to determine the <a>line-under</a> and <a>line-over</a> edges for synthesis.
	However, when that <a>writing mode</a>’s
	<a>block flow direction</a> is parallel
	to the axis of the <a>alignment context</a>,
	an axis-compatible <a>writing mode</a> must be assumed:
	* If the box establishing the <a>alignment context</a>
		has a <a>block flow direction</a> that is orthogonal to the axis of the <a>alignment context</a>,
		use its <a>writing mode</a>.
	* Otherwise, assume either ''horizontal-tb'' or ''vertical-lr'' 'writing-mode',
		whichever is orthogonal to the box’s own 'writing-mode'.
		<!-- This pairing is chosen because the most likely case for this situation is CJK. -->

	For the purposes of finding the baselines of a box,
	it and all its in-flow descendants with a scrolling mechanism (see the 'overflow' property)
	must be considered as if scrolled to their initial scroll position.
	Furthermore, if, in the case of a <a>scroll container</a> box,
	the resulting position of a first/last baseline
	is past a box's end/start border edge,
	its position is clamped to that border edge.

<h3 id='baseline-terms'>
Baseline Alignment Grouping</h3>

	A <dfn export>baseline-sharing group</dfn>
	is composed of boxes that participate in baseline alignment together.
	This is possible only if they both:

	<ul>
		<li>Share an <a>alignment context</a> along an axis perpendicular to the axis they're being baseline-aligned in.
			(For example, grid items with ''align-self: baseline'' are baseline-aligning along the grid’s block axis,
			and therefore participate with other items in their row.)
		<li>Have <a>compatible baseline alignment preferences</a>
			(i.e., the baselines that want to align are on the same side of the alignment context).
	</ul>

	Note: Boxes participating in <a>baseline content-alignment</a> and
	boxes participating in <a>baseline self-alignment</a>
	can be part of the same <a>baseline-sharing group</a>,
	and can thus align to each other.
	The difference between the two methods
	is in where extra space is inserted to perform the alignment
	(inside or outside the box’s own border).

	Boxes share an <dfn lt="shared alignment context|alignment context" export>alignment context</dfn>,
	along a particular axis,
	and established by a particular box,
	when they are:

	<ul>
		<li>table cells in the same row, along the table's row (inline) axis, established by the row box
		<!--baseline-align-column <li>table cells in the same column, along the table's column (block) axis, established by the column box -->
		<li>grid items in the same row, along the grid's row (inline) axis, established by the <a>grid container</a>
		<li>grid items in the same column, along the grid's column (block) axis, established by the <a>grid container</a>
		<li>flex items in the same flex line, along the flex container's main axis, established by the <a>flex container</a>
	</ul>

	Note: Conceptually,
	the inline-level boxes in a line box also share a self-alignment context
	and participate in a baseline-sharing group;
	however they only baseline-align in response to the 'vertical-align' property,
	not any of the properties defined in this module.
	See [[CSS-INLINE-3]].

	If a box spans multiple <a>shared alignment contexts</a>,
	then it participates in first/last baseline alignment
	within its start-most/end-most <a>shared alignment context</a> along that axis.
	For example, a table cell spanning three rows
	participates in <a>first-baseline alignment</a>
	with the table cells in the first row that it spans,
	or alternatively in <a>last-baseline alignment</a>
	with the table cells in the last row that it spans.

	The <a>baseline alignment preferences</a> of two boxes in a <a>baseline-sharing group</a> are <dfn lt="compatible baseline alignment preferences">compatible</dfn> if they have:

	* the same <a>block flow direction</a> and same <a>baseline alignment preference</a>
	* opposite <a>block flow direction</a> and opposite <a>baseline alignment preference</a>

<h3 id='align-by-baseline'>
Aligning Boxes by Baseline</h3>

	Given a set of [=alignment subjects=] and their baselines
	that all belong to a single <a>baseline-sharing group</a>,
	the [=alignment subjects=] are baseline-aligned as follows:

	First, generate the <a>baseline-sharing group</a>’s baseline table
	from the <a>first available font</a> of the group’s [=alignment context=]
	and overlay also the mirror of this baseline table by aligning their central baselines.
	These are the baseline “grids” to which the [=alignment subjects=] will align.

	Next, align each [=alignment subject=] by its specified <a>alignment baseline</a>
	to the group’s baseline table
	or its mirror, whichever matches the [=alignment subject’s=] <a>line orientation</a>.
	Unless otherwise specified (e.g. via the 'alignment-baseline' property),
	the <a>alignment baseline</a> is the <a>dominant baseline</a> of the [=alignment context=].

	Position the aligned <a>baseline-sharing group</a> within the [=alignment container=]
	according to the <a>fallback alignment</a> associated with the
	specified <a>baseline alignment preference</a>.
	For first/last <a>baseline content-alignment</a>,
	then add the minimum necessary extra space
	between the [=alignment container’s=] start/end content edge
	and the [=alignment subject’s=] edge
	to align the start/end margin edges of all the [=alignment containers=]
	in the [=alignment context=]
	while maintaining baseline alignment within the [=baseline-sharing group=].


<h2 id="staticpos-rect">
Appendix A: Static Position Terminology</h2>

	When both <a>inset properties</a> in a given axis are ''left/auto''
	on an <a href="https://www.w3.org/TR/CSS2/visuren.html#absolutely-positioned">absolutely positioned box</a>,
	CSS2 uses its <a>static position</a>
	to resolve its size and position.
	See [[css2#abs-non-replaced-width]].
	The <a>box alignment properties</a> modify these calculations,
	just as they do the sizing and positioning calculations in other layout modes.
	These modifications refer to a <dfn>static position rectangle</dfn>,
	whose edges represent the <a>static position</a> of the box
	from each side of its <a>containing block</a>.

	The <a>static position rectangle</a> and the <a>static positions</a> to which it corresponds
	are defined by the layout model of its “hypothetical box”:

	<dl>
		<dt>Block Layout
		<dd>
		The <a>static positions</a> of a <a>block-level box</a>
		are defined in [[CSS2]] Chapter 10.
		The <a>static position rectangle</a> is a zero-thickness rectangle spanning between
		the inline-axis sides of the box’s <a>static-position containing block</a>
		(see <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width">CSS2&sect;10.3.7</a>);
		and positioned at its <a>block-start</a> <a>static position</a>
		(see <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-height">CSS2&sect;10.6.4</a>).

		<dt>Inline Layout
		<dd>
		The <a>static positions</a> of an <a>inline-level box</a>
		are defined in [[CSS2]] Chapter 10.
		The <a>static position rectangle</a> is a zero-thickness rectangle spanning between
		the <a>line-over</a>/<a>line-under</a> sides of the <a>line box</a>
		that would have contained its “hypothetical box”
		(see <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width">CSS2&sect;10.3.7</a>);
		and positioned at its <a>inline-start</a> <a>static position</a>.

		<dt>Flex Layout
		<dd>
		The <a>static position rectangle</a> of the child of a <a>flex container</a>
		corresponds to the <a>content edges</a> of the <a>flex container</a>.
		See <a href="https://www.w3.org/TR/css-flexbox-1/#abspos-items">static position of a grid container child</a> in [[!CSS-FLEXBOX-1]].

		<dt>Grid Layout
		<dd>
		By default, the <a>static position rectangle</a> of the child of a <a>grid container</a>
		corresponds to the <a>content edges</a> of the <a>grid container</a>.
		However, if that <a>grid container</a> also establishes
		the box’s actual <a>containing block</a>,
		then the <a>grid area</a> specified by the <a>grid-placement properties</a>
		establishes its <a>static position rectangle</a> instead.
		See the <a href="https://www.w3.org/TR/css-grid-1/#static-position">static position of a grid container child</a> in [[!CSS-GRID-1]].
	</dl>

<!--
 ██████  ██     ██    ███    ██    ██  ██████   ████████  ██████
██    ██ ██     ██   ██ ██   ███   ██ ██    ██  ██       ██    ██
██       ██     ██  ██   ██  ████  ██ ██        ██       ██
██       █████████ ██     ██ ██ ██ ██ ██   ████ ██████    ██████
██       ██     ██ █████████ ██  ████ ██    ██  ██             ██
██    ██ ██     ██ ██     ██ ██   ███ ██    ██  ██       ██    ██
 ██████  ██     ██ ██     ██ ██    ██  ██████   ████████  ██████
-->

<h2 id="changes">
Changes</h2>

	Changes since the <a href="https://www.w3.org/TR/2018/WD-css-align-3-20180830/">30 August 2018 Working Draft</a> consist of some minor clarifications.

	Changes since the <a href="https://www.w3.org/TR/2018/WD-css-align-3-20180423/">23 April 2018 Working Draft</a> include:
	<ul>
		<li>Better definition of how the alignment properties interact with absolutely-positioned boxes with ''left/auto'' offsets.
		See [[#justify-abspos]], [[#align-abspos]], [[#abspos-sizing]], and [[#staticpos-rect]].
		<li>More detailed definition of how the <a>content-distribution properties</a> work on <a>scroll containers</a>.
		See [[#overflow-scroll-position]].
		<li>Noted CSS2’s special rules about the baselines of inline-block <a>scroll containers</a>.
		<li>Defined that percentage gaps compute against zero when calculating intrinsic sizes, and resolve during layout. (<a href="https://github.com/w3c/csswg-drafts/issues/509">Issue 509</a>)
		<li>Miscellaneous minor clarifications.
	</ul>

	Changes since the <a href="https://www.w3.org/TR/2017/WD-css-align-3-20170906/">6 September 2017 Working Draft</a> include:
	<ul>
		<li>Added more illustrations! Many thanks to Melanie Richards for working through a difficult diagramming problem.
		<li>Fixed errors in property definition table of 'gap' shorthand.
		<li>Defining percentage gaps to resolve to zero when the containing block’s size depends on the gaps.
		(<a href="https://github.com/w3c/csswg-drafts/issues/509">Issue 509</a>,
		<a href="https://github.com/w3c/csswg-drafts/issues/2297">Issue 2297</a>)
		<li>Fixed errors in handling <css>left</css> and <css>right</css> in the grammars.
		<li>Fixed discrepancy in ''align-content/space-align'' fallback alignment.
		(<a href="https://github.com/w3c/csswg-drafts/issues/2316">Issue 2316</a>)
		<li>Tightened up handling of baseline alignment in cases where the box edges don't align.
		(<a href="https://github.com/w3c/csswg-drafts/issues/1556">Issue 1556</a>,
		<a href="https://github.com/w3c/csswg-drafts/issues/1611">Issue 1611</a>)
		<li>Miscellaneous clarifications.
	</ul>

	Changes since the <a href="https://www.w3.org/TR/2017/WD-css-align-3-20170720/#changes">20 July 2017 Working Draft</a> include:
	<ul>
		<li>Added the 'row-gap' and 'column-gap' properties and 'gap' shorthand,
			applying them to both <a>grid layout</a> and <a>flex layout</a>
			to replace the grid-specific 'grid-row-gap'/'grid-column-gap'/'grid-gap' properties.
	</ul>

	Changes since the <a href="https://www.w3.org/TR/2017/WD-css-align-3-20170515/">15 May 2017 Working Draft</a> include:
	<ul>
		<li>Dropped the ''left'' and ''right'' keywords from 'align-self' and 'align-content'.
			They may be re-introduced in a later level if there is demand.
			(<a href="https://github.com/w3c/csswg-drafts/issues/1403">Issue 1403</a>)
		<li>Assigned ''end'' fallback alignment to ''align-self/stretch'' cases when combined with ''last baseline'' content-alignment.
		<li>Disabled baseline alignment across cells in a table column,
			due to implementation complexity.
		<li>A large number of minor corrections and clarifications <a href="https://github.com/w3c/csswg-drafts/issues?q=is%3Aissue+label%3Acss-align-3+author%3Adbaron">reported by David Baron</a>.
	</ul>

	Changes since the <a href="https://www.w3.org/TR/2017/WD-css-align-3-20170407/">7 April 2017 Working Draft</a> include:
	<ul>
		<li>Adding a section to clarify handling of partial implementations.
			(<a href="https://github.com/w3c/csswg-drafts/issues/1167">Issue 1167</a>)
		<li>Dropped <<baseline-position>> value of 'justify-content' since it can't do anything anyway.
			(<a href="https://github.com/w3c/csswg-drafts/issues/1184">Issue 1184</a>)
		<li>Deferred ability to specify fallback alignments to Level 4.
			(<a href="https://github.com/w3c/csswg-drafts/issues/1002#issuecomment-295143297">Issue 1002</a>)
		<li>Fixed position of <<overflow-position>> wrt <<content-position>>.
			(<a href="https://github.com/w3c/csswg-drafts/issues/1001">Issue 1001</a>)
		<li>Fixed rules for handling baseline-aligned boxes being aligned along their block axis.
			(<a href="https://github.com/w3c/csswg-drafts/issues/1038">Issue 1038</a>)
		<li>Renamed ''justify-items: auto'' to ''justify-items: legacy''.
			(<a href="https://github.com/w3c/csswg-drafts/issues/1318">Issue 1318</a>)
		<li>Clamped baselines of scrollable boxes to the border edge, rather than margin edge.
			(<a href="https://github.com/w3c/csswg-drafts/issues/766">Issue 766</a>)
	</ul>

<h2 id="privacy-security">
Privacy and Security Considerations</h2>

	As a simple layout spec,
	this introduces no new privacy or security considerations.

<h2 class=no-num id="acknowledgments">
Acknowledgments</h2>

	Special thanks goes to David Baron, Javier Fernandez, Markus Mielke, Alex Mogilevsky,
	and the participants in the CSSWG's March 2008 F2F alignment discussions
	for their contributions to the alignment model described herein,
	and to Melanie Richards for her illustrations of the various <a href="#alignment-values">alignment keywords</a>.
