forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverview.html
More file actions
2013 lines (1623 loc) · 98.8 KB
/
Overview.html
File metadata and controls
2013 lines (1623 loc) · 98.8 KB
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 Multi-column Layout Module</title>
<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>
<style type=text/css>
.cols { width: 500px; height: 200px; background: #fff; position: relative; border: solid 5px blue; margin: 0.5em 2em 1em 0; font: bold 14px/19px Arial, sans-serif }
.cols p { padding: 3px; margin: 0 }
.col { position: absolute; left: 0px; top: 0; z-index: 6; width: 170px }
.gap { position: absolute; background: green; width: 5px; bottom: 0px; top: 0px; border: 10px solid yellow; border-top-width: 0; border-bottom-width: 0; }
.rep { position: absolute; top: 45px; background: black; height: 110px; width: 100px; color: white; z-index: 4 }
table.breaks { border-collapse: collapse; margin: 1em 0 }
table.breaks td, table.breaks th { border: thin solid black; padding: 0.1em 0.2em }
div.example:before { width: 9em }
</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 Multi-column Layout Module</h1>
<h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class=content>Editor’s Draft,
<span class=dt-updated><span class=value-title title=20140721>21 July 2014</span></span></span></h2>
<div data-fill-with=spec-metadata><dl>
<dt>This version:
<dd><a class=u-url href=http://dev.w3.org/csswg/css-multicol/>http://dev.w3.org/csswg/css-multicol/</a>
<dt>Latest version:
<dd><a href=http://www.w3.org/TR/css3-multicol/>http://www.w3.org/TR/css3-multicol/</a>
<dt>Previous Versions:
<dd><dd><a href=http://www.w3.org/TR/2011/CR-css3-multicol-20110412/ rel=previous>http://www.w3.org/TR/2011/CR-css3-multicol-20110412/</a>
<dd><dd><a href=http://www.w3.org/TR/2009/CR-css3-multicol-20091217/ rel=previous>http://www.w3.org/TR/2009/CR-css3-multicol-20091217/</a>
<dd><dd><a href=http://www.w3.org/TR/2009/WD-css3-multicol-20090630/ rel=previous>http://www.w3.org/TR/2009/WD-css3-multicol-20090630/</a>
<dd><dd><a href=http://www.w3.org/TR/2007/WD-css3-multicol-20070606/ rel=previous>http://www.w3.org/TR/2007/WD-css3-multicol-20070606/</a>
<dd><dd><a href=http://www.w3.org/TR/2005/WD-css3-multicol-20051215/ rel=previous>http://www.w3.org/TR/2005/WD-css3-multicol-20051215/</a>
<dd><dd><a href=http://www.w3.org/TR/2001/WD-css3-multicol-20010118/ rel=previous>http://www.w3.org/TR/2001/WD-css3-multicol-20010118/</a>
<dd><dd><a href=http://www.w3.org/1999/06/WD-css3-multicol-19990623/ rel=previous>http://www.w3.org/1999/06/WD-css3-multicol-19990623/</a>
<dt>Feedback:
<dd><a href="mailto:www-style@w3.org?subject=%5Bcss-multicol%5D%20feedback">www-style@w3.org</a>
with subject line
“<kbd>[css-multicol] <var>… message topic …</var></kbd>”(<a href=http://lists.w3.org/Archives/Public/www-style/ rel=discussion>archives</a>)
<dt>Editor:
<dd><dd class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:howcome@opera.com>Håkon Wium Lie</a> (<span class="p-org org">Opera Software</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>), 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 heading" id=abstract><span class=content>Abstract</span></h2>
<div class=p-summary data-fill-with=abstract><p>This specification describes multi-column layouts in CSS, a style sheet language for the web. Using functionality described in the specification, content can be flowed into multiple columns with a gap and a rule between them.</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 heading" 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>
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-multicol%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-multicol” in the subject,
preferably like this:
“[css-multicol] <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>.</div>
<div data-fill-with=at-risk></div>
<h2 class="no-num no-toc no-ref heading settled heading" id=contents><span class=content>Table of Contents</span></h2>
<div data-fill-with=table-of-contents><ul class=toc>
<li><a href=#introduction><span class=secno>1</span> Introduction</a>
<li><a href=#the-multi-column-model><span class=secno>2</span> The multi-column model</a>
<li><a href=#the-number-and-width-of-columns><span class=secno>3</span> The number and width of columns</a>
<ul class=toc>
<li><a href=#cw><span class=secno>3.1</span> <span class=property data-link-type=propdesc title=column-width>column-width</span></a>
<li><a href=#cc><span class=secno>3.2</span> <span class=property data-link-type=propdesc title=column-count>column-count</span></a>
<li><a href=#columns><span class=secno>3.3</span> <span class=property data-link-type=propdesc title=columns>columns</span></a>
<li><a href=#pseudo-algorithm><span class=secno>3.4</span> Pseudo-algorithm</a>
<li><a href=#stacking-context><span class=secno>3.5</span> Stacking context</a></ul>
<li><a href=#column-gaps-and-rules><span class=secno>4</span> Column gaps and rules</a>
<ul class=toc>
<li><a href=#column-gap><span class=secno>4.1</span> <span class=property data-link-type=propdesc title=column-gap>column-gap</span></a>
<li><a href=#crc><span class=secno>4.2</span> <span class=property data-link-type=propdesc title=column-rule-color>column-rule-color</span></a>
<li><a href=#crs><span class=secno>4.3</span> <span class=property data-link-type=propdesc title=column-rule-style>column-rule-style</span></a>
<li><a href=#crw><span class=secno>4.4</span> <span class=property data-link-type=propdesc title=column-rule-width>column-rule-width</span></a>
<li><a href=#column-rule><span class=secno>4.5</span> <span class=property data-link-type=propdesc title=column-rule>column-rule</span></a></ul>
<li><a href=#column-breaks><span class=secno>5</span> Column breaks</a>
<ul class=toc>
<li><a href=#break-before-break-after-break-inside><span class=secno>5.1</span> <span class=property data-link-type=propdesc title=break-before>break-before</span>, <span class=property data-link-type=propdesc title=break-after>break-after</span>, <span class=property data-link-type=propdesc title=break-inside>break-inside</span></a></ul>
<li><a href=#spanning-columns><span class=secno>6</span> Spanning columns</a>
<ul class=toc>
<li><a href=#column-span><span class=secno>6.1</span> <span class=property data-link-type=propdesc title=column-span>column-span</span></a></ul>
<li><a href=#filling-columns><span class=secno>7</span> Filling columns</a>
<ul class=toc>
<li><a href=#cf><span class=secno>7.1</span> <span class=property data-link-type=propdesc title=column-fill>column-fill</span></a></ul>
<li><a href=#overflow><span class=secno>8</span> Overflow</a>
<ul class=toc>
<li><a href=#overflow-inside-multicol-elements><span class=secno>8.1</span> Overflow inside multicol elements</a>
<li><a href=#pagination-and-overflow-outside-multicol><span class=secno>8.2</span> Pagination and overflow outside multicol elements</a></ul>
<li><a href=#acknowledgments><span class=secno></span> Acknowledgments</a>
<li><a href=#conformance><span class=secno></span> Conformance</a>
<ul class=toc>
<li><a href=#conventions><span class=secno></span> Document conventions</a>
<li><a href=#conformance-classes><span class=secno></span> Conformance classes</a>
<li><a href=#partial><span class=secno></span> Partial implementations</a>
<li><a href=#experimental><span class=secno></span> Experimental implementations</a>
<li><a href=#testing><span class=secno></span> Non-experimental implementations</a></ul>
<li><a href=#references><span class=secno></span> References</a>
<ul class=toc>
<li><a href=#normative><span class=secno></span> Normative References</a>
<li><a href=#informative><span class=secno></span> Informative References</a></ul>
<li><a href=#index><span class=secno></span> Index</a>
<li><a href=#property-index><span class=secno></span> Property index</a></ul></div>
<h2 class="heading settled heading" data-level=1 id=introduction><span class=secno>1 </span><span class=content>
Introduction</span><a class=self-link href=#introduction></a></h2>
<p>(This section is not normative.)</p>
<p>This module describes multi-column layout in CSS. By using
functionality described in this document, style sheets can declare
that the content of an element is to be laid out in multiple
columns.</p>
<p>On the Web, tables have also been used to describe multi-column
layouts. The main benefit of using CSS-based columns is flexibility;
content can flow from one column to another, and the number of columns
can vary depending on the size of the viewport. Removing presentation
table markup from documents allows them to more easily be presented on
various output devices including speech synthesizers and small mobile
devices.</p>
<p>Multi-column layouts are easy to describe in CSS. Here is a simple example:</p>
<div class=example>
<pre>body { column-width: 12em }</pre>
<p>In this example, the <code class=html>body</code> element is
set to have columns at least <span class=css data-link-type=maybe title=12em>12em</span> wide. The exact number of
columns will depend on the available space.</p>
</div>
<p>The number of columns can also be set explicitly in the style sheet:</p>
<div class=example>
<pre>body { column-count: 2 }</pre>
<p>In this case, the number of columns is fixed and the column widths
will vary depending on the available width.</p>
</div>
<p>The shorthand <a class=property data-link-type=propdesc href=#propdef-columns title=columns>columns</a> property can be used to set either,
or both, properties in one declaration.</p>
<div class=example>
In these examples, the number of columns, the width of columns, and
both the number and width are set, respectively:
<pre>body { columns: 2 }
body { columns: 12em }
body { columns: 2 12em }
</pre>
<p>However, as described below, setting both the width and number of
columns rarely makes sense.</p>
</div>
<p>Another group of properties introduced in this module describe
gaps and rules between columns.</p>
<div class=example>
<pre>body {
column-gap: 1em;
column-rule: thin solid black;
}
</pre>
<p>The first declaration in the example above sets the gap between two
adjacent columns to be 1em. Column gaps are similar to padding areas.
In the middle of the gap there will be a rule which is described by
the <a class=property data-link-type=propdesc href=#propdef-column-rule title=column-rule>column-rule</a> property.</p>
</div>
<p>The values of the <a class=property data-link-type=propdesc href=#propdef-column-rule title=column-rule>column-rule</a> property are similar to those of
the CSS border properties. Like <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-3/#border title=border>border</a>, <a class=property data-link-type=propdesc href=#propdef-column-rule title=column-rule>column-rule</a> is a
shorthand property.</p>
<div class=example>
In this example, the shorthand <a class=property data-link-type=propdesc href=#propdef-column-rule title=column-rule>column-rule</a> declaration from the
above example has been expanded:
<pre>body {
column-gap: 1em;
column-rule-width: thin;
column-rule-style: solid;
column-rule-color: black;
}
</pre>
</div>
<p>The <a class=property data-link-type=propdesc href=#propdef-column-fill title=column-fill>column-fill</a> and <a class=property data-link-type=propdesc href=#propdef-column-span title=column-span>column-span</a> properties give style sheets a
wider range of visual expressions in multi-column layouts.</p>
<div class=example>
In this example, columns are set to be balanced, i.e., to have
approximately the same length. Also, <code>h2</code> elements are set
to span across all columns.
<pre>div { column-fill: balance }
h2 { column-span: all }
</pre>
</div>
<p>This specification introduces ten new properties, all of which
are used in the examples above.</p>
<p>To indicate where column breaks should (or should not) appear, new
keyword values are introduced.</p>
<div class=example>
In this example, <code>h1</code> elements will always have a column
break before them, but the formatter will try to avoid column breaks
inside and after the element.
<pre>h1 {
break-before: column;
break-inside: avoid-column;
break-after: avoid-column;
}
</pre>
</div>
<p>If all column properties have their initial value, the layout of
an element will be identical to a multi-column layout with only one
column.</p>
<h2 class="heading settled heading" data-level=2 id=the-multi-column-model><span class=secno>2 </span><span class=content>
The multi-column model</span><a class=self-link href=#the-multi-column-model></a></h2>
<p>A <dfn data-dfn-type=dfn data-noexport="" id=multi-column-element title="multi-column element|multicol element">multi-column element<a class=self-link href=#multi-column-element></a></dfn>
(or <em>multicol element</em> for short)
is an element whose <a class=property data-link-type=propdesc href=#propdef-column-width title=column-width>column-width</a> or <a class=property data-link-type=propdesc href=#propdef-column-count title=column-count>column-count</a>
property is not <a class=css data-link-for=column-width data-link-type=maybe href=#valuedef-auto0 title=auto>auto</a> and therefore acts as a container for
multi-column layout.</p>
<p>In the traditional CSS box model, the content of an element is
flowed into the content box of the corresponding element. Multi-column
layout introduces a new type of container between the content box and
the content, namely the <dfn data-dfn-type=dfn data-noexport="" id=column-box>column box<a class=self-link href=#column-box></a></dfn> (or <em>column</em> for
short). The content of a multicol element is flowed into its column
boxes.</p>
<p>Column boxes in a multi-column element are arranged
into <em>rows</em>. Like table cells, the column boxes in a row are
ordered in the inline direction of the multicol element. The
<em>column width</em> is the length of the column box in the inline
direction. The <em>column height</em> is the length of the column box
in the block direction. All column boxes in a row have the same column width, and all
column boxes in a row have the same column height. Within each row in the multi-column element,
adjacent column boxes are separated by a <em>column gap</em>, which
may contain a <em>column rule</em>. All column gaps in the same row
are equal. All column rules in the same row are also equal, if they
appear; column rules only appear between columns that both have
content.</p>
<p>In the simplest case a multicol element will contain only one row
of columns, and the height of each column will be equivalent to the
used height of the multi-column element’s content box.</p>
<div class=example>
Column gaps (yellow) and column rules (green) are shown in this
sample rendition of a multi-column element with padding (blue). The
blue and yellow is present for illustrational purposes only. In actual
implementations these areas will be determined by the background.
<div class=cols>
<div class=col style="">
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc<br>
def g hij klm nopqrs<br>
tuv wxy z. Abc de fg<br>
hi jklmno. Pqrstu vw<br>
x yz. Abc def ghi jkl.<br>
M nop qrst uv wx yz.<br>
<br>
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc<br>
def g hij klm nopqrs
</div>
<div class=col style="left: 175px">
tuv wxy z. Abc de fg<br>
hi jklmno. Pqrstu vw<br>
x yz. Abc def ghi jkl.<br>
M nop qrst uv wx yz.<br>
<br>
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc<br>
def g hij klm nopqrs<br>
tuv wxy z. Abc de fg<br>
hi jklmno. Pqrstu vw<br>
x yz. Abc def ghi jkl.<br>
</div>
<div class=col style="left: 350px">
M nop qrst uv wx yz.<br>
<br>
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc<br>
def g hij klm nopqrs<br>
tuv wxy z. Abc de fg<br>
hi jklmno. Pqrstu vw<br>
x yz. Abc def ghi jkl.<br>
<br>
M nop qrst uv wx yz.<br>
Ab cde fgh i jkl. Mno<br>
Pqr stu vw xyz.
</div>
<div class=gap style="left: 150px"></div>
<div class=gap style="left: 325px"></div>
</div>
</div>
<p>If the multi-column element is paginated, the height of each row is
constrained by the page and the content continues in a new row of
column boxes on the next page; a column box never splits across pages.</p>
<p>The same effect occurs when a <em>spanning element</em> divides the
multi-column element: the columns before the spanning element are
balanced and shortened to fit their content. Content after the
spanning element then flows into a new row of column boxes.</p>
<div class=example>
<div class=cols>
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc<br>
<br>
<br>
M nop qrst uv wx yz.<br>
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc<br>
def g hij klm nopqrs<br>
tuv wxy z. Abc de fg<br>
hi jklmno. Pqrstu vw<br>
<div class=col style="left: 175px">
def g hij klm nopqrs<br>
tuv wxy z. Abc de fg<br>
<br>
<br>
x yz. Abc def ghi jkl.<br>
M nop qrst uv wx yz.<br>
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc<br>
def g hij klm nopqrs<br>
tuv wxy z. Abc de fg<br>
</div>
<div class=col style="left: 350px">
hi jklmno. Pqrstu vw<br>
x yz. Abc def ghi jkl.<br>
<br>
<br>
hi jklmno. Pqrstu vw<br>
x yz. Abc def ghi jkl.<br>
M nop qrst uv wx yz.<br>
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz.
</div>
<div class=rep style="width: 490px; height: 20px; background: silver; font-size: 1.5em; padding: 5px">A spanning element</div>
<div class=gap style="left: 150px"></div>
<div class=gap style="left: 325px"></div>
</div>
</div>
<p>Column boxes are block container boxes. That
is, column boxes behave like block-level, table cell, and inline-block
boxes as per CSS 2.1, section 10.1, item 2 <a data-biblio-type=normative data-link-type=biblio href=#biblio-css21 title=biblio-CSS21>[CSS21]</a>. However, column
boxes do not establish block container boxes for elements with ''position:
fixed<span class=css data-link-type=maybe title=" or "> or </span>position: absolute''.</p>
<div class=example>
In this example, the width of the image is set with these rules:
<pre class=css>img { display: block; width: 100% }
</pre>
<p>Given that the width is calculated relative to the column box, the
image will be as wide as the column box:</p>
<div class=cols>
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc<br>
<br>
<br>
<br>
<br>
<br>
<br>
def g hij klm nopqrs<br>
tuv wxy z. Abc de fg<br>
<div class=col style="left: 175px">
hi jklmno. Pqrstu vw<br>
x yz. Abc def ghi jkl.<br>
M nop qrst uv wx yz.<br>
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc<br>
def g hij klm nopqrs<br>
tuv wxy z. Abc de fg<br>
hi jklmno. Pqrstu vw<br>
x yz. Abc def ghi jkl.<br>
M nop qrst uv wx yz.<br>
</div>
<div class=col style="left: 350px">
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc<br>
def g hij klm nopqrs<br>
tuv wxy z. Abc de fg<br>
hi jklmno. Pqrstu vw<br>
x yz. Abc def ghi jkl.<br>
M nop qrst uv wx yz.<br>
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz.
</div>
<div class=rep style="width: 150px"></div>
<div class=gap style="left: 150px"></div>
<div class=gap style="left: 325px"></div>
</div>
</div>
<p>Floats that appear inside multi-column layouts are positioned with
regard to the column box where the float appears.</p>
<div class=example>
In this example, this CSS fragment describes the presentation of the image:
<pre class=css>img { display: block; float: right }
</pre>
<div class=cols>
<div class=col style="">
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc<br>
def g<br>
hij klm<br>
nopq<br>
rs tuv<br>
wxy x<br>
yz. Ab <br>
cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc
</div>
<div class=col style="left: 175px">
def g hij klm nopqrs<br>
tuv wxy z. Abc de fg<br>
hi jklmno. Pqrstu vw<br>
x yz. Abc def ghi jkl.<br>
M nop qrst uv wx yz.<br>
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc<br>
def g hij klm nopqrs<br>
tuv wxy z. Abc de fg<br>
hi jklmno. Pqrstu vw<br>
</div>
<div class=col style="left: 350px">
x yz. Abc def ghi jkl.<br>
M nop qrst uv wx yz.<br>
Ab cde fgh i jkl. Mno<br>
pqr stu vw xyz. A bc<br>
def g hij klm nopqrs<br>
tuv wxy z. Abc de fg<br>
hi jklmno. Pqrstu vw<br>
x yz. Abc def ghi jkl.<br>
M nop qrst uv wx yz.<br>
</div>
<div class=rep style="left: 50px"></div>
<div class=gap style="left: 150px"></div>
<div class=gap style="left: 325px"></div>
</div>
<p>The black box represents the image.</p>
</div>
<p>A multi-column element establishes a new block formatting context,
as per CSS 2.1 section 9.4.1.</p>
<div class=example>
A top margin set on the first child element of a multicol element will not collapse with the margins of the multicol element.
</div>
<p>Nested multi-column elements are allowed, but there may be
implementation-specific limits.</p>
<p class=note>Note: It is not possible to set properties/values on column boxes. For
example, the background of a certain column box cannot be set and a
column box has no concept of padding, margin or borders. Future specifications may add additional
functionality. For example, columns of different widths and different
backgrounds may be supported.</p>
<p class=note>Note: Multicol elements with column heights larger than the viewport may pose accessibility issues.</p>
<h2 class="heading settled heading" data-level=3 id=the-number-and-width-of-columns><span class=secno>3 </span><span class=content>
The number and width of columns</span><a class=self-link href=#the-number-and-width-of-columns></a></h2>
<p>Finding the number and width of columns is fundamental when laying
out multi-column content. These properties are used to set the number
and width of columns:</p>
<ul>
<li><a class=property data-link-type=propdesc href=#propdef-column-count title=column-count>column-count</a>
<li><a class=property data-link-type=propdesc href=#propdef-column-width title=column-width>column-width</a>
</ul>
<p>A third property, <a class=property data-link-type=propdesc href=#propdef-columns title=columns>columns</a>, is a shorthand property which sets both
<a class=property data-link-type=propdesc href=#propdef-column-width title=column-width>column-width</a> and <a class=property data-link-type=propdesc href=#propdef-column-count title=column-count>column-count</a>.</p>
<p>Other factors, such as explicit column breaks, content, and height
constraints, may influence the actual number and width of columns.</p>
<h3 class="heading settled heading" data-level=3.1 id=cw><span class=secno>3.1 </span><span class=content>
<a class=property data-link-type=propdesc href=#propdef-column-width title=column-width>column-width</a></span><a class=self-link href=#cw></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-column-width>column-width<a class=self-link href=#propdef-column-width></a></dfn><tr><th>Value:<td class=prod>auto <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a><tr><th>Initial:<td>auto<tr><th>Applies to:<td>non-replaced block-level elements (except table elements), table cells, and inline-block elements<tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>the absolute length, zero or larger<tr><th>Percentages:<td>N/A<tr><th>Animatable:<td>as <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a></table>
<p>This property describes the width of columns in multicol elements.</p>
<dl data-dfn-for=column-width data-dfn-type=value>
<dt><dfn class=css-code data-dfn-for=column-width data-dfn-type=value data-export="" id=valuedef-auto0>auto<a class=self-link href=#valuedef-auto0></a></dfn>
<dd>
means that the column width will be determined by other properties
(e.g., <a class=property data-link-type=propdesc href=#propdef-column-count title=column-count>column-count</a>, if it has a non-auto value).
<dt><dfn class=css-code data-dfn-for=column-width data-dfn-type=value data-export="" id=valuedef-length0><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a><a class=self-link href=#valuedef-length0></a></dfn>
<dd>
describes the optimal column width. The actual column width may be
wider (to fill the available space), or narrower (only if the
available space is smaller than the specified column width). Specified values
must be greater than 0.
</dl>
<div class=example>
For example, consider this style sheet:
<pre>div {
width: 100px;
column-width: 45px;
column-gap: 0;
column-rule: none;
}
</pre>
<p>There is room for two 45px wide columns inside the 100px wide element. In
order to fill the available space the actual column width will be
increased to 50px.</p>
</div>
<div class=example>
Also, consider this style sheet:
<pre>div {
width: 40px;
column-width: 45px;
column-gap: 0;
column-rule: none;
}
</pre>
<p>The available space is smaller than the specified column width and
the actual column width will therefore be decreased.</p>
</div>
<p>To ensure that <a class=property data-link-type=propdesc href=#propdef-column-width title=column-width>column-width</a> can be used with vertical text,
column width means the length of the line boxes inside the columns.</p>
<p class=note>Note: The reason for making <a class=property data-link-type=propdesc href=#propdef-column-width title=column-width>column-width</a> somewhat flexible
is to achieve scalable designs that can fit many screen sizes. To set
an exact column width, the column gap and the width of the multicol
element (assuming horizontal text) must also be specified.</p>
<h3 class="heading settled heading" data-level=3.2 id=cc><span class=secno>3.2 </span><span class=content>
<a class=property data-link-type=propdesc href=#propdef-column-count title=column-count>column-count</a></span><a class=self-link href=#cc></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-column-count>column-count<a class=self-link href=#propdef-column-count></a></dfn><tr><th>Value:<td class=prod>auto <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-integer title="<integer>"><integer></a><tr><th>Initial:<td>auto<tr><th>Applies to:<td>non-replaced block-level elements (except table elements), table cells, and inline-block elements<tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>specified value<tr><th>Percentages:<td>N/A<tr><th>Animatable:<td>as <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-integer title="<integer>"><integer></a></table>
<p>This property describes the number of columns of a multicol element.</p>
<dl data-dfn-for=column-count data-dfn-type=value>
<dt><dfn class=css-code data-dfn-for=column-count data-dfn-type=value data-export="" id=valuedef-auto1>auto<a class=self-link href=#valuedef-auto1></a></dfn>
<dd>
means that the number of columns will be determined by other properties
(e.g., <a class=property data-link-type=propdesc href=#propdef-column-width title=column-width>column-width</a>, if it has a non-auto value).
<dt><dfn class=css-code data-dfn-for=column-count data-dfn-type=value data-export="" id=valuedef-integer><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-integer title="<integer>"><integer></a><a class=self-link href=#valuedef-integer></a></dfn>
<dd>
describes the optimal number of columns into which the content of
the element will be flowed. Values must be greater than 0. If both
<a class=property data-link-type=propdesc href=#propdef-column-width title=column-width>column-width</a> and <a class=property data-link-type=propdesc href=#propdef-column-count title=column-count>column-count</a> have non-auto values, the integer
value describes the maximum number of columns.
</dl>
<div class=example>
Example:
<pre>body { column-count: 3 }</pre>
</div>
<h3 class="heading settled heading" data-level=3.3 id=columns><span class=secno>3.3 </span><span class=content>
<a class=property data-link-type=propdesc href=#propdef-columns title=columns>columns</a></span><a class=self-link href=#columns></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-columns>columns<a class=self-link href=#propdef-columns></a></dfn><tr><th>Value:<td class=prod><a class=production data-link-type=propdesc href=#propdef-column-width title=column-width><‘column-width’></a> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-any title=||>||</a> <a class=production data-link-type=propdesc href=#propdef-column-count title=column-count><‘column-count’></a><tr><th>Initial:<td>see individual properties<tr><th>Applies to:<td>see individual properties<tr><th>Inherited:<td>see individual properties<tr><th>Media:<td>see individual properties<tr><th>Computed value:<td>see individual properties<tr><th>Percentages:<td>see individual properties<tr><th>Animatable:<td>see individual properties</table>
<p>This is a shorthand property for setting <a class=property data-link-type=propdesc href=#propdef-column-width title=column-width>column-width</a> and
<a class=property data-link-type=propdesc href=#propdef-column-count title=column-count>column-count</a>. Omitted values are set to their initial values.</p>
<div class=example>
Here are some valid declarations using the <a class=property data-link-type=propdesc href=#propdef-columns title=columns>columns</a> property:
<pre>columns: 12em; /* column-width: 12em; column-count: auto */
columns: auto 12em; /* column-width: 12em; column-count: auto */
columns: 2; /* column-width: auto; column-count: 2 */
columns: 2 auto; /* column-width: auto; column-count: 2 */
columns: auto; /* column-width: auto; column-count: auto */
columns: auto auto; /* column-width: auto; column-count: auto */
</pre>
</div>
<h3 class="heading settled heading" data-level=3.4 id=pseudo-algorithm><span class=secno>3.4 </span><span class=content>
Pseudo-algorithm</span><a class=self-link href=#pseudo-algorithm></a></h3>
<p>The pseudo-algorithm below determines the used values for
<a class=property data-link-type=propdesc href=#propdef-column-count title=column-count>column-count</a> (N) and <a class=property data-link-type=propdesc href=#propdef-column-width title=column-width>column-width</a> (W) when . There is one other variable
in the pseudo-algorithm: U is the used width of the multi-column
element.</p>
<p class=note>Note: The used width U of the multi-column element can depend on the element’s contents,
in which case it also depends on the computed values of the <a class=property data-link-type=propdesc href=#propdef-column-count title=column-count>column-count</a> and <a class=property data-link-type=propdesc href=#propdef-column-width title=column-width>column-width</a> properties.
This specification does not define how U is calculated.
Another module
(probably the Basic Box Model <a data-biblio-type=informative data-link-type=biblio href=#biblio-css3box title=biblio-CSS3BOX>[CSS3BOX]</a> or the Intrinsic & Extrinsic Sizing Module <a data-biblio-type=informative data-link-type=biblio href=#biblio-css3-sizing title=biblio-CSS3-SIZING>[CSS3-SIZING]</a>)
is expected to define this.</p>
<p>The <code>floor(X)</code> function returns the largest integer Y ≤ X.</p>
<pre>(01) if ((column-width = auto) and (column-count = auto)) then
(02) exit; /* not a multicol element */
(03) if column-width = auto then
(04) N := column-count
(05) else if column-count = auto then
(06) N := max(1,
(07) floor((U + column-gap)/(column-width + column-gap)))
(08) else
(09) N := min(column-count, max(1,
(10) floor((U + column-gap)/(column-width + column-gap))))
</pre>
<p>And:</p>
<pre>(11) W := max(0, ((U + column-gap)/N - column-gap))
</pre>
<p>In paged media, user agents may perform this calculation on a
per-page basis.</p>
<p>The used value for <a class=property data-link-type=propdesc href=#propdef-column-count title=column-count>column-count</a> is calculated without
regard for explicit column breaks or constrained column heights,
while the actual value takes these into consideration.</p>
<div class=example>
In this example, the actual column-count is higher than the used column-count due to explicit column breaks:
<pre>div { width: 40em; columns: 20em; column-gap: 0 }
p { break-after: column }
<div>
<p>one
<p>two
<p>three
</div>
</pre>
<p>The computed column-count is auto, the used column-count is 2 and the actual column-count is 3.</p>
</div>
<div class=example>
The actual column-count may be lower than the used column-count. Consider this example:
<pre>div {
width: 80em;
height: 10em;
columns: 20em;
column-gap: 0;
column-fill: auto;
}
<div>foo</div>
</pre>
<p>The computed column-count is auto, the used column-count is 4, and the actual column-count is 1.</p>
</div>
<h3 class="heading settled heading" data-level=3.5 id=stacking-context><span class=secno>3.5 </span><span class=content>
Stacking context</span><a class=self-link href=#stacking-context></a></h3>
<p>All column boxes in a multi-column element are in the same stacking
context and the drawing order of their contents is as specified in
CSS 2.1. Column boxes do not establish new stacking contexts.</p>
<h2 class="heading settled heading" data-level=4 id=column-gaps-and-rules><span class=secno>4 </span><span class=content>
Column gaps and rules</span><a class=self-link href=#column-gaps-and-rules></a></h2>
<p>Column gaps and rules are placed between columns in the same
multicol element. The length of the column gaps and column rules
is equal to the column height. Column gaps take up space. That
is, column gaps will push apart content in adjacent columns (within
the same multicol element).</p>
<p>A column rule is drawn in the middle of the column gap with the
endpoints at opposing content edges of the multicol element. Column
rules do not take up space. That is, the presence or thickness of a
column rule will not alter the placement of anything else. If a column
rule is wider than its gap, the adjacent column boxes will overlap the
rule, and the rule may possibly extend outside the box of the multicol
element. Column rules are painted in the inline content layer, but
below all inline content inside the multicol element. Column rules are
only drawn between two columns that both have content.</p>
<h3 class="heading settled heading" data-level=4.1 id=column-gap><span class=secno>4.1 </span><span class=content>
<a class=property data-link-type=propdesc href=#propdef-column-gap title=column-gap>column-gap</a></span><a class=self-link href=#column-gap></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-column-gap>column-gap<a class=self-link href=#propdef-column-gap></a></dfn><tr><th>Value:<td class=prod><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> normal<tr><th>Initial:<td>normal<tr><th>Applies to:<td><a data-link-type=dfn href=#multi-column-element title="multicol elements">multicol elements</a><tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>absolute length or <a class=css data-link-type=maybe href=#valuedef-normal title=normal>normal</a><tr><th>Percentages:<td>N/A<tr><th>Animatable:<td>as <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a></table>
<dl data-dfn-for=column-gap data-dfn-type=value>
<dt><dfn class=css-code data-dfn-for=column-gap data-dfn-type=value data-export="" id=valuedef-length><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a><a class=self-link href=#valuedef-length></a></dfn>
<dd>
Specifies the gap between columns.
If there is a column rule between columns,
it will appear in the middle of the gap.
<p>The <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> cannot be negative.</p>
<dt><dfn class=css-code data-dfn-for=column-gap data-dfn-type=value data-export="" id=valuedef-normal>normal<a class=self-link href=#valuedef-normal></a></dfn>
<dd>
Identical to <a class=css-code data-link-for=column-gap data-link-type=value href=#valuedef-length title="<length>"><length></a>,
but with a UA-specified length.
A value of <span class=css data-link-type=maybe title=1em>1em</span> is suggested.
</dl>
<h3 class="heading settled heading" data-level=4.2 id=crc><span class=secno>4.2 </span><span class=content>
<a class=property data-link-type=propdesc href=#propdef-column-rule-color title=column-rule-color>column-rule-color</a></span><a class=self-link href=#crc></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-column-rule-color>column-rule-color<a class=self-link href=#propdef-column-rule-color></a></dfn><tr><th>Value:<td class=prod><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-color-3/#valuea-def-color title="<color>"><color></a><tr><th>Initial:<td>currentcolor<tr><th>Applies to:<td>multicol elements<tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>same as the computed value of <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-color-3/#color0 title=color>color</a> is computed<tr><th>Percentages:<td>N/A<tr><th>Animatable:<td>as <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-color-3/#valuea-def-color title="<color>"><color></a></table>
<dl>
<dt><dfn class=css-code data-dfn-for=column-rule-color data-dfn-type=value data-export="" id=valuedef-color><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-color-3/#valuea-def-color title="<color>"><color></a><a class=self-link href=#valuedef-color></a></dfn>
<dd>
Specifies the color of the column rule.
</dl>
<h3 class="heading settled heading" data-level=4.3 id=crs><span class=secno>4.3 </span><span class=content>
<a class=property data-link-type=propdesc href=#propdef-column-rule-style title=column-rule-style>column-rule-style</a></span><a class=self-link href=#crs></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-column-rule-style>column-rule-style<a class=self-link href=#propdef-column-rule-style></a></dfn><tr><th>Value:<td class=prod><a class=production data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-3/#border-style title=border-style><‘border-style’></a><tr><th>Initial:<td>none<tr><th>Applies to:<td>multicol elements<tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>specified value<tr><th>Percentages:<td>N/A<tr><th>Animatable:<td>no</table>
<p>The <a class=property data-link-type=propdesc href=#propdef-column-rule-style title=column-rule-style>column-rule-style</a> property sets the style of the rule between columns of an element.
The <a class=production data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-3/#border-style title=border-style><‘border-style’></a> values are interpreted as in the <a href=http://www.w3.org/TR/CSS2/tables.html#collapsing-borders>collapsing border model</a>.</p>
<p>The <span class=css data-link-for=border-style data-link-type=maybe title=none>none</span> value forces the computed value of <a class=property data-link-type=propdesc href=#propdef-column-rule-width title=column-rule-width>column-rule-width</a> to be <span class=css data-link-type=maybe title=0>0</span>.</p>
<h3 class="heading settled heading" data-level=4.4 id=crw><span class=secno>4.4 </span><span class=content>
<a class=property data-link-type=propdesc href=#propdef-column-rule-width title=column-rule-width>column-rule-width</a></span><a class=self-link href=#crw></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-column-rule-width>column-rule-width<a class=self-link href=#propdef-column-rule-width></a></dfn><tr><th>Value:<td class=prod><a class=production data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-3/#border-width title=border-width><‘border-width’></a><tr><th>Initial:<td>medium<tr><th>Applies to:<td>multicol elements<tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>absolute length; <span class=css data-link-type=maybe title=0>0</span> if the column rule style is <a class=css data-link-type=maybe href=#valuedef-none title=none>none</a> or <span class=css data-link-type=maybe title=hidden>hidden</span><tr><th>Percentages:<td>N/A<tr><th>Animatable:<td>as <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a></table>
<p>This property sets the width of the rule between columns.
Negative values are not allowed.</p>
<h3 class="heading settled heading" data-level=4.5 id=column-rule><span class=secno>4.5 </span><span class=content>
<a class=property data-link-type=propdesc href=#propdef-column-rule title=column-rule>column-rule</a></span><a class=self-link href=#column-rule></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-column-rule>column-rule<a class=self-link href=#propdef-column-rule></a></dfn><tr><th>Value:<td class=prod><a class=production data-link-type=propdesc href=#propdef-column-rule-width title=column-rule-width><‘column-rule-width’></a> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-any title=||>||</a> <a class=production data-link-type=propdesc href=#propdef-column-rule-style title=column-rule-style><‘column-rule-style’></a> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-any title=||>||</a> <a class=production data-link-type=propdesc href=#propdef-column-rule-color title=column-rule-color><‘column-rule-color’></a><tr><th>Initial:<td>see individual properties<tr><th>Applies to:<td>see individual properties<tr><th>Inherited:<td>see individual properties<tr><th>Media:<td>see individual properties<tr><th>Computed value:<td>see individual properties<tr><th>Percentages:<td>see individual properties<tr><th>Animatable:<td>see individual properties</table>
<p>This property is a shorthand for setting
<a class=property data-link-type=propdesc href=#propdef-column-rule-width title=column-rule-width>column-rule-width</a>, <a class=property data-link-type=propdesc href=#propdef-column-rule-style title=column-rule-style>column-rule-style</a>, and <a class=property data-link-type=propdesc href=#propdef-column-rule-color title=column-rule-color>column-rule-color</a> at
the same place in the style sheet. Omitted values are set to their
initial values.</p>
<div class=example>
In this example, the column rule and the column gap have the same
width. Therefore, they will occupy exactly the same space.
<pre>body {
column-gap: 1em;
column-rule-width: 1em;
column-rule-style: solid;
column-rule-color: black;
}
</pre>
</div>
<div class=example>
If a tall image is moved to a column on the next page to find room
for it, its natural column may be left empty. If so, the column is
still considered to have content for the purpose of deciding if the
column rule should be drawn.
</div>
<h2 class="heading settled heading" data-level=5 id=column-breaks><span class=secno>5 </span><span class=content>
Column breaks</span><a class=self-link href=#column-breaks></a></h2>
<p>When content is laid out in multiple columns, the user agent must
determine where column breaks are placed. The problem of breaking
content into columns is similar to breaking content into pages, which
is described in CSS 2.1, section 13.3.3 <a data-biblio-type=normative data-link-type=biblio href=#biblio-css21 title=biblio-CSS21>[CSS21]</a>.</p>
<p>Three new properties are introduced to allow column breaks to be
described in the same properties as page breaks: <a class=property data-link-type=propdesc href=#propdef-break-before title=break-before>break-before</a>,
<a class=property data-link-type=propdesc href=#propdef-break-after title=break-after>break-after</a>, and <a class=property data-link-type=propdesc href=#propdef-break-inside title=break-inside>break-inside</a>. These properties take the same
values as <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css2/page.html#propdef-page-break-before title=page-break-before>page-break-before</a>, <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css2/page.html#propdef-page-break-after title=page-break-after>page-break-after</a>, and
<a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css2/page.html#propdef-page-break-inside title=page-break-inside>page-break-inside</a> <a data-biblio-type=normative data-link-type=biblio href=#biblio-css21 title=biblio-CSS21>[CSS21]</a>. In addition, some new keyword values
are added.</p>
<h3 class="heading settled heading" data-level=5.1 id=break-before-break-after-break-inside><span class=secno>5.1 </span><span class=content>
<a class=property data-link-type=propdesc href=#propdef-break-before title=break-before>break-before</a>, <a class=property data-link-type=propdesc href=#propdef-break-after title=break-after>break-after</a>, <a class=property data-link-type=propdesc href=#propdef-break-inside title=break-inside>break-inside</a></span><a class=self-link href=#break-before-break-after-break-inside></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-break-before>break-before<a class=self-link href=#propdef-break-before></a></dfn><tr><th>Value:<td class=prod>auto <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> always <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> avoid <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> left <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> right <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> page <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> column <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> avoid-page <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> avoid-column<tr><th>Initial:<td>auto<tr><th>Applies to:<td>block-level elements<tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>specified value<tr><th>Percentages:<td>N/A</table>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-break-after>break-after<a class=self-link href=#propdef-break-after></a></dfn><tr><th>Value:<td class=prod>auto <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> always <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> avoid <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> left <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> right <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> page <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> column <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> avoid-page <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> avoid-column<tr><th>Initial:<td>auto<tr><th>Applies to:<td>block-level elements<tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>specified value<tr><th>Percentages:<td>N/A</table>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-break-inside>break-inside<a class=self-link href=#propdef-break-inside></a></dfn><tr><th>Value:<td class=prod>auto <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> avoid <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> avoid-page <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> avoid-column<tr><th>Initial:<td>auto<tr><th>Applies to:<td>block-level elements<tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>specified value<tr><th>Percentages:<td>N/A</table>
<p>These properties describe page/column break behavior before/after/inside the generated box. These values are normatively defined in <a data-biblio-type=normative data-link-type=biblio href=#biblio-css21 title=biblio-CSS21>[CSS21]</a>:</p>
<dl data-dfn-for="break-before break-after break-inside" data-dfn-type=value>
<dt><dfn class=css-code data-dfn-for="break-before break-after break-inside" data-dfn-type=value data-export="" id=valuedef-auto2>auto<a class=self-link href=#valuedef-auto2></a></dfn>
<dd>
Neither force nor forbid a page/column break before (after, inside) the generated box.
<dt><dfn class=css-code data-dfn-for="break-before break-after break-inside" data-dfn-type=value data-export="" id=valuedef-always>always<a class=self-link href=#valuedef-always></a></dfn>
<dd>
Always force a page break before (after) the generated box.
<dt><dfn class=css-code data-dfn-for="break-before break-after break-inside" data-dfn-type=value data-export="" id=valuedef-avoid>avoid<a class=self-link href=#valuedef-avoid></a></dfn>
<dd>
Avoid a page/column break before (after, inside) the generated box.
<dt><dfn class=css-code data-dfn-for="break-before break-after" data-dfn-type=value data-export="" id=valuedef-left>left<a class=self-link href=#valuedef-left></a></dfn>
<dd>
Force one or two page breaks before (after) the generated box so that the next page is formatted as a left page.
<dt><dfn class=css-code data-dfn-for="break-before break-after" data-dfn-type=value data-export="" id=valuedef-right>right<a class=self-link href=#valuedef-right></a></dfn>
<dd>
Force one or two page breaks before (after) the generated box so that the next page is formatted as a right page.
</dl>
<p>This specification adds the following new values:</p>
<dl data-dfn-for="break-before break-after break-inside" data-dfn-type=value>
<dt><dfn class=css-code data-dfn-for="break-before break-after" data-dfn-type=value data-export="" id=valuedef-page>page<a class=self-link href=#valuedef-page></a></dfn>
<dd>
Always force a page break before (after) the generated box.
<dt><dfn class=css-code data-dfn-for="break-before break-after" data-dfn-type=value data-export="" id=valuedef-column>column<a class=self-link href=#valuedef-column></a></dfn>
<dd>
Always force a column break before (after) the generated box.
<dt><dfn class=css-code data-dfn-for="break-before break-after break-inside" data-dfn-type=value data-export="" id=valuedef-avoid-page>avoid-page<a class=self-link href=#valuedef-avoid-page></a></dfn>
<dd>
Avoid a page break before (after, inside) the generated box.
<dt><dfn class=css-code data-dfn-for="break-before break-after break-inside" data-dfn-type=value data-export="" id=valuedef-avoid-column>avoid-column<a class=self-link href=#valuedef-avoid-column></a></dfn>
<dd>
Avoid a column break before (after, inside) the generated box.
</dl>
<p>When a page or column break splits a box, the box’s margins,
borders, and padding have no visual effect where the split occurs.
However, the margin immediately after a forced page/column break will
be preserved. A forced page/column break is a break that does not occur
naturally.</p>
<p class=note>Note: In the future, new properties may describe alternate
ways to handle margins, borders and padding around page/column breaks.</p>
<div class=example>
In this example, forced column breaks appear before <code>h2</code>
elements and after <code>img</code> elements:
<pre>.multicol { column-width: 8em }
.multicol h2 { break-before: column; margin-top: 2em }
.multicol img { break-after: column }
</pre>
<p>The top margin of <code>h2</code> elements will be preserved since the column break is forced.</p>
</div>
<div class=example>
In this example, the formatter will try avoid column breaks inside <code>p</code> elements:
<pre>p { break-inside: avoid-column }
</pre>
</div>