-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathOverview.html
2322 lines (1600 loc) · 146 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>
<meta content="revising" name="csswg-work-status">
<meta content="ED" name="w3c-status">
<link href="../default.css" rel="stylesheet" type="text/css">
<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<style>
body {
background: url("https://www.w3.org/StyleSheets/TR/logo-ED") top left no-repeat white;
background-attachment: fixed;
color: black;
font-family: sans-serif;
margin: 0 auto;
max-width: 50em;
padding: 2em 1em 2em 70px;
}
:link { color: #00C; background: transparent }
:visited { color: #609; background: transparent }
a[href]:active { color: #C00; background: transparent }
a[href]:hover { background: #ffa }
a[href] img { border-style: none }
h1, h2, h3, h4, h5, h6 { text-align: left }
h1, h2, h3 { color: #005A9C; }
h1 { font: 170% sans-serif }
h2 { font: 140% sans-serif }
h3 { font: 120% sans-serif }
h4 { font: bold 100% sans-serif }
h5 { font: italic 100% sans-serif }
h6 { font: small-caps 100% sans-serif }
.hide { display: none }
div.head { margin-bottom: 1em }
div.head h1 { margin-top: 2em; clear: both }
div.head table { margin-left: 2em; margin-top: 2em }
p.copyright { font-size: small }
p.copyright small { font-size: small }
pre { margin-left: 2em }
dt { font-weight: bold }
ul.toc, ol.toc {
list-style: none;
}
</style>
<meta content="Bikeshed 1.0.0" name="generator">
<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">Editor’s 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://dev.w3.org/csswg/css-align/">http://dev.w3.org/csswg/css-align/</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>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%20YOUR%20TOPIC%20HERE">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="https://github.com/w3c/csswg-drafts/issues/">GitHub</a>
<dd><a href="#issues-index">Inline In Spec</a>
<dt class="editor">Editors:
<dd class="editor 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>)
<dd class="editor 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>)
</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>). 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-link-type="biblio" href="#biblio-css3text">[CSS3TEXT]</a> and <a data-link-type="biblio" href="#biblio-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>
This is a public copy of the editors’ draft.
It is provided for discussion only and may change at any moment.
Its publication here does not imply endorsement of its contents by W3C.
Don’t cite this document other than as work in progress.
</p>
<p>
The (<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public mailing list
<a href="mailto:www-style@w3.org?Subject=%5Bcss-align%5D%20PUT%20SUBJECT%20HERE">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>
<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>
<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/" id="w3c_process_revision">1 August 2014 W3C Process Document</a>.
</p>
<p>
</p></div>
<div data-fill-with="at-risk">
<p>The following features are at-risk, and may be dropped during the CR period:
</p>
<ul>
<li><a class="css" data-link-type="maybe" href="#valdef-justify-content-last-baseline">last-baseline</a>
</ul>
<p>“At-risk” is a W3C Process term-of-art, and does not necessarily imply that the feature is in danger of being dropped or delayed. It means that the WG believes the feature may have difficulting being interoperably implemented in a timely manner, and marking it as such allows the WG to drop the feature if necessary when transitioning to the Proposed Rec stage, without having to publish a new Candidate Rec without the feature first.</p></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">center</span>, <span class="css">start</span>, <span class="css">end</span>, <span class="css">self-start</span>, <span class="css">self-end</span>, <span class="css">flex-start</span>, <span class="css">flex-end</span>, <span class="css">left</span>, and <span class="css">right</span> keywords</span></a>
<li><a href="#baseline"><span class="secno">3.2</span> <span class="content">
Baseline Alignment: the <span class="css">baseline</span> and <span class="css">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">stretch</span>, <span class="css">space-between</span>, <span class="css">space-around</span>, and <span class="css">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">safe</span> and <span class="css">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">justify-content</span> and <span class="property">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">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">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">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">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="#index"><span class="secno"></span> <span class="content">Index</span></a>
<ul class="toc">
<li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
<li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</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="#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="https://drafts.csswg.org/css-text-3/#propdef-text-align">text-align</a> and
the alignment of blocks by balancing <span class="css">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-link-type="biblio" href="#biblio-css3text">[CSS3TEXT]</a> and <a data-link-type="biblio" href="#biblio-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-link-type="biblio" href="#biblio-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="https://drafts.csswg.org/css2/visudet.html#propdef-vertical-align">vertical-align</a>, as defined in <a data-link-type="biblio" href="#biblio-css21">[CSS21]</a> chapter 17.</p>
<p>The interaction of these properties with
Grid Layout <a data-link-type="biblio" href="#biblio-css3-grid-layout">[CSS3-GRID-LAYOUT]</a>
and Flexible Box Layout <a data-link-type="biblio" href="#biblio-css3-flexbox">[CSS3-FLEXBOX]</a>
is defined in their respective modules.
The property definitions here supersede those in <a data-link-type="biblio" href="#biblio-css3-flexbox">[CSS3-FLEXBOX]</a>
(which have a smaller, earlier subset of permissible values).</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-link-type="biblio" href="#biblio-css21">[CSS21]</a>. Value types not defined in
this specification are defined in CSS Level 2 Revision 1 <a data-link-type="biblio" href="#biblio-css21">[CSS21]</a>.
Other CSS modules may expand the definitions of these value types: for
example <a data-link-type="biblio" href="#biblio-css3val">[CSS3VAL]</a>, when combined with this module, adds the
<a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-cascade-3/#valdef-all-initial">initial</a> 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 (main/inline vs. cross/block), 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 main/inline and cross/block dimensions, respectively.
The choice is somewhat arbitrary, but having the two terms allows for
a consistent naming scheme that works across all of CSS’s layout models.</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>main/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="https://drafts.csswg.org/css-flexbox-1/#flex-container">flex containers</a>, and <a data-link-type="dfn" href="https://drafts.csswg.org/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>cross/block
<td>block containers, <a data-link-type="dfn" href="https://drafts.csswg.org/css-flexbox-1/#flex-container">flex containers</a>, and <a data-link-type="dfn" href="https://drafts.csswg.org/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="https://drafts.csswg.org/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>cross/block
<td><a data-link-type="dfn" href="https://drafts.csswg.org/css-flexbox-1/#flex-item">flex items</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/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">justify-self: auto</span>)</small>
<td><a data-link-type="dfn" href="https://drafts.csswg.org/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>cross/block
<td><a data-link-type="dfn" href="https://drafts.csswg.org/css-flexbox-1/#flex-container">flex containers</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/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-center">center</a>, <a class="css" data-link-type="maybe" href="#valdef-self-position-start">start</a>, <a class="css" data-link-type="maybe" href="#valdef-self-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-flex-start">flex-start</a>, <a class="css" data-link-type="maybe" href="#valdef-self-position-flex-end">flex-end</a>, <a class="css" data-link-type="maybe" href="#valdef-self-position-left">left</a>, and <a class="css" data-link-type="maybe" href="#valdef-self-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" title="Expands to: right | end | center | flex-start | start | self-end | flex-end | self-start | left"><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" title="Expands to: right | end | center | flex-start | start | flex-end | left"><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-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> start <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> end <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> self-start <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> self-end <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a>
flex-start <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> flex-end <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> left <a data-link-type="grammar" href="https://drafts.csswg.org/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-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> start <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> end <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> flex-start <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> flex-end <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> left <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> right;
</pre>
<p>Values have the following meanings:</p>
<dl>
<dt><dfn class="css" data-dfn-for="<self-position>, <content-position>" data-dfn-type="value" data-export="" id="valdef-self-position-center">center<a class="self-link" href="#valdef-self-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-start">start<a class="self-link" href="#valdef-self-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-end">end<a class="self-link" href="#valdef-self-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-flex-start">flex-start<a class="self-link" href="#valdef-self-position-flex-start"></a></dfn> <small>(self, content)</small>
<dd><strong>Only used in flex layout.</strong> <a data-link-type="biblio" href="#biblio-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="https://drafts.csswg.org/css-flexbox-1/#flex-container">flex container</a>’s main-start or cross-start side, as appropriate.
When used on boxes that are not children of a <a data-link-type="dfn" href="https://drafts.csswg.org/css-flexbox-1/#flex-container">flex container</a>,
this value computes to <a class="css" data-link-type="maybe" href="#valdef-self-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-flex-end">flex-end<a class="self-link" href="#valdef-self-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="https://drafts.csswg.org/css-flexbox-1/#flex-container">flex container</a>’s main-end or cross-end side, as appropriate.
When used on boxes that are not children of a <a data-link-type="dfn" href="https://drafts.csswg.org/css-flexbox-1/#flex-container">flex container</a>,
this value computes to <a class="css" data-link-type="maybe" href="#valdef-self-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-left">left<a class="self-link" href="#valdef-self-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-start">start</a>.
<dt><dfn class="css" data-dfn-for="<self-position>, <content-position>" data-dfn-type="value" data-export="" id="valdef-self-position-right">right<a class="self-link" href="#valdef-self-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-start">start</a>.
</dl>
<p class="issue" id="issue-511afb43"><a class="self-link" href="#issue-511afb43"></a>
Add example images.
</p>
<p class="issue" id="issue-bb5da799"><a class="self-link" href="#issue-bb5da799"></a>
Make it easier to understand the dual-axis nature of "start" and "end" wrt orthogonal flows.
</p>
<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-baseline">baseline</a> and <a class="css" data-link-type="maybe" href="#valdef-justify-content-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-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> last-baseline
</pre>
<p>and are defined below:</p>
<dl>
<dt><dfn class="css" data-dfn-for="justify-content, justify-self, justify-items, align-content, align-self, align-items, <baseline-position>" data-dfn-type="value" data-export="" id="valdef-justify-content-baseline">baseline<a class="self-link" href="#valdef-justify-content-baseline"></a></dfn>
<dd>
Indicates <dfn data-dfn-for="justify-content, justify-self, justify-items, align-content, align-self, align-items, <baseline-position>" 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, <baseline-position>" data-dfn-type="value" data-export="" id="valdef-justify-content-last-baseline">last-baseline<a class="self-link" href="#valdef-justify-content-last-baseline"></a></dfn>
<dd>
Indicates <dfn data-dfn-for="justify-content, justify-self, justify-items, align-content, align-self, align-items, <baseline-position>" 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 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 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>
<p class="note" role="note">Note: The <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/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-baseline">baseline</a> is equivalent to <a class="css" data-link-type="maybe" href="#valdef-justify-content-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-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" title="Expands to: right | end | center | flex-start | start | flex-end | left"><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-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> space-around <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> space-evenly <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> stretch</pre>
<dl>
<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-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-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-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">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="https://drafts.csswg.org/css2/visudet.html#propdef-max-height">max-height</a>/<a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/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-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-flex-start">flex-start</a> is identical to <a class="css" data-link-type="maybe" href="#valdef-self-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.
</p>
<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-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> safe</pre>
<dl>
<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-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.
</p>
<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" data-link-for-hint="justify-content">
<tbody>
<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 class="value">
<th>Value:
<td class="prod">auto <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> <a class="production css" data-link-type="type" href="#typedef-baseline-position" title="Expands to: last-baseline alignment | last-baseline | baseline | first-baseline alignment"><baseline-position></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> <a class="production css" data-link-type="type" href="#typedef-content-distribution" title="Expands to: stretch | space-between | space-around | space-evenly"><content-distribution></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-any">||</a> [ <a class="production css" data-link-type="type" href="#typedef-overflow-position" title="Expands to: safe | true"><overflow-position></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#mult-opt">?</a> && <a class="production css" data-link-type="type" href="#typedef-content-position" title="Expands to: right | end | center | flex-start | start | flex-end | left"><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 <a class="css" data-link-type="maybe" href="#valdef-justify-content-auto">auto</a> (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-auto">auto<a class="self-link" href="#valdef-justify-content-auto"></a></dfn> are defined in <a href="#alignment-values">§3 Alignment Values</a>, above.
If both a <a class="production css" data-link-type="type" href="#typedef-content-distribution" title="Expands to: stretch | space-between | space-around | space-evenly"><content-distribution></a> and <a class="production css" data-link-type="type" href="#typedef-content-position" title="Expands to: right | end | center | flex-start | start | flex-end | left"><content-position></a> are given,
the <a class="production css" data-link-type="type" href="#typedef-content-position" title="Expands to: right | end | center | flex-start | start | flex-end | left"><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="https://drafts.csswg.org/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="https://drafts.csswg.org/css-writing-modes-3/#block-axis">block axis</a>,
but if a <a class="production css" data-link-type="type" href="#typedef-content-distribution" title="Expands to: stretch | space-between | space-around | space-evenly"><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 <a class="css" data-link-type="maybe" href="#valdef-justify-content-auto">auto</a> force the block container to establish a new formatting context.
For table cells, the behavior of the <a class="css" data-link-type="maybe" href="#valdef-justify-content-auto">auto</a> depends on the computed value of <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-vertical-align">vertical-align</a>:
<span class="css">top</span> makes it behave as <a class="css" data-link-type="maybe" href="#valdef-self-position-start">start</a>,
<span class="css">middle</span> makes it behave as <a class="css" data-link-type="maybe" href="#valdef-self-position-center">center</a>,
<span class="css">bottom</span> makes it behave as <a class="css" data-link-type="maybe" href="#valdef-self-position-end">end</a>,
and all other values make it behave as <a class="css" data-link-type="maybe" href="#valdef-justify-content-baseline">baseline</a>.
<a class="css" data-link-type="maybe" href="#valdef-justify-content-auto">auto</a> otherwise behaves as <a class="css" data-link-type="maybe" href="#valdef-self-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="https://drafts.csswg.org/css-multicol-1/#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="https://drafts.csswg.org/css-writing-modes-3/#block-axis">block axis</a>,
but if a <a class="production css" data-link-type="type" href="#typedef-content-distribution" title="Expands to: stretch | space-between | space-around | space-evenly"><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><a class="css" data-link-type="maybe" href="#valdef-justify-content-auto">auto</a> behaves as <a class="css" data-link-type="maybe" href="#valdef-self-position-start">start</a>.</p>
<dt>Flex Containers:
<dd>
<a class="css" data-link-type="maybe" href="#valdef-justify-content-auto">auto</a> computes to <a class="css" 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="https://drafts.csswg.org/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="https://drafts.csswg.org/css-flexbox-1/#flex-item">flex items</a> in each <a data-link-type="dfn" href="https://drafts.csswg.org/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="https://drafts.csswg.org/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="https://drafts.csswg.org/css-flexbox-1/#cross-axis">cross axis</a>.</p>
<p>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="https://drafts.csswg.org/css-flexbox-1/#main-axis">main axis</a>,
but since flexing in the <a data-link-type="dfn" href="https://drafts.csswg.org/css-flexbox-1/#main-axis">main axis</a> is controlled by <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-flexbox-1/#propdef-flex">flex</a>,
<a class="css" data-link-type="maybe" href="#valdef-content-distribution-stretch">stretch</a> computes to <a class="css" data-link-type="maybe" href="#valdef-self-position-flex-start">flex-start</a>.</p>
<p>See <a data-link-type="biblio" href="#biblio-css3-flexbox">[CSS3-FLEXBOX]</a> for details.</p>
<dt>Grid Containers:
<dd>
<a class="css" data-link-type="maybe" href="#valdef-justify-content-auto">auto</a> computes to <a class="css" data-link-type="maybe" href="#valdef-self-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="https://drafts.csswg.org/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="https://drafts.csswg.org/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="https://drafts.csswg.org/css-writing-modes-3/#block-axis">block (column) axis</a>,
aligning the <a data-link-type="dfn" href="https://drafts.csswg.org/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="https://drafts.csswg.org/css-writing-modes-3/#inline-axis">inline (row) axis</a>,
aligning the <a data-link-type="dfn" href="https://drafts.csswg.org/css-grid-1/#grid-column">grid columns</a>.</p>
<p>See <a data-link-type="biblio" href="#biblio-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">group</a>.</p>
<p>The set of boxes that participate in <dfn data-dfn-type="dfn" data-export="" data-lt="baseline content-alignment|first-baseline content-alignment|last-baseline content-alignment" id="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: