-
Notifications
You must be signed in to change notification settings - Fork 709
/
Copy pathOverview.src.html
2169 lines (1660 loc) · 55 KB
/
Overview.src.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 PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta charset=utf8>
<title>CSS Multi-column Layout Module</title>
<link rel="stylesheet" type="text/css" href="../default.css">
<link href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS].css" rel=stylesheet type="text/css">
<script defer=defer
src="http://test.csswg.org/harness/annotate.js#css-multicol-1_dev"
type="text/javascript"></script>
<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>
<div class="head">
<!--logo-->
<h1>CSS Multi-column Layout Module</h1>
<h2 class="no-num no-toc" id="w3c-working">[LONGSTATUS] [DATE]</h2>
<dl>
<dt>This version:</dt>
<dd>
<!--<a href="http://www.w3.org/TR/[YEAR]/CR-[SHORTNAME]-[CDATE]">[VERSION]</a>-->
<a href="http://dev.w3.org/csswg/css3-multicol/">http://dev.w3.org/csswg/css3-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 version:
<dd><a href="http://www.w3.org/TR/2009/CR-css3-multicol-20091217/">http://www.w3.org/TR/2009/CR-css3-multicol-20091217/</a>
<dt>Feedback:</dt>
<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 rel="discussion" href="http://lists.w3.org/Archives/Public/www-style/"
>archives</a>)
<dt>Editors:
<dd>Håkon Wium Lie, Opera Software, howcome@opera.com
<dt>Test Suite:
<dd><a href="http://test.csswg.org/suites/css3-multicol/nightly-unstable/">
http://test.csswg.org/suites/css3-multicol/nightly-unstable/</a>
</dl>
<!--begin-copyright-->
<p>[If you keep the <!--comment-->, the copyright will be included
here automatically]</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
<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.
<h2 class="no-num no-toc">Status of this document</h2>
<!--begin-status-->
<p>[If you keep the <!--comment-->, the status boilerplate will be
included here automatically.]</p>
<!--end-status-->
<p>This document has been a Working Draft in the CSS Working Group for
several years. Multi-column layouts are traditionally used in print.
On screen, multi-column layouts have been considered experimental, and
implementation and use experience was deemed necessary in order to
proceed. Several implementations have occurred over the past years, and
this specification incorporates useful feedback from implementors as well as
authors and users.
<p>The specification was updated in April 2011 to correct a
contradiction between the text and the pseudo-algorithm in
section 3.4. The pseudo-algorithm was corrected and also made
easier to read. The wording of a few other sections was improved in
places, without changes to the functionality. In January, 2012, some
examples and the description of the 'column-fill' property was
revised.
<p>This document will remain Candidate Recommendation at least until
12 May 2011. See the <a href="#cr-exit-criteria">CR exit
criteria.</a>
<h2 class="no-num no-toc"><a name="contents">Table of contents</a></h2>
<!--begin-toc-->
<p>[If you keep the <!--comment--> the table of contents will be
included here automatically.]</p>
<!--end-toc-->
<h2>Introduction</h2>
<p>(This section is not normative.)
<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>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>Multi-column layouts are easy to describe in CSS. Here is a simple example:
<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 ''12em'' wide. The exact number of
columns will depend on the available space.
</div>
<p>The number of columns can also be set explicitly in the style sheet:
<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.
</div>
<p>The shorthand 'columns' property can be used to set either,
or both, properties in one declaration.
<div class=example>
<p>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.
</div>
<p>Another group of properties introduced in this module describe
gaps and rules between columns.
<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 'column-rule' property.
</div>
<p>The values of the 'column-rule' property are similar to those of
the CSS border properties. Like 'border', 'column-rule' is a
shorthand property.
<div class=example>
<p>In this example, the shorthand 'column-rule' 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 'column-fill' and 'column-span' properties give style sheets a
wider range of visual expressions in multi-column layouts.
<div class=example>
<p>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>To indicate where column breaks should (or should not) appear, new
keyword values are introduced.
<div class=example>
<p>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>
<!--<p>The properties and values used in this example are formally defined in [!CSS3PAGE]].-->
</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.
<h2>The multi-column model</h2>
<p>A <dfn>multi-column element</dfn> (or <em>multicol element</em>
for short) is an element whose 'column-width' or 'column-count'
property is not ''auto'' and therefore acts as a container for
multi-column layout.
<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>column box</dfn> (or <em>column</em> for
short). The content of a multicol element is flowed into its column
boxes.
<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>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. 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.
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>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.
<p class="note">Future specifications may add additional
functionality. For example, columns of different widths and different
backgrounds may be supported.</p>
<div class="example">
<p>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="">
<p>
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. A bc<br>
def g hij klm nopqrs
</div>
<div class="col" style="left: 175px">
<p>
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>
x yz. Abc def ghi jkl.<br>
</div>
<div class="col" style="left: 350px">
<p>
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>
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>
<p>To illustrate the effects of the various properties described in
this specification, variations on a sample document will be used. Here
is the source code of the sample document:
<pre class="html">
<html>
<style type="text/css">
div {
column-width: 15em;
column-gap: 2em; /* shown in yellow */
column-rule: 4px solid green;
padding: 5px; /* shown in blue */
}
p { margin: 0; padding: 0 }
img { display: none }
</style>
<body>
<div>
<p>Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
<img src=...>
def g hij
...
</div>
</body>
</html>
</pre>
<p>The nonsensical text in the example is the English alphabet which
shows how text flows from one column to another. To simplify the
visualization, the textual content of the different examples vary
slightly.
</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 [[!CSS21]]. However, column
boxes do not establish block container boxes for elements with ''position:
fixed'' or ''position: absolute''.
<div class=example>
<p>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:
<div class=cols>
<p>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">
<p>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">
<p>
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.
<div class="example">
<p>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="">
<p>
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">
<p>
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">
<p>
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.
</div>
<p>A multi-column element establishes a new block formatting context,
as per CSS 2.1 section 9.4.1.
<div class="example">
<p>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.
<h2>The number and width of columns</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:
<!--When the block direction
is unconstrained and no column breaks are added through style sheets,
these two properties determine the outcome:-->
<ul>
<li>'column-count'
<li>'column-width'
</ul>
<p>A third property, 'columns', is a shorthand property which sets both
'column-width' and 'column-count'.
<p>Other factors, such as explicit column breaks, content, and height
constraints, may influence the actual number and width of columns.
<h3 id='cw'>'column-width'</h3>
<table class=propdef>
<tr>
<td><em>Name:</em>
<td><dfn>column-width</dfn>
<tr>
<td><em>Value:</em>
<td><length> | auto
<tr>
<td><em>Initial:</em>
<td>auto
<tr>
<td><em>Applies to:</em>
<td>non-replaced block-level elements (except table elements), table cells, and inline-block elements
<tr>
<td><em>Inherited:</em>
<td>no
<tr>
<td><em>Percentages:</em>
<td>N/A
<tr>
<td><em>Media:</em>
<td>visual
<tr>
<td><em>Computed value:</em>
<td>the absolute length, zero or larger
<tr>
<td><em>Animatable:</em>
<td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-length">length</a>
</table>
<p>This property describes the width of columns in multicol elements.
<dl>
<dt>auto
<dd>means that the column width will be determined by other properties
(e.g., 'column-count', if it has a non-auto value).
<dt><length>
<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>
<p>For example, consider this style sheet:</p>
<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>
<p>Also, consider this style sheet:</p>
<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 'column-width' can be used with vertical text,
column width means the length of the line boxes inside the columns.
<p class=note>The reason for making 'column-width' somewhat flexible
is to achieve scalable designs that can fit many screen sizes. To set
an exact column width, all length values (in horizontal text these
are: 'width', 'column-width', 'column-gap', and 'column-rule-width')
must be specified.</p>
<h3 id='cc'>'column-count'</h3>
<table class=propdef>
<tr>
<td><em>Name:</em>
<td><dfn>column-count</dfn>
<tr>
<td><em>Value:</em>
<td><integer> | auto
<tr>
<td><em>Initial:</em>
<td>auto
<tr>
<td><em>Applies to:</em>
<td>non-replaced block-level elements (except table elements), table cells, and inline-block elements
<tr>
<td><em>Inherited:</em>
<td>no
<tr>
<td><em>Percentages:</em>
<td>N/A
<tr>
<td><em>Media:</em>
<td>visual
<tr>
<td><em>Computed value:</em>
<td>specified value
<tr>
<td><em>Animatable:</em>
<td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-integer">integer</a>
</table>
<p>This property describes the number of columns of a multicol element.
<dl>
<dt>auto
<dd>means that the number of columns will be determined by other properties
(e.g., 'column-width', if it has a non-auto value).
<dt><integer>
<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
'column-width' and 'column-count' have non-auto values, the integer
value describes the maximum number of columns.
</dl>
<div class=example>
<p>Example:</p>
<pre>body { column-count: 3 }</pre>
</div>
<h3>'columns'</h3>
<table class=propdef>
<tr>
<td><em>Name:</em>
<td><dfn>columns</dfn>
<tr>
<td><em>Value:</em>
<td><a href='#cw'><'column-width'></a> || <a href='#cc'><'column-count'></a>
<tr>
<td><em>Initial:</em>
<td>see individual properties
<tr>
<td><em>Applies to:</em>
<td>non-replaced block-level elements (except table elements), table cells, and inline-block elements
<tr>
<td><em>Inherited:</em>
<td>no
<tr>
<td><em>Percentages:</em>
<td>N/A
<tr>
<td><em>Media:</em>
<td>visual
<tr>
<td><em>Computed value:</em>
<td>see individual properties
<tr>
<td><em>Animatable:</em>
<td>see individual properties
</table>
<p>This is a shorthand property for setting 'column-width' and
'column-count'. Omitted values are set to their initial values.
<div class="example">
<p>Here are some valid declarations using the 'columns' 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>Pseudo-algorithm</h3>
<P>The pseudo-algorithm below determines the used values for
'column-count' (N) and 'column-width' (W) when . There is one other variable
in the pseudo-algorithm: U is the used width of the multi-column
element.
<p class=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 'column-count' and 'column-width' properties. This specification does not define how U is calculated. Another module (probably the Basic Box Model [[CSS3BOX]] or the Intrinsic & Extrinsic Sizing Module [[CSS3-SIZING]]) is expected to define this.
<!--
<p>Two assumptions are being made by the pseudo-algorithm:
<ul>
<li>that the block direction is unconstrained
<li>that no column breaks are added through style sheets
</ul>
-->
<p>The <code>floor(X)</code> function returns the largest integer Y ≤ X.
<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:
<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>The used value for 'column-count' is calculated without
regard for explicit column breaks or constrained column lengths,
while the actual value takes these into consideration.
<div class=example>
<p>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.
</div>
<div class=example>
<p>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.
</div>
<h3>Stacking context</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.
<h2>Column gaps and rules</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 length of the columns. Column gaps take up space. That
is, column gaps will push apart content in adjacent columns (within
the same multicol element).
<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.
<h3>'column-gap'</h3>
<table class=propdef>
<tr>
<td><em>Name:</em>
<td><dfn>column-gap</dfn>
<tr>
<td><em>Value:</em>
<td><length> | normal
<tr>
<td><em>Initial:</em>
<td>normal
<tr>
<td><em>Applies to:</em>
<td>multicol elements
<tr>
<td><em>Inherited:</em>
<td>no
<tr>
<td><em>Percentages:</em>
<td>N/A
<tr>
<td><em>Media:</em>
<td>visual
<tr>
<td><em>Computed value:</em>
<td>absolute length or 'normal'
<tr>
<td><em>Animatable:</em>
<td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-length">length</a>
</table>
<p>The 'column-gap' property sets the gap between columns. If there is
a column rule between columns, it will appear in the middle of the
gap.
<p>The ''normal'' value is UA-specific. A value of ''1em'' is suggested.
<p>Column gaps cannot be negative.
<h3 id='crc'>'column-rule-color'</h3>
<table class=propdef>
<tr>
<td><em>Name:</em>
<td><dfn>column-rule-color</dfn>
<tr>
<td><em>Value:</em>
<td><color>
<tr>
<td><em>Initial:</em>
<td><a href="http://www.w3.org/TR/css3-color/#currentcolor">currentColor</a>
<!-- <td>same as for 'color' property [[!CSS21]]-->
<tr>
<td><em>Applies to:</em>
<td>multicol elements
<tr>
<td><em>Inherited:</em>
<td>no
<tr>
<td><em>Percentages:</em>
<td>N/A
<tr>
<td><em>Media:</em>
<td>visual
<tr>
<td><em>Computed value:</em>
<td>the same as the computed value for the 'color' property [[!CSS21]]
<tr>
<td><em>Animatable:</em>
<td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-color">color</a>
</table>
<p>This property sets the color of the column rule. The <color>
values are defined in [[!CSS21]].
<h3 id='crs'>'column-rule-style'</h3>
<table class=propdef>
<tr>
<td><em>Name:</em>
<td><dfn>column-rule-style</dfn>
<tr>
<td><em>Value:</em>
<td><a href="http://www.w3.org/TR/CSS2/tables.html#table-border-styles"><border-style></a>
<!--http://www.w3.org/TR/CSS21/box.html#value-def-border-style-->
<tr>
<td><em>Initial:</em>
<td>none
<tr>
<td><em>Applies to:</em>
<td>multicol elements
<tr>
<td><em>Inherited:</em>
<td>no