-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathOverview.html
1244 lines (991 loc) · 127 KB
/
Overview.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html><html lang=en><head>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<title>CSS Box Alignment Module Level 3</title>
<link href=../default.css rel=stylesheet type=text/css>
<link href=../csslogo.ico rel="shortcut icon" type=image/x-icon>
<link href=https://www.w3.org/StyleSheets/TR/W3C-WD rel=stylesheet type=text/css>
<style type=text/css>
.issue th:first-child { text-align: left !important; }
[rowspan] > img { float: right; }
[rowspan] { vertical-align: middle; }
table small { display: block; }
</style>
</head>
<body class=h-entry>
<div class=head>
<p data-fill-with=logo><a class=logo href=http://www.w3.org/>
<img alt=W3C height=48 src=https://www.w3.org/Icons/w3c_home width=72>
</a>
</p>
<h1 class="p-name no-ref" id=title>CSS Box Alignment Module Level 3</h1>
<h2 class="no-num no-toc no-ref heading settled" id=subtitle><span class=content>W3C Working Draft,
<time class=dt-updated datetime=2014-12-18>18 December 2014</time></span></h2>
<div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://www.w3.org/TR/2014/WD-css-align-3-20141218/>http://www.w3.org/TR/2014/WD-css-align-3-20141218/</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/css-align-3/>http://www.w3.org/TR/css-align-3/</a><dt>Editor's Draft:<dd><a href=http://dev.w3.org/csswg/css-align/>http://dev.w3.org/csswg/css-align/</a><dt>Previous Versions:<dd><a href=http://www.w3.org/TR/2013/WD-css3-align-20130514/ rel=previous>http://www.w3.org/TR/2013/WD-css3-align-20130514/</a><dd><a href=http://www.w3.org/TR/2012/WD-css3-align-20120612/ rel=previous>http://www.w3.org/TR/2012/WD-css3-align-20120612/</a><dt>Feedback:<dd><span><a href="mailto:www-style@w3.org?subject=%5Bcss-align%5D%20feedback">www-style@w3.org</a> with subject line “<kbd>[css-align] <var>… message topic …</var></kbd>” (<a href=http://lists.w3.org/Archives/Public/www-style/ rel=discussion>archives</a>)</span><dt>Issue Tracking:<dd><a href=http://www.w3.org/Style/CSS/Tracker/products/39>Tracker</a><dd><a href=#issues-index>Inline In Spec</a><dt class=editor>Editors:<dd class=editor><div class="p-author h-card vcard"><a class="p-name fn u-url url" href=http://fantasai.inkedblade.net/contact>Elika J. Etemad</a> (<span class="p-org org">Invited Expert</span>)</div><dd class=editor><div class="p-author h-card vcard"><a class="p-name fn u-url url" href=http://xanthir.com/contact/>Tab Atkins Jr.</a> (<span class="p-org org">Google</span>)</div></dl></div>
<div data-fill-with=warning></div>
<p class=copyright data-fill-with=copyright><a href=http://www.w3.org/Consortium/Legal/ipr-notice#Copyright>Copyright</a> © 2014 <a href=http://www.w3.org/><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href=http://www.csail.mit.edu/><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href=http://www.ercim.eu/><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href=http://www.keio.ac.jp/>Keio</a>, <a href=http://ev.buaa.edu.cn/>Beihang</a>), All Rights Reserved. W3C <a href=http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer>liability</a>, <a href=http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks>trademark</a> and <a href=http://www.w3.org/Consortium/Legal/copyright-documents>document use</a> rules apply.
</p>
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc no-ref heading settled" id=abstract><span class=content>Abstract</span></h2>
<div class=p-summary data-fill-with=abstract><p>This module contains the features of <a href=http://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 <a data-biblio-type=informative data-link-type=biblio href=#biblio-css3text title=CSS3TEXT>[CSS3TEXT]</a> and <a data-biblio-type=informative data-link-type=biblio href=#biblio-css3line title=CSS3LINE>[CSS3LINE]</a>.)</p>
<a href=http://www.w3.org/TR/CSS/>CSS</a> is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, in speech, etc.</div>
<h2 class="no-num no-toc no-ref heading settled" id=status><span class=content>Status of this document</span></h2>
<div data-fill-with=status><p><em>This section describes the status of this document at the time of
its publication. Other documents may supersede this document. A list of
current W3C publications and the latest revision of this technical report
can be found in the <a href=http://www.w3.org/TR/>W3C technical reports
index at http://www.w3.org/TR/.</a></em>
<p>Publication as a Working Draft does not imply endorsement by the W3C
Membership. This is a draft document and may be updated, replaced or
obsoleted by other documents at any time. It is inappropriate to cite this
document as other than work in progress.
<p>The (<a href=http://lists.w3.org/Archives/Public/www-style/>archived</a>) public
mailing list <a href=mailto:www-style@w3.org>www-style@w3.org</a> (see
<a href=http://www.w3.org/Mail/Request>instructions</a>) is preferred
for discussion of this specification. When sending e-mail, please put the
text “css-align” in the subject, preferably like this:
“[css-align] <em>…summary of comment…</em>”
<p>This document was produced by the <a href=http://www.w3.org/Style/CSS/members>CSS Working Group</a> (part of
the <a href=http://www.w3.org/Style/>Style Activity</a>).
<p>This document was produced by a group operating under the <a href=http://www.w3.org/Consortium/Patent-Policy-20040205/>5 February
2004 W3C Patent Policy</a>. W3C maintains a <a href=http://www.w3.org/2004/01/pp-impl/32061/status rel=disclosure>public list of any patent disclosures</a> made in
connection with the deliverables of the group; that page also includes
instructions for disclosing a patent. An individual who has actual
knowledge of a patent which the individual believes contains <a href=http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential>Essential
Claim(s)</a> must disclose the information in accordance with <a href=http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure>section
6 of the W3C Patent Policy</a>.</p>
<p>This document is governed by the <a href=http://www.w3.org/2014/Process-20140801/>1 August 2014 W3C Process Document</a>.
</div>
<div data-fill-with=at-risk><p>The following features are at-risk, and may be dropped during the CR period:
<ul><li><a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-last-baseline>last-baseline</a></ul></div>
<h2 class="no-num no-toc no-ref heading settled" id=contents><span class=content>Table of Contents</span></h2>
<div data-fill-with=table-of-contents role=navigation><ul class=toc role=directory><li><a href=#intro><span class=secno>1</span> <span class=content>
Introduction</span></a><ul class=toc><li><a href=#placement><span class=secno>1.1</span> <span class=content>
Module interactions</span></a><li><a href=#values><span class=secno>1.2</span> <span class=content>
Values</span></a></ul><li><a href=#overview><span class=secno>2</span> <span class=content>
Overview of Alignment Properties</span></a><li><a href=#alignment-values><span class=secno>3</span> <span class=content>
Alignment Values</span></a><ul class=toc><li><a href=#positional-values><span class=secno>3.1</span> <span class=content>
Positional Alignment: the <span class=css data-link-type=maybe title=center>center</span>, <span class=css data-link-type=maybe title=start>start</span>, <span class=css data-link-type=maybe title=end>end</span>, <span class=css data-link-type=maybe title=self-start>self-start</span>, <span class=css data-link-type=maybe title=self-end>self-end</span>, <span class=css data-link-type=maybe title=flex-start>flex-start</span>, <span class=css data-link-type=maybe title=flex-end>flex-end</span>, <span class=css data-link-type=maybe title=left>left</span>, and <span class=css data-link-type=maybe title=right>right</span> keywords</span></a><li><a href=#baseline><span class=secno>3.2</span> <span class=content>
Baseline Alignment: the <span class=css data-link-type=maybe title=baseline>baseline</span> and <span class=css data-link-type=maybe title=last-baseline>last-baseline</span> keywords</span></a><li><a href=#distribution-values><span class=secno>3.3</span> <span class=content>
Distributed Alignment: the <span class=css data-link-for="" data-link-type=maybe title=stretch>stretch</span>, <span class=css data-link-type=maybe title=space-between>space-between</span>, <span class=css data-link-type=maybe title=space-around>space-around</span>, and <span class=css data-link-type=maybe title=space-evenly>space-evenly</span> keywords</span></a><li><a href=#overflow-values><span class=secno>3.4</span> <span class=content>
Overflow Alignment: the <span class=css data-link-type=maybe title=safe>safe</span> and <span class=css data-link-type=maybe title=true>true</span> keywords</span></a></ul><li><a href=#content-distribution><span class=secno>4</span> <span class=content>
Content Distribution: the <span class=property data-link-type=propdesc title=justify-content>justify-content</span> and <span class=property data-link-type=propdesc title=align-content>align-content</span> properties</span></a><ul class=toc><li><a href=#baseline-align-content><span class=secno>4.1</span> <span class=content>
Baseline Content-Alignment</span></a><li><a href=#overflow-scroll-position><span class=secno>4.2</span> <span class=content>
Overflow and Scroll Positions</span></a></ul><li><a href=#self-alignment><span class=secno>5</span> <span class=content>
Self-Alignment: Aligning the Box within its Parent</span></a><ul class=toc><li><a href=#justify-self-property><span class=secno>5.1</span> <span class=content>
Inline/Main-Axis Alignment: the <span class=property data-link-type=propdesc title=justify-self>justify-self</span> property</span></a><li><a href=#align-self-property><span class=secno>5.2</span> <span class=content>
Block/Cross-Axis Alignment: the <span class=property data-link-type=propdesc title=align-self>align-self</span> property</span></a><li><a href=#baseline-align-self><span class=secno>5.3</span> <span class=content>
Baseline Self-Alignment</span></a></ul><li><a href=#default-alignment><span class=secno>6</span> <span class=content>
Default Alignment</span></a><ul class=toc><li><a href=#justify-items-property><span class=secno>6.1</span> <span class=content>
Inline/Main-Axis Alignment: the <span class=property data-link-type=propdesc title=justify-items>justify-items</span> property</span></a><li><a href=#align-items-property><span class=secno>6.2</span> <span class=content>
Block/Cross-Axis Alignment: the <span class=property data-link-type=propdesc title=align-items>align-items</span> property</span></a></ul><li><a href=#baseline-rules><span class=secno>7</span> <span class=content>
Baseline Alignment Details</span></a><ul class=toc><li><a href=#baseline-export><span class=secno>7.1</span> <span class=content>
Determining the Baseline of a Box</span></a><li><a href=#baseline-terms><span class=secno>7.2</span> <span class=content>
Baseline Alignment Terminology</span></a><li><a href=#align-by-baseline><span class=secno>7.3</span> <span class=content>
Aligning Boxes by Baseline</span></a></ul><li><a href=#changes><span class=secno>8</span> <span class=content>
Changes</span></a><li><a href=#acknowledgments><span class=secno></span> <span class=content>
Acknowledgments</span></a><li><a href=#conformance><span class=secno></span> <span class=content>
Conformance</span></a><ul class=toc><li><a href=#conventions><span class=secno></span> <span class=content>
Document conventions</span></a><li><a href=#conformance-classes><span class=secno></span> <span class=content>
Conformance classes</span></a><li><a href=#partial><span class=secno></span> <span class=content>
Partial implementations</span></a><li><a href=#experimental><span class=secno></span> <span class=content>
Experimental implementations</span></a><li><a href=#testing><span class=secno></span> <span class=content>
Non-experimental implementations</span></a></ul><li><a href=#references><span class=secno></span> <span class=content>References</span></a><ul class=toc><li><a href=#normative><span class=secno></span> <span class=content>Normative References</span></a><li><a href=#informative><span class=secno></span> <span class=content>Informative References</span></a></ul><li><a href=#index><span class=secno></span> <span class=content>Index</span></a><li><a href=#property-index><span class=secno></span> <span class=content>Property Index</span></a><li><a href=#issues-index><span class=secno></span> <span class=content>Issues Index</span></a></ul></div>
<main>
<h2 class="heading settled" data-level=1 id=intro><span class=secno>1. </span><span class=content>
Introduction</span><a class=self-link href=#intro></a></h2>
<p><em>This section is not normative.</em></p>
<p>CSS Levels 1 and 2 allowed for the alignment of text via <a class=property data-link-type=propdesc href=http://www.w3.org/TR/css-text-3/#text-align>text-align</a> and
the alignment of blocks by balancing <span class=css data-link-for=margin>auto</span> margins. However, except in
table cells, vertical alignment was not possible. As CSS3 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.</p>
<p class=note role=note>Note: The alignment of text and inline-level content is defined in <a data-biblio-type=informative data-link-type=biblio href=#biblio-css3text title=CSS3TEXT>[CSS3TEXT]</a> and <a data-biblio-type=informative data-link-type=biblio href=#biblio-css3line title=CSS3LINE>[CSS3LINE]</a>.</p>
<p>Inspiration for this document:</p>
<ul>
<li><a href=http://wiki.csswg.org/ideas/centering#alignment-property>summary of a discussion for implementing <CENTER></a>
<li><a href=https://lists.w3.org/Archives/Member/w3c-css-wg/2008AprJun/0015.html>Minutes from March 2008 F2F</a>
<li><a href=http://lists.w3.org/Archives/Public/www-style/2012Feb/0743.html>fantasai’s attempt to merge all alignment properties</a>
</ul>
<h3 class="heading settled" data-level=1.1 id=placement><span class=secno>1.1. </span><span class=content>
Module interactions</span><a class=self-link href=#placement></a></h3>
<p>This module adds some new alignment capabilities to the block layout
model described in <a data-biblio-type=normative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a> chapters 9 and 10 and defines the interaction
of these properties with the alignment of table cell content using
<a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align>vertical-align</a>, as defined in <a data-biblio-type=normative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a> chapter 17.
The interaction of these properties with
Grid Layout <a data-biblio-type=normative data-link-type=biblio href=#biblio-css3-grid-layout title=CSS3-GRID-LAYOUT>[CSS3-GRID-LAYOUT]</a>
and Flexible Box Layout <a data-biblio-type=normative data-link-type=biblio href=#biblio-css3-flexbox title=CSS3-FLEXBOX>[CSS3-FLEXBOX]</a>
is defined in their respective modules.</p>
<p>No properties in this module apply to the <code>::first-line</code> or
<code>::first-letter</code> pseudo-elements.</p>
<h3 class="heading settled" data-level=1.2 id=values><span class=secno>1.2. </span><span class=content>
Values</span><a class=self-link href=#values></a></h3>
<p>This specification follows the
<a href=http://www.w3.org/TR/CSS21/about.html#property-defs>CSS property
definition conventions</a> from <a data-biblio-type=normative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a>. Value types not defined in
this specification are defined in CSS Level 2 Revision 1 <a data-biblio-type=normative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a>.
Other CSS modules may expand the definitions of these value types: for
example <a data-biblio-type=informative data-link-type=biblio href=#biblio-css3val title=CSS3VAL>[CSS3VAL]</a>, when combined with this module, adds the
<span class=css>initial</span> keyword as a possible property value.</p>
<p>In addition to the property-specific values listed in their definitions,
all properties defined in this specification also accept the
<a href=http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit>inherit</a>
keyword as their property value. For readability it has not been repeated
explicitly.</p>
<h2 class="heading settled" data-level=2 id=overview><span class=secno>2. </span><span class=content>
Overview of Alignment Properties</span><a class=self-link href=#overview></a></h2>
<p>The <dfn data-dfn-type=dfn data-noexport="" id=box-alignment-properties>box alignment properties<a class=self-link href=#box-alignment-properties></a></dfn> in CSS are a set of 6 properties
that control alignment of boxes within other boxes.
They can be described along two axises:</p>
<ul>
<li>which dimension they apply to (inline vs. stacking), and
<li>whether they control the position of the box within its parent, or the box’s content within itself.
</ul>
<p class=note role=note>Note: This specification uses the terms “justify” and “align” to distinguish
between alignment in the inline and stacking 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.</p>
<p>The following table summarizes the <a data-link-type=dfn href=#box-alignment-properties>box alignment properties</a>
and the display types they can apply to.</p>
<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><a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a>
<td>inline
<td rowspan=2>
<img alt="" height=106 src=images/content-example.svg width=106>
content within element
<small>(effectively adjusts padding)</small>
<td>block containers, <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-container>flex containers</a>, and <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-container>grid containers</a>
<tr>
<th><a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a>
<td>stacking
<td>block containers, <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-container>flex containers</a>, and <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-container>grid containers</a>
<tbody>
<tr>
<th><a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a>
<td>inline
<td rowspan=2>
<img alt="" height=106 src=images/self-example.svg width=106>
element within parent
<small>(effectively adjusts margins)</small>
<td>block-level elements and <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-item>grid items</a>
<tr>
<th><a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a>
<td>stacking
<td><a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-item>flex items</a> and <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-item>grid items</a>
<tbody>
<tr>
<th><a class=property data-link-type=propdesc href=#propdef-justify-items>justify-items</a>
<td>inline
<td rowspan=2>
<img alt="" height=106 src=images/items-example.svg width=106>
items inside element
<small>(controls child items’ <span class=css data-link-for=align>justify-self: auto</span>)</small>
<td><a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-container>grid containers</a>
<tr>
<th><a class=property data-link-type=propdesc href=#propdef-align-items>align-items</a>
<td>stacking
<td><a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-container>flex containers</a> and <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-container>grid containers</a>
</table>
<p class=note role=note>Note: The <a class=property data-link-type=propdesc>*-items</a> values don’t affect the element itself.
When set on a flex container or grid container,
they specify the interpretation of any <span class=css>*-self: auto</span> used on the items in the container element.</p>
<h2 class="heading settled" data-level=3 id=alignment-values><span class=secno>3. </span><span class=content>
Alignment Values</span><a class=self-link href=#alignment-values></a></h2>
<p>All of the alignment properties use a common set of values,
defined below.</p>
<dl>
<dt><dfn data-dfn-type=dfn data-export="" id=alignment-subject>alignment subject<a class=self-link href=#alignment-subject></a></dfn>
<dd>
The <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is the thing or things being aligned by the property.
For <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a> and <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a>,
the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is the margin box of the box the property is set on.
For <a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a> and <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a>,
the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is defined by the layout mode.
<dt><dfn data-dfn-type=dfn data-export="" id=alignment-container>alignment container<a class=self-link href=#alignment-container></a></dfn>
<dd>
The <a data-link-type=dfn href=#alignment-container>alignment container</a> is the rectangle that the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is aligned within.
This is defined by the layout mode,
but is usually the <a data-link-type=dfn href=#alignment-subject>alignment subject</a>’s containing block.
</dl>
<h3 class="heading settled" data-level=3.1 id=positional-values><span class=secno>3.1. </span><span class=content>
Positional Alignment: the <a class=css data-link-type=maybe href=#valdef-self-position-content-position-center>center</a>, <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a>, <a class=css data-link-type=maybe href=#valdef-self-position-content-position-end>end</a>, <a class=css data-link-type=maybe href=#valdef-self-position-self-start>self-start</a>, <a class=css data-link-type=maybe href=#valdef-self-position-self-end>self-end</a>, <a class=css data-link-type=maybe href=#valdef-self-position-content-position-flex-start>flex-start</a>, <a class=css data-link-type=maybe href=#valdef-self-position-content-position-flex-end>flex-end</a>, <a class=css data-link-type=maybe href=#valdef-self-position-content-position-left>left</a>, and <a class=css data-link-type=maybe href=#valdef-self-position-content-position-right>right</a> keywords</span><a class=self-link href=#positional-values></a></h3>
<p>The positional alignment keywords specify a position for an <a data-link-type=dfn href=#alignment-subject>alignment subject</a>
with respect to its <a data-link-type=dfn href=#alignment-container>alignment container</a>.</p>
<p>The <a class="production css" data-link-type=type href=#typedef-self-position><self-position></a> set of values is used by <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a> and <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a>
to align the box within its <a data-link-type=dfn href=#alignment-container>alignment container</a>,
and also by <a class=property data-link-type=propdesc href=#propdef-justify-items>justify-items</a> and <a class=property data-link-type=propdesc href=#propdef-align-items>align-items</a>
(to specify default values for <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a> and <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a>).
The <a class="production css" data-link-type=type href=#typedef-content-position><content-position></a> set of values is used by <a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a> and <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a>
to align the box’s contents within itself.</p>
<pre class=prod><dfn data-dfn-type=type data-export="" id=typedef-self-position><self-position><a class=self-link href=#typedef-self-position></a></dfn> = center <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> start <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> end <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> self-start <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> self-end <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a>
flex-start <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> flex-end <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> left <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> right;
<dfn data-dfn-type=type data-export="" id=typedef-content-position><content-position><a class=self-link href=#typedef-content-position></a></dfn> = center <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> start <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> end <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> flex-start <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> flex-end <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> left <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> right;
</pre>
<p>Values have the following meanings:</p>
<dl data-dfn-type=value>
<dt><dfn class=css data-dfn-for="<self-position>, <content-position>" data-dfn-type=value data-export="" id=valdef-self-position-content-position-center>center<a class=self-link href=#valdef-self-position-content-position-center></a></dfn> <small>(self, content)</small>
<dd>Centers the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> within its <a data-link-type=dfn href=#alignment-container>alignment container</a>.
<dt><dfn class=css data-dfn-for="<self-position>, <content-position>" data-dfn-type=value data-export="" id=valdef-self-position-content-position-start>start<a class=self-link href=#valdef-self-position-content-position-start></a></dfn> <small>(self, content)</small>
<dd>Aligns the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> to be flush with the <a data-link-type=dfn href=#alignment-container>alignment container</a>’s start edge.
<dt><dfn class=css data-dfn-for="<self-position>, <content-position>" data-dfn-type=value data-export="" id=valdef-self-position-content-position-end>end<a class=self-link href=#valdef-self-position-content-position-end></a></dfn> <small>(self, content)</small>
<dd>Aligns the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> to be flush with the <a data-link-type=dfn href=#alignment-container>alignment container</a>’s end edge.
<dt><dfn class=css data-dfn-for="<self-position>" data-dfn-type=value data-export="" id=valdef-self-position-self-start>self-start<a class=self-link href=#valdef-self-position-self-start></a></dfn> <small>(self)</small>
<dd>Aligns the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> to be flush with the edge of the <a data-link-type=dfn href=#alignment-container>alignment container</a>
corresponding to the <a data-link-type=dfn href=#alignment-subject>alignment subject</a>’s start side.
<dt><dfn class=css data-dfn-for="<self-position>" data-dfn-type=value data-export="" id=valdef-self-position-self-end>self-end<a class=self-link href=#valdef-self-position-self-end></a></dfn> <small>(self)</small>
<dd>Aligns the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> to be flush with the edge of the <a data-link-type=dfn href=#alignment-container>alignment container</a>
corresponding to the <a data-link-type=dfn href=#alignment-subject>alignment subject</a>’s end side.
<dt><dfn class=css data-dfn-for="<self-position>, <content-position>" data-dfn-type=value data-export="" id=valdef-self-position-content-position-flex-start>flex-start<a class=self-link href=#valdef-self-position-content-position-flex-start></a></dfn> <small>(self, content)</small>
<dd><strong>Only used in flex layout.</strong> <a data-biblio-type=normative data-link-type=biblio href=#biblio-css3-flexbox title=CSS3-FLEXBOX>[CSS3-FLEXBOX]</a>
Aligns the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> to be flush with the edge of the <a data-link-type=dfn href=#alignment-container>alignment container</a>
corresponding to the <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-container>flex container</a>’s main-start or cross-start side, as appropriate.
When used in layout modes other than Flexbox,
this value computes to <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a>.
<dt><dfn class=css data-dfn-for="<self-position>, <content-position>" data-dfn-type=value data-export="" id=valdef-self-position-content-position-flex-end>flex-end<a class=self-link href=#valdef-self-position-content-position-flex-end></a></dfn> <small>(self, content)</small>
<dd><strong>Only used in flex layout.</strong>
Aligns the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> to be flush with the edge of the <a data-link-type=dfn href=#alignment-container>alignment container</a>
corresponding to the <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-container>flex container</a>’s main-end or cross-end side, as appropriate.
When used in layout modes other than Flexbox,
this value computes to <a class=css data-link-type=maybe href=#valdef-self-position-content-position-end>end</a>.
<dt><dfn class=css data-dfn-for="<self-position>, <content-position>" data-dfn-type=value data-export="" id=valdef-self-position-content-position-left>left<a class=self-link href=#valdef-self-position-content-position-left></a></dfn> <small>(self, content)</small>
<dd>Aligns the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> to be flush with the <a data-link-type=dfn href=#alignment-container>alignment container</a>’s <a href=http://www.w3.org/TR/css3-writing-modes/#line-left>line-left</a> edge.
If the property’s axis is not parallel with the inline axis,
this value computes to <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a>.
<dt><dfn class=css data-dfn-for="<self-position>, <content-position>" data-dfn-type=value data-export="" id=valdef-self-position-content-position-right>right<a class=self-link href=#valdef-self-position-content-position-right></a></dfn> <small>(self, content)</small>
<dd>Aligns the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> to be flush with the <a data-link-type=dfn href=#alignment-container>alignment container</a>’s <a href=http://www.w3.org/TR/css3-writing-modes/#line-right>line-right</a> edge.
If the property’s axis is not parallel with the inline axis,
this value computes to <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a>.
</dl>
<p class=issue id=issue-511afb43><a class=self-link href=#issue-511afb43></a>
Add example images.
<h3 class="heading settled" data-level=3.2 id=baseline><span class=secno>3.2. </span><span class=content>
Baseline Alignment: the <a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-baseline>baseline</a> and <a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-last-baseline>last-baseline</a> keywords</span><a class=self-link href=#baseline></a></h3>
<p><dfn data-dfn-type=dfn data-noexport="" id=baseline-alignment>Baseline alignment<a class=self-link href=#baseline-alignment></a></dfn> is a form of positional alignment
that aligns multiple <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> within a <a data-link-type=dfn href=#shared-alignment-context>shared alignment context</a> (such as cells within a row or column)
by matching up their <a data-link-type=dfn href=#alignment-baseline>alignment baselines</a>.</p>
<p>The baseline alignment keywords are:</p>
<pre class=prod><dfn data-dfn-type=type data-export="" id=typedef-baseline-position><baseline-position><a class=self-link href=#typedef-baseline-position></a></dfn> = baseline <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> last-baseline
</pre>
<p>and are defined below:</p>
<dl data-dfn-for="justify-content, justify-self, justify-items, align-content, align-self, align-items" data-dfn-type=value>
<dt><dfn class=css data-dfn-for="justify-content, justify-self, justify-items, align-content, align-self, align-items" data-dfn-type=value data-export="" id=valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-baseline>baseline<a class=self-link href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-baseline></a></dfn>
<dd>
Indicates <dfn data-dfn-type=dfn data-noexport="" id=first-baseline-alignment>first-baseline alignment<a class=self-link href=#first-baseline-alignment></a></dfn>:
aligns one of the box’s <a data-link-type=dfn href=#first-baselines>first baselines</a>
with the corresponding <a data-link-type=dfn href=#first-baselines>first baselines</a>
of all the boxes in its <a data-link-type=dfn href=#baseline-sharing-group>baseline-sharing group</a>.
<p>If the <a data-link-type=dfn href=#alignment-subject>alignment subject</a>’s position is not fully determined by <a data-link-type=dfn href=#baseline-alignment>baseline alignment</a>,
the content is <a class=css data-link-type=maybe href=#valdef-self-position-self-start>self-start</a>-aligned insofar as possible while preserving the baseline alignment.
(Content that has no <a data-link-type=dfn href=#first-baselines>first baselines</a> is thus start-aligned.)</p>
<dt><dfn class=css data-dfn-for="justify-content, justify-self, justify-items, align-content, align-self, align-items" data-dfn-type=value data-export="" id=valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-last-baseline>last-baseline<a class=self-link href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-last-baseline></a></dfn>
<dd>
Indicates <dfn data-dfn-type=dfn data-noexport="" id=last-baseline-alignment>last-baseline alignment<a class=self-link href=#last-baseline-alignment></a></dfn>:
aligns one of the box’s <a data-link-type=dfn href=#last-baselines>last baselines</a>
with the corresponding <a data-link-type=dfn href=#last-baselines>last baselines</a>
of all the boxes in its <a data-link-type=dfn href=#baseline-sharing-group>baseline-sharing group</a>.
<p>If the <a data-link-type=dfn href=#alignment-subject>alignment subject</a>’s position is not fully determined by <a data-link-type=dfn href=#baseline-alignment>baseline alignment</a>,
the content is <a class=css data-link-type=maybe href=#valdef-self-position-self-end>self-end</a>-aligned insofar as possible while preserving the baseline alignment.
(Content that has no <a data-link-type=dfn href=#last-baselines>last baselines</a> is thus end-aligned.)</p>
</dl>
<p>These values give a box a <dfn data-dfn-type=dfn data-noexport="" id=baseline-alignment-preference>baseline alignment preference<a class=self-link href=#baseline-alignment-preference></a></dfn>:
either "first" or "last", respectively.</p>
<p>When specified for <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a>/<a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a>,
these values trigger <a data-link-type=dfn href=#baseline-content-alignment>baseline content-alignment</a>,
shifting the content of the box within the box,
and may also affect the sizing of the box itself.
See <a data-section="" href=#baseline-align-content>§4.1
Baseline Content-Alignment</a>.</p>
<p>When specified for <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a>/<a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a>,
these values trigger <a data-link-type=dfn href=#baseline-self-alignment>baseline self-alignment</a>,
shifting the entire box within its container,
which may affect the sizing of its container.
See <a data-section="" href=#baseline-align-self>§5.3
Baseline Self-Alignment</a>.</p>
<p>If both <a data-link-type=dfn href=#baseline-content-alignment>baseline content-alignment</a> <em>and</em> <a data-link-type=dfn href=#baseline-self-alignment>baseline self-alignment</a> are specified in the same axis on the same box,
only <a data-link-type=dfn href=#baseline-self-alignment>baseline self-alignment</a> is honored in that axis;
the content-alignment in that axis must be treated as <a class=css data-link-type=maybe href=#valdef-self-position-self-start>self-start</a>.</p>
<p class=issue id=issue-ba851208><a class=self-link href=#issue-ba851208></a>The previous paragraph is fairly arbitrary.
Need some experience to make sure it’s the correct choice out of the two possibilities.</p>
<p class=issue id=issue-13b9ed6a><a class=self-link href=#issue-13b9ed6a></a>Add example images here.
<p class=note role=note>Note: The <a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align>vertical-align</a> property will also need a <span class=css>first-baseline</span> value
because per CSS2.1 for inline blocks, <a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-baseline>baseline</a> is equivalent to <a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-last-baseline>last-baseline</a>.</p>
<h3 class="heading settled" data-level=3.3 id=distribution-values><span class=secno>3.3. </span><span class=content>
Distributed Alignment: the <a class=css data-link-for="" data-link-type=maybe href=#valdef-content-distribution-stretch>stretch</a>, <a class=css data-link-type=maybe href=#valdef-content-distribution-space-between>space-between</a>, <a class=css data-link-type=maybe href=#valdef-content-distribution-space-around>space-around</a>, and <a class=css data-link-type=maybe href=#valdef-content-distribution-space-evenly>space-evenly</a> keywords</span><a class=self-link href=#distribution-values></a></h3>
<p>The distribution values are used by <a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a> and <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a>
to distribute the <a data-link-type=dfn href=#alignment-subject>alignment subjects</a>
evenly between the start and end edges of the <a data-link-type=dfn href=#alignment-container>alignment container</a>.
When the <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> cannot be distributed in this way,
they behave as their <dfn data-dfn-type=dfn data-export="" id=fallback-alignment>fallback alignment<a class=self-link href=#fallback-alignment></a></dfn>.
Each distribution value has an associated <a class="production css" data-link-type=type href=#typedef-content-position><content-position></a> as a <a data-link-type=dfn href=#fallback-alignment>fallback alignment</a>,
but one can alternatively be explicitly specified in the property.</p>
<pre class=prod><dfn data-dfn-type=type data-export="" id=typedef-content-distribution><content-distribution><a class=self-link href=#typedef-content-distribution></a></dfn> = space-between <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> space-around <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> space-evenly <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> stretch</pre>
<dl data-dfn-for="<content-distribution>" data-dfn-type=value>
<dt><dfn class=css data-dfn-for="<content-distribution>" data-dfn-type=value data-export="" id=valdef-content-distribution-space-between>space-between<a class=self-link href=#valdef-content-distribution-space-between></a></dfn>
<dd>
The <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> are evenly distributed in the <a data-link-type=dfn href=#alignment-container>alignment container</a>.
The first <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is placed flush with the start edge of the <a data-link-type=dfn href=#alignment-container>alignment container</a>,
the last <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is placed flush with the end edge of the <a data-link-type=dfn href=#alignment-container>alignment container</a>,
and the remaining <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> are distributed so that the spacing between any two adjacent <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> is the same.
Unless otherwise specified,
this value falls back to <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a>.
<dt><dfn class=css data-dfn-for="<content-distribution>" data-dfn-type=value data-export="" id=valdef-content-distribution-space-around>space-around<a class=self-link href=#valdef-content-distribution-space-around></a></dfn>
<dd>
The <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> are evenly distributed in the <a data-link-type=dfn href=#alignment-container>alignment container</a>,
with a half-size space on either end.
The <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> are distributed so that the spacing between any two adjacent <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> is the same,
and the spacing before the first and after the last <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is half the size of the other spacing.
Unless otherwise specified,
this value falls back to <a class=css data-link-type=maybe href=#valdef-self-position-content-position-center>center</a>.
<dt><dfn class=css data-dfn-for="<content-distribution>" data-dfn-type=value data-export="" id=valdef-content-distribution-space-evenly>space-evenly<a class=self-link href=#valdef-content-distribution-space-evenly></a></dfn>
<dd>
The <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> are evenly distributed in the <a data-link-type=dfn href=#alignment-container>alignment container</a>,
with a full-size space on either end.
The <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> are distributed so that the spacing between any two adjacent <a data-link-type=dfn href=#alignment-subject>alignment subjects</a>,
before the first <a data-link-type=dfn href=#alignment-subject>alignment subject</a>,
and after the last <a data-link-type=dfn href=#alignment-subject>alignment subject</a>
is the same.
Unless otherwise specified,
this value falls back to <a class=css data-link-type=maybe href=#valdef-self-position-content-position-center>center</a>.
<dt><dfn class=css data-dfn-for="<content-distribution>" data-dfn-type=value data-export="" id=valdef-content-distribution-stretch>stretch<a class=self-link href=#valdef-content-distribution-stretch></a></dfn>
<dd>
If the combined size of the <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> is less than the size of the <a data-link-type=dfn href=#alignment-container>alignment container</a>,
any <span class=css data-link-for=width>auto</span>-sized <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> have their size increased equally (not proportionally),
while still respecting the constraints imposed by <a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visudet.html#propdef-max-height>max-height</a>/<a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visudet.html#propdef-max-width>max-width</a>,
so that the combined size exactly fills the <a data-link-type=dfn href=#alignment-container>alignment container</a>.
<p>Unless otherwise specified,
this value falls back to <a class=css data-link-type=maybe href=#valdef-self-position-content-position-flex-start>flex-start</a>.
<span class=note role=note>(For layout modes other than flex layout, <a class=css data-link-type=maybe href=#valdef-self-position-content-position-flex-start>flex-start</a> is identical to <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a>.)</span></p>
<p class=issue id=issue-3ea08feb><a class=self-link href=#issue-3ea08feb></a>Should this value allow a fallback alignment on <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> and <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a>,
like it does on <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a> and <a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a>?</p>
</dl>
<p class=issue id=issue-77ee454e><a class=self-link href=#issue-77ee454e></a>
Add even more example images.
<h3 class="heading settled" data-level=3.4 id=overflow-values><span class=secno>3.4. </span><span class=content>
Overflow Alignment: the <a class=css data-link-type=maybe href=#valdef-overflow-position-safe>safe</a> and <a class=css data-link-type=maybe href=#valdef-overflow-position-true>true</a> keywords</span><a class=self-link href=#overflow-values></a></h3>
<p>When the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is larger than the <a data-link-type=dfn href=#alignment-container>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.</p>
<p>To help combat this problem,
an <dfn data-dfn-type=dfn data-export="" id=overflow-alignment>overflow alignment<a class=self-link href=#overflow-alignment></a></dfn> mode can be explicitly specified.
"True" 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.</p>
<p>If the <a data-link-type=dfn href=#overflow-alignment>overflow alignment</a> isn’t explicitly specified,
the default <a data-link-type=dfn href=#overflow-alignment>overflow alignment</a> is determined by the layout mode.
Document-centric layout modes, such as block layout, default to "safe" <a data-link-type=dfn href=#overflow-alignment>overflow alignment</a>,
while design-centric layout modes, such as flex layout, default to "true" <a data-link-type=dfn href=#overflow-alignment>overflow alignment</a>.</p>
<pre class=prod><dfn data-dfn-type=type data-export="" id=typedef-overflow-position><overflow-position><a class=self-link href=#typedef-overflow-position></a></dfn> = true <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> safe</pre>
<dl data-dfn-for="<overflow-position>" data-dfn-type=value>
<dt><dfn class=css data-dfn-for="<overflow-position>" data-dfn-type=value data-export="" id=valdef-overflow-position-safe>safe<a class=self-link href=#valdef-overflow-position-safe></a></dfn>
<dd>
If the size of the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> overflows the <a data-link-type=dfn href=#alignment-container>alignment container</a>,
the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is instead aligned as if the alignment mode were <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a>.
<dt><dfn class=css data-dfn-for="<overflow-position>" data-dfn-type=value data-export="" id=valdef-overflow-position-true>true<a class=self-link href=#valdef-overflow-position-true></a></dfn>
<dd>
Regardless of the relative sizes of the <a data-link-type=dfn href=#alignment-subject>alignment subject</a> and <a data-link-type=dfn href=#alignment-container>alignment container</a>,
the given alignment value is honored.
</dl>
<p class=issue id=issue-8fcc582f><a class=self-link href=#issue-8fcc582f></a>
Transplant example 10 from flexbox.
<h2 class="heading settled" data-level=4 id=content-distribution><span class=secno>4. </span><span class=content>
Content Distribution: the <a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a> and <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a> properties</span><a class=self-link href=#content-distribution></a></h2>
<p>The <dfn data-dfn-type=dfn data-export="" id=content-distribution-properties>content distribution properties<a class=self-link href=#content-distribution-properties></a></dfn> <a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a> and <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a>
control alignment of the box’s content within the box.</p>
<div class=figure>
<img alt="Diagram showing that the alignment of the content within the element is affected." height=212 src=images/content-example.svg width=212>
</div>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css data-dfn-type=property data-export="" id=propdef-justify-content>justify-content<a class=self-link href=#propdef-justify-content></a></dfn>, <dfn class=css data-dfn-type=property data-export="" id=propdef-align-content>align-content<a class=self-link href=#propdef-align-content></a></dfn><tr><th>Value:<td class=prod>auto <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> <a class="production css" data-link-type=type href=#typedef-baseline-position><baseline-position></a> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> <a class="production css" data-link-type=type href=#typedef-content-distribution><content-distribution></a> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-any>||</a> [ <a class="production css" data-link-type=type href=#typedef-overflow-position><overflow-position></a><a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt>?</a> && <a class="production css" data-link-type=type href=#typedef-content-position><content-position></a> ]<tr><th>Initial:<td>auto<tr><th>Applies to:<td>block containers, flex containers, and grid containers<tr><th>Inherited:<td>no<tr><th>Percentages:<td>n/a<tr><th>Media:<td>visual<tr><th>Computed value:<td>specified value, except for <span class=css data-link-for=justify-content>auto</span> (see prose)<tr><th>Animatable:<td>no</table>
<p>Aligns the contents of the box as a whole along the box’s inline/row/main axis.
Values other than <dfn class=css data-dfn-for="justify-content, align-content" data-dfn-type=value data-export="" id=valdef-justify-content-align-content-auto>auto<a class=self-link href=#valdef-justify-content-align-content-auto></a></dfn> are defined in <a data-section="" href=#alignment-values>§3
Alignment Values</a>, above.
If both a <a class="production css" data-link-type=type href=#typedef-content-distribution><content-distribution></a> and <a class="production css" data-link-type=type href=#typedef-content-position><content-position></a> are given,
the <a class="production css" data-link-type=type href=#typedef-content-position><content-position></a> provides an explicit <a data-link-type=dfn href=#fallback-alignment>fallback alignment</a>.</p>
<hr>
<dl>
<dt>Block Containers:
<dd>
The <a data-link-type=dfn href=#alignment-container>alignment container</a> is the <a data-link-type=dfn href=http://dev.w3.org/csswg/css-display-3/#block-container>block container</a>’s content box.
The <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is the entire contents of the block, as a unit.
<p>The <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a> property applies along the <a data-link-type=dfn href=http://www.w3.org/TR/css-writing-modes-3/#block-axis->block axis</a>,
but if a <a class="production css" data-link-type=type href=#typedef-content-distribution><content-distribution></a> is specified
the <a data-link-type=dfn href=#fallback-alignment>fallback alignment</a> is used instead.
The <a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a> property does not apply to and has no effect on block containers.</p>
<p>All values other than <span class=css data-link-for=justify-content>auto</span> force the block container to establish a new formatting context.
For table cells, the behavior of the <span class=css data-link-for=justify-content>auto</span> depends on the computed value of <a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align>vertical-align</a>:
<span class=css data-link-for=vertical-align>top</span> makes it behave as <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a>,
<span class=css data-link-for=vertical-align>middle</span> makes it behave as <a class=css data-link-type=maybe href=#valdef-self-position-content-position-center>center</a>,
<span class=css data-link-for=vertical-align>bottom</span> makes it behave as <a class=css data-link-type=maybe href=#valdef-self-position-content-position-end>end</a>,
and all other values make it behave as <a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-baseline>baseline</a>.
<span class=css data-link-for=justify-content>auto</span> otherwise behaves as <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a>.</p>
<dt>Multicol Layout:
<dd>
The <a data-link-type=dfn href=#alignment-container>alignment container</a> is the <a data-link-type=dfn href=http://www.w3.org/TR/css3-multicol/#multi-column-element>multi-column element</a>’s content box.
The <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is the column boxes, as a unit.
<p>The <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a> property applies along the <a data-link-type=dfn href=http://www.w3.org/TR/css-writing-modes-3/#block-axis->block axis</a>,
but if a <a class="production css" data-link-type=type href=#typedef-content-distribution><content-distribution></a> is specified
the <a data-link-type=dfn href=#fallback-alignment>fallback alignment</a> is used instead.
The <a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a> property does not apply to and has no effect on multi-column elements.</p>
<p><span class=css data-link-for=justify-content>auto</span> behaves as <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a>.</p>
<dt>Flex Containers:
<dd>
<span class=css data-link-for=justify-content>auto</span> computes to <a class=css data-link-for="" data-link-type=maybe href=#valdef-content-distribution-stretch>stretch</a>.
<p>The <a data-link-type=dfn href=#alignment-container>alignment container</a> is the <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-container>flex container</a>’s content box.
For <a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a>, the <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> are the <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-item>flex items</a> in each <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-line>flex line</a>;
for <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a>, the <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> are the <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-line>flex lines</a>.</p>
<p>The <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a> property applies along the <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#cross-axis>cross axis</a>.
The <a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a> property applies along the <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#main-axis>main axis</a>,
but since flexing in the <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#main-axis>main axis</a> is controlled by <a class=property data-link-type=propdesc href=http://www.w3.org/TR/css-flexbox-1/#propdef-flex>flex</a>,
<a class=css data-link-for="" data-link-type=maybe href=#valdef-content-distribution-stretch>stretch</a> behaves as <a class=css data-link-type=maybe href=#valdef-self-position-content-position-flex-start>flex-start</a>.</p>
<p>See <a data-biblio-type=normative data-link-type=biblio href=#biblio-css3-flexbox title=CSS3-FLEXBOX>[CSS3-FLEXBOX]</a> for details.</p>
<dt>Grid Containers:
<dd>
<span class=css data-link-for=justify-content>auto</span> computes to <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a>.
<p>The <a data-link-type=dfn href=#alignment-container>alignment container</a> is the <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-container>grid container</a>’s content box.
The <a data-link-type=dfn href=#alignment-subject>alignment subjects</a> are the <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-track>grid tracks</a>.</p>
<p>The <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a> property applies along the <a data-link-type=dfn href=http://www.w3.org/TR/css-writing-modes-3/#block-axis- title="block axis">block (column) axis</a>,
aligning the <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-row->grid rows</a>.
The <a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a> property applies along the <a data-link-type=dfn href=http://www.w3.org/TR/css-writing-modes-3/#inline-axis- title="inline axis">inline (row) axis</a>,
aligning the <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-column->grid columns</a>.</p>
<p>See <a data-biblio-type=normative data-link-type=biblio href=#biblio-css3-grid-layout title=CSS3-GRID-LAYOUT>[CSS3-GRID-LAYOUT]</a> for details.</p>
</dl>
<h3 class="heading settled" data-level=4.1 id=baseline-align-content><span class=secno>4.1. </span><span class=content>
Baseline Content-Alignment</span><a class=self-link href=#baseline-align-content></a></h3>
<p>The content of boxes participating in row-like layout contexts (<a data-link-type=dfn href=#shared-alignment-context>shared alignment contexts</a>)
can be baseline-aligned to each other.
This effectively increases the padding on the box
to align the <a data-link-type=dfn href=#alignment-baseline>alignment baseline</a> of its contents
with that of other baseline-aligned boxes in its <a data-link-type=dfn href=#baseline-sharing-group title="baseline-sharing group">group</a>.</p>
<p>The set of boxes that participate in <dfn data-dfn-type=dfn data-export="" id=baseline-content-alignment title="baseline content-alignment|first-baseline content-alignment|last-baseline content-alignment">baseline content-alignment<a class=self-link href=#baseline-content-alignment></a></dfn>
depends on the layout model:</p>
<dl>
<dt>Table Cells:
<dd>
A <a data-link-type=dfn>table cell</a> participates in first (last) <a data-link-type=dfn href=#baseline-content-alignment>baseline content-alignment</a>
in either its row or column (whichever matches its <a data-link-type=dfn href=http://www.w3.org/TR/css-writing-modes-3/#inline-axis->inline axis</a>)
if its computed <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a> is <a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-baseline>baseline</a> (<a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-last-baseline>last-baseline</a>).
<dt>Flex Items:
<dd>
A <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-item>flex item</a> participates in first (last) <a data-link-type=dfn href=#baseline-content-alignment>baseline content-alignment</a>
in its flex line if
its computed <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a> is <a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-baseline>baseline</a> (<a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-last-baseline>last-baseline</a>)
and its computed <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> is <span class=css data-link-for=align-self>stretch</span> or <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a> (<a class=css data-link-type=maybe href=#valdef-self-position-content-position-end>end</a>).
<dt>Grid Items:
<dd>
A <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-item>grid item</a> participates in first (last) <a data-link-type=dfn href=#baseline-content-alignment>baseline content-alignment</a>
in either its row or column (whichever matches its <a data-link-type=dfn href=http://www.w3.org/TR/css-writing-modes-3/#inline-axis->inline axis</a>)
if its computed <a class=property data-link-type=propdesc href=#propdef-align-content>align-content</a> is <a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-baseline>baseline</a> (<a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-last-baseline>last-baseline</a>),
and its computed <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> or <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a> (whichever affects its <a data-link-type=dfn href=http://www.w3.org/TR/css-writing-modes-3/#block-axis->block axis</a>) is <span class=css data-link-for=justify-self>stretch</span> or <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a> (<a class=css data-link-type=maybe href=#valdef-self-position-content-position-end>end</a>).
</dl>
<p>If a box spans multiple <a data-link-type=dfn href=#shared-alignment-context>shared alignment contexts</a>,
it participates in first (last) <a data-link-type=dfn href=#baseline-content-alignment>baseline content-alignment</a>
within its start-most (end-most) <a data-link-type=dfn href=#shared-alignment-context>shared alignment context</a> along that axis.</p>
<p>When a box participates in first (last) <a data-link-type=dfn href=#baseline-content-alignment>baseline content-alignment</a>
its <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is aligned to the start (end) edge of its <a data-link-type=dfn href=#alignment-container>alignment container</a>
and the minimum necessary extra space is added between its start (end) edge and the <a data-link-type=dfn href=#alignment-subject>alignment subject</a>
to match its <a data-link-type=dfn href=#alignment-baseline>alignment baseline</a> in that axis up to that of its <a data-link-type=dfn href=#baseline-sharing-group>baseline-sharing group</a>.
See <a data-section="" href=#align-by-baseline>§7.3
Aligning Boxes by Baseline</a>.
This increases the intrinsic size of the box.</p>
<h3 class="heading settled" data-level=4.2 id=overflow-scroll-position><span class=secno>4.2. </span><span class=content>
Overflow and Scroll Positions</span><a class=self-link href=#overflow-scroll-position></a></h3>
<p>The <a data-link-type=dfn href=#content-distribution-properties>content distribution properties</a> also affect the initial scroll position,
setting it to display the appropriate portion of the scrollable area.
In other words,
the scrollable area is aligned relative to the viewport
as specified by the <a data-link-type=dfn href=#content-distribution-properties>content distribution property</a>.</p>
<div class=example>
For example,
if a scrollable flex container is set to <a class=css data-link-type=propdesc href=#propdef-justify-content title=justify-content>justify-content: flex-end</a>
(or <a class=css data-link-type=propdesc href=#propdef-justify-content title=justify-content>justify-content: flex-start</a> with <a class=css data-link-type=propdesc href=http://www.w3.org/TR/css-flexbox-1/#propdef-flex-flow title=flex-flow>flex-flow: row-reverse</a>),
it will be initially displayed scrolled all the way to the main-end edge of the scrollable area,
and its content will overflow its main-start edge.
</div>
<p class=issue id=issue-f2f93187><a class=self-link href=#issue-f2f93187></a>This needs to be integrated with overflow-anchor, when the property exists,
so that you get the same behavior whether an elements *starts out* overflowing,
or is filled element-by-element.</p>
<h2 class="heading settled" data-level=5 id=self-alignment><span class=secno>5. </span><span class=content>
Self-Alignment: Aligning the Box within its Parent</span><a class=self-link href=#self-alignment></a></h2>
<p>The <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a> and <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> properties control alignment of the box within its containing block.</p>
<div class=figure>
<img alt="Diagram showing that the alignment of the element within its containing block is affected." height=212 src=images/self-example.svg width=212>
</div>
<h3 class="heading settled" data-level=5.1 id=justify-self-property><span class=secno>5.1. </span><span class=content>
Inline/Main-Axis Alignment: the <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a> property</span><a class=self-link href=#justify-self-property></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css data-dfn-type=property data-export="" id=propdef-justify-self>justify-self<a class=self-link href=#propdef-justify-self></a></dfn><tr><th>Value:<td class=prod>auto <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> stretch <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> <a class="production css" data-link-type=type href=#typedef-baseline-position><baseline-position></a> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> [ <a class="production css" data-link-type=type href=#typedef-overflow-position><overflow-position></a><a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt>?</a> && <a class="production css" data-link-type=type href=#typedef-self-position><self-position></a> ]<tr><th>Initial:<td>auto<tr><th>Applies to:<td>block-level boxes, absolutely-positioned boxes, and grid items<tr><th>Inherited:<td>no<tr><th>Percentages:<td>n/a<tr><th>Media:<td>visual<tr><th>Computed value:<td>specified value, except for <span class=css data-link-for=justify-self>auto</span> (see prose)<tr><th>Animatable:<td>no</table>
<p>Justifies the box within its parent along the inline/row/main axis:
the box’s outer edges are aligned within its <a data-link-type=dfn href=#alignment-container>alignment container</a>
<a href=#alignment-values>as described by its alignment value</a>.</p>
<p>The <dfn class=css data-dfn-for="justify-self, align-self" data-dfn-type=value data-export="" id=valdef-justify-self-align-self-auto>auto<a class=self-link href=#valdef-justify-self-align-self-auto></a></dfn> keyword computes to
itself on absolutely-positioned elements,
and to the computed value of <a class=property data-link-type=propdesc href=#propdef-justify-items>justify-items</a> on the parent
(minus any <a class=css data-link-type=maybe href=#valdef-justify-items-legacy>legacy</a> keywords) on all other boxes,
or <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a> if the box has no parent.
Its behavior depends on the layout model, as described below.</p>
<p>When the box’s computed <a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visudet.html#propdef-width>width</a>/<a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visudet.html#propdef-height>height</a> (as appropriate to the axis) is <span class=css data-link-for=width>auto</span>
and neither of its margins (in the appropriate axis) are <span class=css data-link-for=margin>auto</span>,
the <dfn data-dfn-for="justify-self, align-self" data-dfn-type=dfn data-noexport="" id=stretch>stretch<a class=self-link href=#stretch></a></dfn> keyword
sets the box’s used size to the length necessary to make its outer size
as close to filling the <a data-link-type=dfn href=#alignment-container>alignment container</a> as possible
while still respecting the constraints imposed by <a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visudet.html#propdef-min-height>min-height</a>/<a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visudet.html#propdef-min-width>min-width</a>/<a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visudet.html#propdef-max-height>max-height</a>/<a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visudet.html#propdef-max-width>max-width</a>.
Unless otherwise specified, this value falls back to <a class=css data-link-type=maybe href=#valdef-self-position-content-position-flex-start>flex-start</a>.</p>
<p>All other values are as defined in <a data-section="" href=#alignment-values>§3
Alignment Values</a>, above.</p>
<hr>
<dl>
<dt>Block-level Boxes:
<dd>
The <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a> property applies along its containing block’s <a data-link-type=dfn href=http://www.w3.org/TR/css-writing-modes-3/#inline-axis->inline axis</a>.
<p>The <a data-link-type=dfn href=#alignment-container>alignment container</a> is the block’s containing block
except that for block-level elements that establish a block formatting context
and are placed next to a float,
the <a data-link-type=dfn href=#alignment-container>alignment container</a> is reduced by the space taken up by the float.
(Note: This is the legacy behavior of HTML <code>align</code>.)
The <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is the block’s margin box.</p>
<p>The default <a data-link-type=dfn href=#overflow-alignment>overflow alignment</a> is <a class=css data-link-type=maybe href=#valdef-overflow-position-safe>safe</a>.
In terms of CSS2.1 block-level formatting <a data-biblio-type=normative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a>,
the rules for "over-constrained" computations in <a href=http://www.w3.org/TR/CSS21/visudet.html#blockwidth>section 10.3.3</a>
are ignored in favor of alignment as specified here
and the used value of the offset properties are not adjusted to correct for the over-constraint.</p>
<p>This property does not apply to floats.</p>
<dt>Absolutely-positioned Boxes:
<dd>
The <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a> property applies along its containing block’s <a data-link-type=dfn href=http://www.w3.org/TR/css-writing-modes-3/#inline-axis->inline axis</a>.
<p>When neither margin in this dimension is <span class=css data-link-for=margin>auto</span>
and neither offset property in this dimension is <span class=css data-link-for=top>auto</span>,
values other than <span class=css data-link-for=justify-self>stretch</span> cause <a href=http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width>non-replaced absolutely-positioned boxes</a>
to use shrink-to-fit sizing for calculating <span class=css data-link-for=width>auto</span> measures,
and <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a> dictates alignment as follows:</p>
<p>The <a data-link-type=dfn href=#alignment-container>alignment container</a> is the box’s containing block
as modified by the offset properties (<a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-positioning/#top>top</a>/<a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-positioning/#right>right</a>/<a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-positioning/#bottom>bottom</a>/<a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-positioning/#left>left</a>).
The <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is the box’s margin box.</p>
<p>The default <a data-link-type=dfn href=#overflow-alignment>overflow alignment</a> is <a class=css data-link-type=maybe href=#valdef-overflow-position-safe>safe</a>.
In terms of CSS2.1 formatting <a data-biblio-type=normative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a>,
the rules for "over-constrained" computations in <a href=http://www.w3.org/TR/CSS21/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 offset properties are not adjusted to correct for the over-constraint.</p>
<p>The <span class=css data-link-for=justify-self>auto</span> keyword is equivalent to <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a> on replaced absolutely-positioned boxes,
and equivalent to <span class=css data-link-for=justify-self>stretch</span> on all other absolutely-positioned boxes.
(This is because CSS 2.1 does not stretch replaced elements to fit into fixed offsets.)</p>
<dt>Table Cells:
<dd>
This property does not apply to table cells,
because their position and size is fully constrained by table layout.
<dt>Flex Items:
<dd>
This property does not apply to <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-item>flex items</a>,
because there is more than one item in the <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#main-axis>main axis</a>.
See <a class=property data-link-type=propdesc href=http://www.w3.org/TR/css-flexbox-1/#propdef-flex>flex</a> for stretching and <a class=property data-link-type=propdesc href=#propdef-justify-content>justify-content</a> for <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#main-axis>main-axis</a> alignment. <a data-biblio-type=normative data-link-type=biblio href=#biblio-css3-flexbox title=CSS3-FLEXBOX>[CSS3-FLEXBOX]</a>
<dt>Grid Items:
<dd>
The <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a> property applies along the grid’s <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#row-axis>row axis</a>.
<p>The <a data-link-type=dfn href=#alignment-container>alignment container</a> is the <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-cell>grid cell</a>.
The <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is the <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-item>grid item</a>’s margin box.
The default <a data-link-type=dfn href=#overflow-alignment>overflow alignment</a> is <a class=css data-link-type=maybe href=#valdef-overflow-position-true>true</a>.</p>
</dl>
<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>
<h3 class="heading settled" data-level=5.2 id=align-self-property><span class=secno>5.2. </span><span class=content>
Block/Cross-Axis Alignment: the <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> property</span><a class=self-link href=#align-self-property></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css data-dfn-type=property data-export="" id=propdef-align-self>align-self<a class=self-link href=#propdef-align-self></a></dfn><tr><th>Value:<td class=prod>auto <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> stretch <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> <a class="production css" data-link-type=type href=#typedef-baseline-position><baseline-position></a> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> [ <a class="production css" data-link-type=type href=#typedef-overflow-position><overflow-position></a><a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt>?</a> && <a class="production css" data-link-type=type href=#typedef-self-position><self-position></a> ]<tr><th>Initial:<td>auto<tr><th>Applies to:<td>flex items, grid items, and absolutely-positioned boxes<tr><th>Inherited:<td>no<tr><th>Percentages:<td>n/a<tr><th>Media:<td>visual<tr><th>Computed value:<td>specified value, except for <a class=css data-link-for=align-self data-link-type=maybe href=#valdef-justify-self-align-self-auto>auto</a> (see prose)<tr><th>Animatable:<td>no</table>
<p>Aligns the box within its parent along the block/column/cross axis:
the box’s outer edges are aligned within its <a data-link-type=dfn href=#alignment-container>alignment container</a>
<a href=#alignment-values>as described by its alignment value</a>.</p>
<p>The <a class=css data-link-for=align-self data-link-type=maybe href=#valdef-justify-self-align-self-auto>auto</a> and <span class=css data-link-for=align-self>stretch</span> keywords are as defined in <a data-section="" href=#justify-self-property>§5.1
Inline/Main-Axis Alignment: the justify-self property</a>.</p>
<p>All other values are as defined in <a data-section="" href=#alignment-values>§3
Alignment Values</a>, above.</p>
<hr>
<dl>
<dt>Block-level Boxes:
<dd>
The <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> property does not apply to block-level boxes
(including floats),
because there is more than one item in the <a data-link-type=dfn href=http://www.w3.org/TR/css-writing-modes-3/#block-axis->block axis</a>.
<dt>Absolutely-positioned Boxes:
<dd>
The <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> property applies along its containing block’s <a data-link-type=dfn href=http://www.w3.org/TR/css-writing-modes-3/#block-axis->block axis</a>.
<p>When neither margin in this dimension is <span class=css data-link-for=margin>auto</span>
and neither offset property in this dimension is <span class=css data-link-for=top>auto</span>,
values other than <span class=css data-link-for=align-self>stretch</span> cause <a href=http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height>non-replaced absolutely-positioned boxes</a>
to use shrink-to-fit sizing for calculating <span class=css data-link-for=width>auto</span> measures,
and <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> dictates alignment as follows:</p>
<p>The <a data-link-type=dfn href=#alignment-container>alignment container</a> is the box’s containing block
as modified by the offset properties (<a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-positioning/#top>top</a>/<a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-positioning/#right>right</a>/<a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-positioning/#bottom>bottom</a>/<a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-positioning/#left>left</a>).
The <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is the box’s margin box.</p>
<p>The default <a data-link-type=dfn href=#overflow-alignment>overflow alignment</a> is <a class=css data-link-type=maybe href=#valdef-overflow-position-safe>safe</a>.
In terms of CSS2.1 formatting <a data-biblio-type=normative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a>,
the rules for "over-constrained" computations in <a href=http://www.w3.org/TR/CSS21/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 offset properties are not adjusted to correct for the over-constraint.</p>
<p>The <a class=css data-link-for=align-self data-link-type=maybe href=#valdef-justify-self-align-self-auto>auto</a> keyword is equivalent to <a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a> on replaced absolutely-positioned boxes,
and equivalent to <span class=css data-link-for=align-self>stretch</span> on all other absolutely-positioned boxes.
(This is because CSS 2.1 does not stretch replaced elements to fit into fixed offsets.)</p>
<dt>Table Cells:
<dd>
This property does not apply to table cells,
because their position and size is fully constrained by table layout.
<dt>Flex Items:
<dd>
The <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> property applies along the flexbox’s <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#cross-axis>cross axis</a>.
<p>The <a data-link-type=dfn href=#alignment-container>alignment container</a> is the <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-line>flex line</a> the item is in.
The <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is the <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-item>flex item</a>’s margin box.
The default <a data-link-type=dfn href=#overflow-alignment>overflow alignment</a> is <a class=css data-link-type=maybe href=#valdef-overflow-position-true>true</a>.
See <a data-biblio-type=normative data-link-type=biblio href=#biblio-css3-flexbox title=CSS3-FLEXBOX>[CSS3-FLEXBOX]</a> for details.</p>
<dt>Grid Items:
<dd>
The <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> property applies along the grid’s <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#column-axis>column axis</a>.
<p>The <a data-link-type=dfn href=#alignment-container>alignment container</a> is the <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-cell>grid cell</a>.
The <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is the <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-item>grid item</a>’s margin box.
The default <a data-link-type=dfn href=#overflow-alignment>overflow alignment</a> is <a class=css data-link-type=maybe href=#valdef-overflow-position-true>true</a>.</p>
</dl>
<h3 class="heading settled" data-level=5.3 id=baseline-align-self><span class=secno>5.3. </span><span class=content>
Baseline Self-Alignment</span><a class=self-link href=#baseline-align-self></a></h3>
<p>Boxes participating in row-like layout contexts (<a data-link-type=dfn href=#shared-alignment-context>shared alignment contexts</a>)
can be baseline-aligned to each other.
This effectively increases the margins on the box
to align its <a data-link-type=dfn href=#alignment-baseline>alignment baseline</a>
with other baseline-aligned boxes in its <a data-link-type=dfn href=#baseline-sharing-group title="baseline-sharing group">group</a>.</p>
<p>The set of boxes that participate in <dfn data-dfn-type=dfn data-export="" id=baseline-self-alignment title="baseline self-alignment|first-baseline self-alignment|last-baseline self-alignment">baseline self-alignment<a class=self-link href=#baseline-self-alignment></a></dfn>
depends on the layout model:</p>
<dl>
<dt>Flex Items:
<dd>
A <a data-link-type=dfn href=http://www.w3.org/TR/css-flexbox-1/#flex-item>flex item</a> participates in first (last) <a data-link-type=dfn href=#baseline-self-alignment>baseline self-alignment</a> in its flex line
if its computed <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> is <a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-baseline>baseline</a> (<a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-last-baseline>last-baseline</a>).
See <a data-biblio-type=normative data-link-type=biblio href=#biblio-css3-flexbox title=CSS3-FLEXBOX>[CSS3-FLEXBOX]</a> for details.
<dt>Grid Items:
<dd>
A <a data-link-type=dfn href=http://www.w3.org/TR/css-grid-1/#grid-item>grid item</a> participates in first (last) <a data-link-type=dfn href=#baseline-content-alignment>baseline content-alignment</a>
in either its row or column (whichever matches its <a data-link-type=dfn href=http://www.w3.org/TR/css-writing-modes-3/#inline-axis->inline axis</a>)
if its <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a> or <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> property (whichever matches its <a data-link-type=dfn href=http://www.w3.org/TR/css-writing-modes-3/#inline-axis->inline axis</a>)
computes to <a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-baseline>baseline</a> (<a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-last-baseline>last-baseline</a>).
</dl>
<p>If a box spans multiple <a data-link-type=dfn href=#shared-alignment-context>shared alignment contexts</a>,
it participates in first (last) <a data-link-type=dfn href=#baseline-self-alignment>baseline self-alignment</a>
within its start-most (end-most) <a data-link-type=dfn href=#shared-alignment-context>shared alignment context</a> along that axis.</p>
<p>When a box participates in first (last) <a data-link-type=dfn href=#baseline-self-alignment>baseline self-alignment</a>
its <a data-link-type=dfn href=#alignment-subject>alignment subject</a> is aligned to the start (end) edge of its <a data-link-type=dfn href=#alignment-container>alignment container</a>
and the minimum necessary extra space is added between its start (end) edge and the <a data-link-type=dfn href=#alignment-container>alignment container</a>
to match its <a data-link-type=dfn href=#alignment-baseline>alignment baseline</a> in that axis up to that of its <a data-link-type=dfn href=#baseline-sharing-group>baseline-sharing group</a>.
See <a data-section="" href=#align-by-baseline>§7.3
Aligning Boxes by Baseline</a>.
This may increase the intrinsic size contribution of the <a data-link-type=dfn href=#alignment-subject>alignment subject</a>.</p>
<h2 class="heading settled" data-level=6 id=default-alignment><span class=secno>6. </span><span class=content>
Default Alignment</span><a class=self-link href=#default-alignment></a></h2>
<p>The <a class=property data-link-type=propdesc href=#propdef-align-items>align-items</a> and <a class=property data-link-type=propdesc href=#propdef-justify-items>justify-items</a> properties set the default <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> and <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a> behavior of the items contained by the element.</p>
<div class=figure>
<img alt="Diagram showing that the alignment of grid items within the element is affected." height=212 src=images/items-example.svg width=212>
</div>
<h3 class="heading settled" data-level=6.1 id=justify-items-property><span class=secno>6.1. </span><span class=content>
Inline/Main-Axis Alignment: the <a class=property data-link-type=propdesc href=#propdef-justify-items>justify-items</a> property</span><a class=self-link href=#justify-items-property></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css data-dfn-type=property data-export="" id=propdef-justify-items>justify-items<a class=self-link href=#propdef-justify-items></a></dfn><tr><th>Value:<td class=prod>auto <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> stretch <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> <a class="production css" data-link-type=type href=#typedef-baseline-position><baseline-position></a> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> [ <a class="production css" data-link-type=type href=#typedef-self-position><self-position></a> && <a class="production css" data-link-type=type href=#typedef-overflow-position><overflow-position></a><a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt>?</a> ] <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> [ legacy && [ <a class=css data-link-for="" data-link-type=maybe href=#valdef-self-position-content-position-left>left</a> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> <a class=css data-link-for="" data-link-type=maybe href=#valdef-self-position-content-position-right>right</a> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> <a class=css data-link-for="" data-link-type=maybe href=#valdef-self-position-content-position-center>center</a> ] ]<tr><th>Initial:<td>auto<tr><th>Applies to:<td>block containers, flex containers, and grid containers<tr><th>Inherited:<td>no<tr><th>Percentages:<td>n/a<tr><th>Media:<td>visual<tr><th>Computed value:<td>specified value, except for <a class=css data-link-for=justify-items data-link-type=maybe href=#valdef-justify-items-auto>auto</a> (see prose)<tr><th>Animatable:<td>no</table>
<p>This property specifies the default <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a> for all of the boxes
(including anonymous boxes)
participating in this box’s formatting context.
Values have the following meanings:</p>
<dl data-dfn-for=justify-items data-dfn-type=value>
<dt><dfn class=css data-dfn-for=justify-items data-dfn-type=value data-export="" id=valdef-justify-items-auto>auto<a class=self-link href=#valdef-justify-items-auto></a></dfn>
<dd>
If the <a data-link-type=dfn href=http://www.w3.org/TR/css-cascade-3/#inherited-value>inherited value</a> of <span class=css>justify-items</span> includes the <a class=css data-link-type=maybe href=#valdef-justify-items-legacy>legacy</a> keyword,
<a class=css data-link-for=justify-items data-link-type=maybe href=#valdef-justify-items-auto>auto</a> computes to the the <a data-link-type=dfn href=http://www.w3.org/TR/css-cascade-3/#inherited-value>inherited value</a>.
<p>Otherwise, <a class=css data-link-for=justify-items data-link-type=maybe href=#valdef-justify-items-auto>auto</a> computes to:</p>
<ul>
<li><span class=css data-link-for=justify-self>stretch</span> for flex containers and grid containers
<li><a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a> for everything else
</ul>
<dt><dfn class=css data-dfn-for=justify-items data-dfn-type=value data-export="" id=valdef-justify-items-legacy>legacy<a class=self-link href=#valdef-justify-items-legacy></a></dfn>
<dd>
This keyword causes the value to effectively inherit into descendants.
It can only be combined with the <a class=css data-link-for="" data-link-type=maybe href=#valdef-self-position-content-position-center>center</a>, <a class=css data-link-type=maybe href=#valdef-self-position-content-position-left>left</a>, and <a class=css data-link-type=maybe href=#valdef-self-position-content-position-right>right</a> positions.
When <span class=css>justify-self:auto</span> retrieves the value of <a class=property data-link-type=propdesc href=#propdef-justify-items>justify-items</a>,
only the alignment keyword, not the <a class=css data-link-type=maybe href=#valdef-justify-items-legacy>legacy</a> keyword, is passed to it.
It exists to implement the legacy alignment behavior of HTML’s <code><center></code> element and <code>align</code> attribute.
</dl>
<p>Other values have no special handling and are merely passed to <a class=property data-link-type=propdesc href=#propdef-justify-self>justify-self</a>.</p>
<h3 class="heading settled" data-level=6.2 id=align-items-property><span class=secno>6.2. </span><span class=content>
Block/Cross-Axis Alignment: the <a class=property data-link-type=propdesc href=#propdef-align-items>align-items</a> property</span><a class=self-link href=#align-items-property></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css data-dfn-type=property data-export="" id=propdef-align-items>align-items<a class=self-link href=#propdef-align-items></a></dfn><tr><th>Value:<td class=prod>auto <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> stretch <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> <a class="production css" data-link-type=type href=#typedef-baseline-position><baseline-position></a> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one>|</a> [ <a class="production css" data-link-type=type href=#typedef-self-position><self-position></a> && <a class="production css" data-link-type=type href=#typedef-overflow-position><overflow-position></a><a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt>?</a> ]<tr><th>Initial:<td>auto<tr><th>Applies to:<td>block-level elements<tr><th>Inherited:<td>no<tr><th>Percentages:<td>n/a<tr><th>Media:<td>visual<tr><th>Computed value:<td>specified value, except for <a class=css data-link-for=align-items data-link-type=maybe href=#valdef-align-items-auto>auto</a> (see prose)<tr><th>Animatable:<td>no</table>
<p>This property specifies the default <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a> for all of the boxes
(including anonymous boxes)
participating in this box’s formatting context.
Values have the following meanings:</p>
<dl data-dfn-for=align-items data-dfn-type=value>
<dt><dfn class=css data-dfn-for=align-items data-dfn-type=value data-export="" id=valdef-align-items-auto>auto<a class=self-link href=#valdef-align-items-auto></a></dfn>
<dd>
Computes to:
<ul>
<li><span class=css data-link-for=align-self>stretch</span> for flex containers and grid containers
<li><a class=css data-link-type=maybe href=#valdef-self-position-content-position-start>start</a> for everything else
</ul>
</dl>
<p>Other values have no special handling and are merely passed to <a class=property data-link-type=propdesc href=#propdef-align-self>align-self</a>.</p>
<h2 class="heading settled" data-level=7 id=baseline-rules><span class=secno>7. </span><span class=content>
Baseline Alignment Details</span><a class=self-link href=#baseline-rules></a></h2>
<h3 class="heading settled" data-level=7.1 id=baseline-export><span class=secno>7.1. </span><span class=content>
Determining the Baseline of a Box</span><a class=self-link href=#baseline-export></a></h3>
<p>The <dfn data-dfn-type=dfn data-export="" id=first-baselines title="first baselines|baselines of a box">first baselines<a class=self-link href=#first-baselines></a></dfn> (and <dfn data-dfn-type=dfn data-export="" id=last-baselines>last baselines<a class=self-link href=#last-baselines></a></dfn>) of a box
for a given axis
are a set of baselines (alphabetic, central, etc.)
nominally associated with the first (last) line of text within the box.
The <a data-link-type=dfn href=#alignment-baseline>alignment baseline</a> is one of these,
usually the dominant baseline of the <a data-link-type=dfn href=#alignment-container>alignment container</a>.
(See <a class=property data-link-type=propdesc href=http://www.w3.org/TR/svg2/text.html#AlignmentBaselineProperty>alignment-baseline</a>.)
Note that boxes might not have baselines in a particular axis.</p>
<p>The first and last <a data-link-type=dfn href=#first-baselines>baselines of a box</a>
are determined differently based on the layout model, as follows:</p>
<dl>
<dt>block containers
<dd>
The first (last) inline-axis baselines of a block container
are <a data-link-type=dfn href=#generate-baselines>generated</a> from the dominant first (last) baseline of the first (last) in-flow line box in the block container,
or are 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 baselines.
For the purposes of finding the baselines,
in-flow boxes with a scrolling mechanisms (see the <a class=property data-link-type=propdesc href=http://www.w3.org/TR/css-overflow-3/#overflow>overflow</a> property)
must be considered as if scrolled to their origin (final) position.
<p>A block container has no block-axis baselines.</p>
<dt>tables
<dd>
The first (last) inline-axis baselines of a table box are
the first (last) baselines of its first (last) row.
<p>When finding the baselines of an inline-block,
any baselines contributed by table boxes must be skipped.
(This quirk is a legacy behavior from <a data-biblio-type=informative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a>.)</p>
<p>The first (last) block-axis baselines of a table box are the first (last) baselines of its first (last) column.</p>
<dt>table rows
<dd>
If any cells in the row participate in <a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-baseline>baseline</a> (<a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-last-baseline>last-baseline</a>) alignment along the row axis,
the first (last) inline-axis baselines of the row
are <a data-link-type=dfn href=#generate-baselines>generated</a> from their shared <a data-link-type=dfn href=#alignment-baseline>alignment baseline</a>
and the row’s <a data-link-type=dfn href=http://www.w3.org/TR/css-fonts-3/#first-available-font>first available font</a>,
after alignment has been performed.
Otherwise, the first (last) inline-axis baselines of the row
are <a data-link-type=dfn href=#synthesize-baselines>synthesized</a> from the lowest and highest content edges of the cells in the row.
<a data-biblio-type=normative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a>
<p>A table row has no block-axis baselines.</p>
<dt>table columns
<dd>
If any cells in the column participate in <a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-baseline>baseline</a> (<a class=css data-link-type=maybe href=#valdef-justify-content-justify-self-justify-items-align-content-align-self-align-items-last-baseline>last-baseline</a>) alignment
along the column axis (by having a writing mode perpendicular to that of the table),
the first (last) block-axis baselines of the column
are <a data-link-type=dfn href=#generate-baselines>generated</a> from their shared <a data-link-type=dfn href=#alignment-baseline>alignment baseline</a>
and the column’s <a data-link-type=dfn href=http://www.w3.org/TR/css-fonts-3/#first-available-font>first available font</a>,
after alignment has been performed.
Otherwise, the the first (last) inline-axis baselines of the row
are <a data-link-type=dfn href=#synthesize-baselines>synthesized</a> from the extreme content edges of the cells in the row.