css3-multicol/Overview.src.html

Thu, 07 Feb 2013 22:43:19 -0800

author
L. David Baron <dbaron@dbaron.org>
date
Thu, 07 Feb 2013 22:43:19 -0800
changeset 7398
34298d3d5627
parent 6240
c685227b6e8a
permissions
-rw-r--r--

[css3-multicol] Add "Animatable:" lines to propdef tables.

This is as resolved in Tucson face-to-face at
2013-02-04 11:40:47 -0700, and edited by me per discussion starting at
2013-02-05 11:11:38 -0700.

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
     2 <html lang="en">
     3 <head>
     4 <title>CSS Multi-column Layout Module</title>
     6 <link rel="stylesheet" type="text/css" href="../default.css">
     8 <link href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS].css" rel=stylesheet type="text/css">
    10 <style type="text/css">
    11 .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 }
    12 .cols p { padding: 3px; margin: 0 }
    13 .col { position: absolute; left: 0px; top: 0; z-index: 6; width: 170px }
    14 .gap { position: absolute; background: green; width: 5px; bottom: 0px; top: 0px; border: 10px solid yellow; border-top-width: 0; border-bottom-width: 0;  }
    15 .rep { position: absolute; top: 45px; background: black; height: 110px; width: 100px;  color: white; z-index: 4 }
    17 table.breaks { border-collapse: collapse; margin: 1em 0 }
    18 table.breaks td, table.breaks th { border: thin solid black; padding: 0.1em 0.2em }
    20 div.example:before { width: 9em }
    21 </style>
    23 </head>
    24 <body>
    26 <div class="head">
    28 <!--logo-->
    31 <h1>CSS Multi-column Layout Module</h1>
    33 <h2 class="no-num no-toc" id="w3c-working">[LONGSTATUS] [DATE]</h2>
    35 <dl>
    36 <dt>This version:</dt>
    37 <dd>
    38 <!--<a href="http://www.w3.org/TR/[YEAR]/CR-[SHORTNAME]-[CDATE]">[VERSION]</a>-->
    39 <a href="http://dev.w3.org/csswg/css3-multicol/">http://dev.w3.org/csswg/css3-multicol/</a>
    41 <dt>Latest version:
    43 <dd><a href="http://www.w3.org/TR/css3-multicol">
    44 http://www.w3.org/TR/css3-multicol</a>
    46 <dt>Previous version:
    48 <dd><a href="http://www.w3.org/TR/2009/CR-css3-multicol-20091217/">http://www.w3.org/TR/2009/CR-css3-multicol-20091217/</a>
    50 <dt>Editors:
    52 <dd>H&aring;kon Wium Lie, Opera Software, howcome@opera.com
    53 </dl>
    55 <!--begin-copyright-->
    56 <p>[If you keep the &lt;!--comment-->, the copyright will be included
    57 here automatically]</p>
    58 <!--end-copyright-->
    60 <hr title="Separator for header">
    61 </div>
    64 <h2 class="no-num no-toc" id=abstract>Abstract</h2>
    66 <p>This specification describes multi-column layouts in CSS, a style
    67 sheet language for the web. Using functionality described in the
    68 specification, content can be flowed into multiple columns with a gap
    69 and a rule between them.
    71 <h2 class="no-num no-toc">Status of this document</h2>
    73 <!--begin-status-->
    74 <p>[If you keep the &lt;!--comment-->, the status boilerplate will be
    75 included here automatically.]</p>
    76 <!--end-status-->
    78 <p>This document has been a Working Draft in the CSS Working Group for
    79 several years. Multi-column layouts are traditionally used in print.
    80 On screen, multi-column layouts have been considered experimental, and
    81 implementation and use experience was deemed necessary in order to
    82 proceed. Several implementations have occurred over the past years, and
    83 this specification incorporates useful feedback from implementors as well as
    84 authors and users.
    86 <p>The specification was updated in April 2011 to correct a
    87 contradiction between the text and the pseudo-algorithm in
    88 section&nbsp;3.4. The pseudo-algorithm was corrected and also made
    89 easier to read. The wording of a few other sections was improved in
    90 places, without changes to the functionality. In January, 2012, some
    91 examples and the description of the 'column-fill' property was
    92 revised.
    94 <p>This document will remain Candidate Recommendation at least until
    95 12 May 2011. See the <a href="#cr-exit-criteria">CR exit
    96 criteria.</a>
    99 <h2 class="no-num no-toc"><a name="contents">Table of contents</a></h2>
   101 <!--begin-toc-->
   102 <p>[If you keep the &lt;!--comment--> the table of contents will be
   103 included here automatically.]</p>
   104 <!--end-toc-->
   107 <h2>Introduction</h2>
   109 <p>(This section is not normative.)
   111 <p>This module describes multi-column layout in CSS. By using
   112 functionality described in this document, style sheets can declare
   113 that the content of an element is to be laid out in multiple
   114 columns.
   116 <p>On the Web, tables have also been used to describe multi-column
   117 layouts. The main benefit of using CSS-based columns is flexibility;
   118 content can flow from one column to another, and the number of columns
   119 can vary depending on the size of the viewport. Removing presentation
   120 table markup from documents allows them to more easily be presented on
   121 various output devices including speech synthesizers and small mobile
   122 devices.
   124 <p>Multi-column layouts are easy to describe in CSS. Here is a simple example:
   126 <div class=example>
   127 <pre>body { column-width: 12em }</pre>
   129 <p>In this example, the <code class=html>body</code> element is
   130 set to have columns at least ''12em'' wide. The exact number of
   131 columns will depend on the available space. 
   133 </div>
   135 <p>The number of columns can also be set explicitly in the style sheet:
   137 <div class=example>
   138 <pre>body { column-count: 2 }</pre>
   140 <p>In this case, the number of columns is fixed and the column widths
   141 will vary depending on the available width.
   143 </div>
   145 <p>The shorthand 'columns' property can be used to set either,
   146 or both, properties in one declaration.
   148 <div class=example>
   150 <p>In these examples, the number of columns, the width of columns, and
   151 both the number and width are set, respectively:
   153 <pre>
   154 body { columns: 2 }
   155 body { columns: 12em }
   156 body { columns: 2 12em }
   157 </pre>
   159 <p>However, as described below, setting both the width and number of
   160 columns rarely makes sense.
   162 </div>
   164 <p>Another group of properties introduced in this module describe
   165 gaps and rules between columns.
   167 <div class=example>
   168 <pre>
   169 body { 
   170   column-gap: 1em;
   171   column-rule: thin solid black;
   172 }
   173 </pre>
   175 <p>The first declaration in the example above sets the gap between two
   176 adjacent columns to be 1em. Column gaps are similar to padding areas.
   177 In the middle of the gap there will be a rule which is described by
   178 the 'column-rule' property. 
   179 </div>
   181 <p>The values of the 'column-rule' property are similar to those of
   182 the CSS border properties. Like 'border', 'column-rule' is a
   183 shorthand property.
   185 <div class=example>
   186 <p>In this example, the shorthand 'column-rule' declaration from the
   187 above example has been expanded:
   189 <pre>
   190 body { 
   191   column-gap: 1em;
   192   column-rule-width: thin;
   193   column-rule-style: solid;
   194   column-rule-color: black;
   195 }
   196 </pre>
   197 </div>
   200 <p>The 'column-fill' and 'column-span' properties give style sheets a
   201 wider range of visual expressions in multi-column layouts.
   203 <div class=example>
   204 <p>In this example, columns are set to be balanced, i.e., to have
   205 approximately the same length. Also, <code>h2</code> elements are set
   206 to span across all columns.
   208 <pre>
   209 div { column-fill: balance }
   210 h2 { column-span: all }
   211 </pre>
   212 </div>
   214 <p>This specification introduces ten new properties, all of which
   215 are used in the examples above.
   217 <p>To indicate where column breaks should (or should not) appear, new
   218 keyword values are introduced.
   220 <div class=example>
   222 <p>In this example, <code>h1</code> elements will always have a column
   223 break before them, but the formatter will try to avoid column breaks
   224 inside and after the element.
   226 <pre>
   227 h1 { 
   228   break-before: column; 
   229   break-inside: avoid-column; 
   230   break-after: avoid-column;
   231 }
   232 </pre>
   234 <!--<p>The properties and values used in this example are formally defined in [!CSS3PAGE]].-->
   236 </div>
   238 <p>If all column properties have their initial value, the layout of
   239 an element will be identical to a multi-column layout with only one
   240 column.
   242 <h2>The multi-column model</h2>
   244 <p>A <dfn>multi-column element</dfn> (or <em>multicol element</em>
   245 for short) is an element whose 'column-width' or 'column-count'
   246 property is not ''auto'' and therefore acts as a container for
   247 multi-column layout.
   249 <p>In the traditional CSS box model, the content of an element is
   250 flowed into the content box of the corresponding element. Multi-column
   251 layout introduces a new type of container between the content box and
   252 the content, namely the <dfn>column box</dfn> (or <em>column</em> for
   253 short). The content of a multicol element is flowed into its column
   254 boxes.
   256 <p>Column boxes in a multi-column element are arranged
   257 into <em>rows</em>. Like table cells, the column boxes in a row are
   258 ordered in the inline direction of the multicol element. The
   259 <em>column width</em> is the length of the column box in the inline
   260 direction. The <em>column height</em> is the length of the column box
   261 in the block direction. All column boxes in a row have the same column width, and all
   262 column boxes in a row have the same column height. Within each row in the multi-column element,
   263 adjacent column boxes are separated by a <em>column gap</em>, which
   264 may contain a <em>column rule</em>. All column gaps in the same row
   265 are equal. All column rules in the same row are also equal, if they
   266 appear; column rules only appear between columns that both have
   267 content.
   269 <p>In the simplest case a multicol element will contain only one row
   270 of columns, and the height of each column will be equivalent to the
   271 used height of the multi-column element's content box. If the
   272 multi-column element is paginated, the height of each row is
   273 constrained by the page and the content continues in a new row of
   274 column boxes on the next page; a column box never splits across pages.
   275 The same effect occurs when a <em>spanning element</em> divides the
   276 multi-column element: the columns before the spanning element are
   277 balanced and shortened to fit their content. Content after the
   278 spanning element then flows into a new row of column boxes.
   280 <p>It is not possible to set properties/values on column boxes. For
   281 example, the background of a certain column box cannot be set and a
   282 column box has no concept of padding, margin or borders.
   284 <p class="note">Future specifications may add additional
   285 functionality. For example, columns of different widths and different
   286 backgrounds may be supported.</p>
   289 <div class="example">
   291 <p>Column gaps (yellow) and column rules (green) are shown in this
   292 sample rendition of a multi-column element with padding (blue). The
   293 blue and yellow is present for illustrational purposes only. In actual
   294 implementations these areas will be determined by the background.
   296 <div class=cols>
   298 <div class="col" style="">
   300 <p>
   301 Ab cde fgh i jkl. Mno<br> 
   302 pqr stu vw xyz. A bc<br>
   303 def g hij klm nopqrs<br> 
   304 tuv wxy z. Abc de fg<br>
   305 hi jklmno. Pqrstu vw<br>
   306 x yz. Abc def ghi jkl.<br>
   307 M nop qrst uv wx yz.<br>
   309 Ab cde fgh i jkl. Mno<br> 
   310 pqr stu vw xyz. A bc<br>
   311 def g hij klm nopqrs
   313 </div>
   315 <div class="col" style="left: 175px">
   316 <p>
   317 tuv wxy z. Abc de fg<br>
   318 hi jklmno. Pqrstu vw<br>
   319 x yz. Abc def ghi jkl.<br>
   320 M nop qrst uv wx yz.<br>
   322 Ab cde fgh i jkl. Mno<br> 
   323 pqr stu vw xyz. A bc<br>
   324 def g hij klm nopqrs<br>
   325 tuv wxy z. Abc de fg<br>
   326 hi jklmno. Pqrstu vw<br>
   327 x yz. Abc def ghi jkl.<br>
   330 </div>
   333 <div class="col" style="left: 350px">
   334 <p>
   335 M nop qrst uv wx yz.<br>
   337 Ab cde fgh i jkl. Mno<br> 
   338 pqr stu vw xyz. A bc<br>
   339 def g hij klm nopqrs<br>
   340 tuv wxy z. Abc de fg<br>
   341 hi jklmno. Pqrstu vw<br>
   342 x yz. Abc def ghi jkl.<br>
   344 M nop qrst uv wx yz.<br>
   345 Ab cde fgh i jkl. Mno<br> 
   346 Pqr stu vw xyz.
   347 </div>
   349 <div class=gap style="left: 150px"></div>
   350 <div class=gap style="left: 325px"></div>
   351 </div>
   353 <p>To illustrate the effects of the various properties described in
   354 this specification, variations on a sample document will be used. Here
   355 is the source code of the sample document:
   357 <pre class="html">
   358 &lt;html>
   359 &lt;style type="text/css">
   360 div {
   361   column-width: 15em;
   362   column-gap: 2em;   /* shown in yellow */            
   363   column-rule: 4px solid green;
   364   padding: 5px;      /* shown in blue */
   365 }
   366 p { margin: 0; padding: 0 }
   367 img { display: none }
   368 &lt;/style>
   369 &lt;body>
   370 &lt;div>
   371 &lt;p&gt;Ab cde fgh i jkl. Mno 
   372 pqr stu vw xyz. A bc
   373 &lt;img src=...>
   374 def g hij
   375 ...
   376 &lt;/div>
   377 &lt;/body>
   378 &lt;/html>
   379 </pre>
   381 <p>The nonsensical text in the example is the English alphabet which
   382 shows how text flows from one column to another. To simplify the
   383 visualization, the textual content of the different examples vary
   384 slightly. 
   385 </div>
   388 <p>Column boxes are block container boxes. That
   389 is, column boxes behave like block-level, table cell, and inline-block
   390 boxes as per CSS 2.1, section 10.1, item 2 [[!CSS21]]. However, column
   391 boxes do not establish block container boxes for elements with ''position:
   392 fixed'' or ''position: absolute''. 
   395 <div class=example>
   397 <p>In this example, the width of the image is set with these rules:
   399 <pre class=css>
   400 img { display: block; width: 100% }
   401 </pre>
   403 <p>Given that the width is calculated relative to the column box, the
   404 image will be as wide as the column box:
   406 <div class=cols>
   408 <p>Ab cde fgh i jkl. Mno<br> 
   409 pqr stu vw xyz. A bc<br>
   411 <br><br><br><br><br><br>
   413 def g hij klm nopqrs<br> 
   414 tuv wxy z. Abc de fg<br>
   418 <div class="col" style="left: 175px">
   419 <p>hi jklmno. Pqrstu vw<br>
   420 x yz. Abc def ghi jkl.<br>
   421 M nop qrst uv wx yz.<br>
   423 Ab cde fgh i jkl. Mno<br> 
   424 pqr stu vw xyz. A bc<br>
   425 def g hij klm nopqrs<br>
   426 tuv wxy z. Abc de fg<br>
   427 hi jklmno. Pqrstu vw<br>
   428 x yz. Abc def ghi jkl.<br>
   429 M nop qrst uv wx yz.<br>
   431 </div>
   433 <div class="col" style="left: 350px">
   434 <p>
   435 Ab cde fgh i jkl. Mno<br> 
   436 pqr stu vw xyz. A bc<br>
   437 def g hij klm nopqrs<br>
   438 tuv wxy z. Abc de fg<br>
   439 hi jklmno. Pqrstu vw<br>
   440 x yz. Abc def ghi jkl.<br>
   442 M nop qrst uv wx yz.<br>
   444 Ab cde fgh i jkl. Mno<br> 
   445 pqr stu vw xyz.
   447 </div>
   450 <div class=rep style="width: 150px"></div>
   451 <div class=gap style="left: 150px"></div>
   452 <div class=gap style="left: 325px"></div>
   453 </div>
   455 </div>
   458 <p>Floats that appear inside multi-column layouts are positioned with
   459 regard to the column box where the float appears.
   461 <div class="example">
   463 <p>In this example, this CSS fragment describes the presentation of the image:
   465 <pre class="css">
   466 img { display: block; float: right }
   467 </pre>
   469 <div class=cols>
   471 <div class="col" style="">
   473 <p>
   474 Ab cde fgh i jkl. Mno<br> 
   475 pqr stu vw xyz. A bc<br>
   476 def g<br> 
   477 hij klm<br>
   478 nopq<br>
   479 rs tuv<br>
   480 wxy x<br>
   481 yz. Ab <br>
   482 cde fgh i jkl. Mno<br> 
   483 pqr stu vw xyz. A bc
   485 </div>
   487 <div class="col" style="left: 175px">
   488 <p>
   489 def g hij klm nopqrs<br>
   490 tuv wxy z. Abc de fg<br>
   491 hi jklmno. Pqrstu vw<br>
   492 x yz. Abc def ghi jkl.<br>
   493 M nop qrst uv wx yz.<br>
   495 Ab cde fgh i jkl. Mno<br> 
   496 pqr stu vw xyz. A bc<br>
   497 def g hij klm nopqrs<br>
   498 tuv wxy z. Abc de fg<br>
   499 hi jklmno. Pqrstu vw<br>
   503 </div>
   506 <div class="col" style="left: 350px">
   507 <p>
   508 x yz. Abc def ghi jkl.<br>
   509 M nop qrst uv wx yz.<br>
   511 Ab cde fgh i jkl. Mno<br> 
   512 pqr stu vw xyz. A bc<br>
   513 def g hij klm nopqrs<br>
   514 tuv wxy z. Abc de fg<br>
   515 hi jklmno. Pqrstu vw<br>
   516 x yz. Abc def ghi jkl.<br>
   518 M nop qrst uv wx yz.<br>
   520 </div>
   522 <div class=rep style="left: 50px"></div>
   524 <div class=gap style="left: 150px"></div>
   525 <div class=gap style="left: 325px"></div>
   526 </div>
   528 <p>The black box represents the image. 
   530 </div>
   532 <p>A multi-column element establishes a new block formatting context,
   533 as per CSS 2.1 section 9.4.1.
   535 <div class="example">
   536 <p>A top margin set on the first child element of a multicol element will not collapse with the margins of the multicol element. 
   537 </div>
   539 <p>Nested multi-column elements are allowed, but there may be
   540 implementation-specific limits.
   543 <h2>The number and width of columns</h2>
   545 <p>Finding the number and width of columns is fundamental when
   546 laying out multi-column content. When the block direction
   547 is unconstrained and no column breaks are added through style sheets,
   548 these two properties determine the outcome:
   550 <ul>
   551 <li>'column-count'
   552 <li>'column-width'
   553 </ul>
   555 <p>A third property, 'columns', is a shorthand property which sets both
   556 'column-width' and 'column-count'.
   559 <h3 id='cw'>'column-width'</h3>
   561 <table class=propdef>
   562     <tr>
   563       <td><em>Name:</em>
   564       <td><dfn>column-width</dfn>
   565     <tr>
   566       <td><em>Value:</em>
   567       <td>&lt;length&gt; | auto 
   568     <tr>
   569       <td><em>Initial:</em>
   570       <td>auto
   571     <tr>
   572       <td><em>Applies to:</em>
   573       <td>non-replaced block-level elements (except table elements), table cells, and inline-block elements
   574     <tr>
   575       <td><em>Inherited:</em>
   576       <td>no
   577     <tr>
   578       <td><em>Percentages:</em>
   579       <td>N/A
   580     <tr>
   581       <td><em>Media:</em>
   582       <td>visual
   583     <tr>
   584       <td><em>Computed&nbsp;value:</em>
   585       <td>the absolute length, zero or larger
   586     <tr>
   587       <td><em>Animatable:</em>
   588       <td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-length">length</a>
   589 </table>
   591 <p>This property describes the width of columns in multicol elements.
   593 <dl>
   595 <dt>auto
   597 <dd>means that the column width will be determined by other properties
   598 (e.g., 'column-count', if it has a non-auto value).
   600 <dt>&lt;length>
   602 <dd>describes the optimal column width. The actual column width may be
   603 wider (to fill the available space), or narrower (only if the
   604 available space is smaller than the specified column width). Specified values
   605 must be greater than 0.
   607 </dl>
   611 <div class=example>
   612 <p>For example, consider this style sheet:</p>
   613 <pre>
   614 div {
   615   width: 100px;
   616   column-width: 45px;
   617   column-gap: 0;
   618   column-rule: none;
   619 }
   620 </pre>
   622 <p>There is room for two 45px wide columns inside the 100px wide element. In
   623 order to fill the available space the actual column width will be
   624 increased to 50px.</p>
   626 </div>
   628 <div class=example>
   629 <p>Also, consider this style sheet:</p>
   631 <pre>
   632 div {
   633   width: 40px;
   634   column-width: 45px;
   635   column-gap: 0;
   636   column-rule: none;
   637 }
   638 </pre>
   640 <p>The available space is smaller than the specified column width and
   641 the actual column width will therefore be decreased.</p>
   643 </div>
   645 <p>To ensure that 'column-width' can be used with vertical text,
   646 column width means the length of the line boxes inside the columns.
   648 <p class=note>The reason for making 'column-width' somewhat flexible
   649 is to achieve scalable designs that can fit many screen sizes. To set
   650 an exact column width, all length values (in horizontal text these
   651 are: 'width', 'column-width', 'column-gap', and 'column-rule-width')
   652 must be specified.</p>
   655 <h3 id='cc'>'column-count'</h3>
   657 <table class=propdef>
   658     <tr>
   659       <td><em>Name:</em>
   660       <td><dfn>column-count</dfn>
   661     <tr>
   662       <td><em>Value:</em>
   663       <td>&lt;integer&gt; | auto
   664     <tr>
   665       <td><em>Initial:</em>
   666       <td>auto
   667     <tr>
   668       <td><em>Applies to:</em>
   669       <td>non-replaced block-level elements (except table elements), table cells, and inline-block elements
   670     <tr>
   671       <td><em>Inherited:</em>
   672       <td>no
   673     <tr>
   674       <td><em>Percentages:</em>
   675       <td>N/A
   676     <tr>
   677       <td><em>Media:</em>
   678       <td>visual
   679     <tr>
   680       <td><em>Computed&nbsp;value:</em>
   681       <td>specified value
   682     <tr>
   683       <td><em>Animatable:</em>
   684       <td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-integer">integer</a>
   685 </table>
   687 <p>This property describes the number of columns of a multicol element. 
   689 <dl>
   691 <dt>auto
   693 <dd>means that the number of columns will be determined by other properties
   694 (e.g., 'column-width', if it has a non-auto value).
   696 <dt>&lt;integer>
   698 <dd>describes the optimal number of columns into which the content of
   699 the element will be flowed. Values must be greater than 0. If both
   700 'column-width' and 'column-count' have non-auto values, the integer
   701 value describes the maximum number of columns.
   703 </dl>
   706 <div class=example>
   707 <p>Example:</p>
   708 <pre>body { column-count: 3 }</pre>
   709 </div>
   712 <h3>'columns'</h3>
   714 <table class=propdef>
   715     <tr>
   716       <td><em>Name:</em>
   717       <td><dfn>columns</dfn>
   718     <tr>
   719       <td><em>Value:</em>
   720       <td><a href='#cw'>&lt;'column-width'></a> || <a href='#cc'>&lt;'column-count'></a>
   721     <tr>
   722       <td><em>Initial:</em>
   723       <td>see individual properties
   724     <tr>
   725       <td><em>Applies to:</em>
   726       <td>non-replaced block-level elements (except table elements), table cells, and inline-block elements
   727     <tr>
   728       <td><em>Inherited:</em>
   729       <td>no
   730     <tr>
   731       <td><em>Percentages:</em>
   732       <td>N/A
   733     <tr>
   734       <td><em>Media:</em>
   735       <td>visual
   736     <tr>
   737       <td><em>Computed&nbsp;value:</em>
   738       <td>see individual properties
   739     <tr>
   740       <td><em>Animatable:</em>
   741       <td>see individual properties
   742 </table>
   744 <p>This is a shorthand property for setting 'column-width' and
   745 'column-count'. Omitted values are set to their initial values.
   747 <div class="example">
   748 <p>Here are some valid declarations using the 'columns' property:
   749 <pre>
   750 columns: 12em;      /* column-width: 12em; column-count: auto */
   751 columns: auto 12em; /* column-width: 12em; column-count: auto */
   752 columns: 2;         /* column-width: auto; column-count: 2 */
   753 columns: 2 auto;    /* column-width: auto; column-count: 2 */
   754 columns: auto;      /* column-width: auto; column-count: auto */
   755 columns: auto auto; /* column-width: auto; column-count: auto */
   756 </pre>
   757 </div>
   759 <h3>Pseudo-algorithm</h3>
   761 <P>The pseudo-algorithm below determines the used values for
   762 'column-count' (N) and 'column-width' (W). There are two other
   763 variables in the pseudo-algorithm:
   765 <ul>
   767 <li><code>available-width</code>: if the used width of the
   768 multi-column element has not been determined when the 'column-count'
   769 and 'column-width' must be determined (e.g., if it is floating with a
   770 'width' of 'auto' as per CSS 2.1 section 10.3.5) this variable is
   771 <code>unknown</code>, otherwise it is the same as the used width of
   772 the multi-column element. In vertical text, the used height replaces used width in this calculation.
   774 <li><code>shrink-to-fit</code>: this variable represents the result of
   775 a <em>shrink-to-fit</em> computation. CSS does not define the exact
   776 algorithm. 
   778 </ul>
   780 <p>Two assumptions are being made by the pseudo-algorithm:
   782 <ul>
   783 <li>that the block direction is unconstrained
   784 <li>that no column breaks are added through style sheets
   785 </ul>
   787 <p>The <code>floor()</code> function rounds a number to the next smaller integer.
   789 <!--
   790 <pre>
   791 (01)  if ((column-width = auto) and (column-count = auto)) or
   792 (02)     ((available-width = unknown) and (column-count = auto)) then
   793 (03)    exit; /* no columns */
   794 (04)  fi
   795 (05)  
   796 (06)  if (available-width = unknown) and (column-count != auto) and (column-width != auto) then
   797 (07)    N := column-count;  
   798 (08)    W := column-width;
   799 (09)    exit;
   800 (10)  fi
   801 (11)  
   802 (12)  if (available-width = unknown) then
   803 (13)    available-width := shrink-to-fit;
   804 (14)  fi
   805 (15)  
   806 (16)  if (column-width = auto) then
   807 (18)    N := column-count;
   808 (19)    W := max(0, (available-width - ((N - 1) * column-gap))/N);
   809 (27)  elsif (column-count = auto) then
   810 (28)    if (column-width >= available-width) then
   811 (29)      N := 1
   812 (30)      W := available-width;
   813 (31)    else
   814 (32)      N := floor((available-width + column-gap) / (column-width + column-gap));
   815 (33)      W := ((available-width + column-gap) / N) - column-gap;
   816 (34)    fi
   817 (35)  elsif (column-width >= available-width) then
   818 (36)    N := 1
   819 (37)    W := available-width;
   820 (38)  else
   821 (39)    N := min(column-count, floor((available-width + column-gap) / (column-width + column-gap)))
   822 (40)    W := ((available-width + column-gap) / N) - column-gap;
   823 (41)  fi
   824 </pre>
   826 <p><span class=issue>Alternative encoding of pseudo-algorithm:
   827 -->
   829 <pre>
   830 (01)  if ((column-width = auto) and (column-count = auto)) then
   831 (02)        exit; /* not a multicol element */
   833 (03)  if ((available-width = unknown) and (column-count = auto)) then
   834 (04)    exit; /* no columns */
   836 (05)  if (available-width = unknown) and (column-count != auto) and (column-width != auto) then
   837 (06)    N := column-count;  
   838 (07)    W := column-width;
   839 (08)  exit;
   841 (09)  if (available-width = unknown) then
   842 (10)    available-width := shrink-to-fit;
   844 (11)  if (column-width = auto) and (column-count != auto) then
   845 (12)    N := column-count;
   846 (13)    W := max(0, (available-width - ((N - 1) * column-gap)) / N);
   847 (14)  exit;
   849 (15)  if (column-width != auto) and (column-count = auto) then
   850 (16)    N := max(1, floor((available-width + column-gap) / (column-width + column-gap)));
   851 (17)    W := ((available-width + column-gap) / N) - column-gap;
   852 (18)  exit;
   854 (19)  if (column-width != auto) and (column-count != auto) then
   855 (20)    N := min(column-count, floor((available-width + column-gap) / (column-width + column-gap)))
   856 (21)    N := max(1, N); 
   857 (22)    W := ((available-width + column-gap) / N) - column-gap;
   858 (23)  exit
   859 </pre>
   862 <p>In paged media, user agents may perform this calculation on a
   863 per-page basis.
   865 <p class=note>Note that, in most cases, only one of 'column-width' and
   866 'column-count' affect the layout. If 'column-width' has a value other
   867 than ''auto'', 'column-count' indicates the maximum number of columns.
   868 However, both 'column-width' and 'column-count' are honored when the
   869 width of the element has not been determined. This can, e.g., be the
   870 case for table cells and floats.
   874 <h3>Stacking context</h3>
   876 <p>All column boxes in a multi-column element are in the same stacking
   877 context and the drawing order of their contents is as specified in
   878 CSS 2.1. Column boxes do not establish new stacking contexts.
   881 <h2>Column gaps and rules</h2>
   883 <p>Column gaps and rules are placed between columns in the same
   884 multicol element. The length of the column gaps and column rules
   885 is equal to the length of the columns. Column gaps take up space. That
   886 is, column gaps will push apart content in adjacent columns (within
   887 the same multicol element). 
   889 <p>A column rule is drawn in the middle of the column gap with the
   890 endpoints at opposing content edges of the multicol element. Column
   891 rules do not take up space. That is, the presence or thickness of a
   892 column rule will not alter the placement of anything else. If a column
   893 rule is wider than its gap, the adjacent column boxes will overlap the
   894 rule, and the rule may possibly extend outside the box of the multicol
   895 element. Column rules are painted just above the background of the
   896 multicol element. Column rules are only drawn between two columns that
   897 both have content.
   899 <h3>'column-gap'</h3>
   901 <table class=propdef>
   902     <tr>
   903       <td><em>Name:</em>
   904       <td><dfn>column-gap</dfn>
   905     <tr>
   906       <td><em>Value:</em>
   907       <td>&lt;length&gt; | normal 
   908     <tr>
   909       <td><em>Initial:</em>
   910       <td>normal
   911     <tr>
   912       <td><em>Applies to:</em>
   913       <td>multicol elements
   914     <tr>
   915       <td><em>Inherited:</em>
   916       <td>no
   917     <tr>
   918       <td><em>Percentages:</em>
   919       <td>N/A
   920     <tr>
   921       <td><em>Media:</em>
   922       <td>visual
   923     <tr>
   924       <td><em>Computed&nbsp;value:</em>
   925       <td>absolute length or 'normal'
   926     <tr>
   927       <td><em>Animatable:</em>
   928       <td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-length">length</a>
   929 </table>
   932 <p>The 'column-gap' property sets the gap between columns. If there is
   933 a column rule between columns, it will appear in the middle of the
   934 gap.
   936 <p>The ''normal'' value is UA-specific. A value of ''1em'' is suggested.
   938 <p>Column gaps cannot be negative. 
   940 <h3 id='crc'>'column-rule-color'</h3>
   942 <table class=propdef>
   943     <tr>
   944       <td><em>Name:</em>
   945       <td><dfn>column-rule-color</dfn>
   946     <tr>
   947       <td><em>Value:</em>
   948       <td>&lt;color&gt; 
   949     <tr>
   950       <td><em>Initial:</em>
   951       <td><a href="http://www.w3.org/TR/css3-color/#currentcolor">currentColor</a>
   952 <!--      <td>same as for 'color' property [[!CSS21]]-->
   953     <tr>
   954       <td><em>Applies to:</em>
   955       <td>multicol elements
   956     <tr>
   957       <td><em>Inherited:</em>
   958       <td>no
   959     <tr>
   960       <td><em>Percentages:</em>
   961       <td>N/A
   962     <tr>
   963       <td><em>Media:</em>
   964       <td>visual
   965     <tr>
   966       <td><em>Computed&nbsp;value:</em>
   967       <td>the same as the computed value for the 'color' property [[!CSS21]]
   968     <tr>
   969       <td><em>Animatable:</em>
   970       <td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-color">color</a>
   971 </table>
   973 <p>This property sets the color of the column rule. The &lt;color&gt;
   974 values are defined in [[!CSS21]]. 
   976 <h3 id='crs'>'column-rule-style'</h3>
   978 <table class=propdef>
   979     <tr>
   980       <td><em>Name:</em>
   981       <td><dfn>column-rule-style</dfn>
   982     <tr>
   983       <td><em>Value:</em>
   984       <td><a href="http://www.w3.org/TR/CSS2/tables.html#table-border-styles">&lt;border-style&gt;</a> 
   986 <!--http://www.w3.org/TR/CSS21/box.html#value-def-border-style-->
   988     <tr>
   989       <td><em>Initial:</em>
   990       <td>none
   991     <tr>
   992       <td><em>Applies to:</em>
   993       <td>multicol elements
   994     <tr>
   995       <td><em>Inherited:</em>
   996       <td>no
   997     <tr>
   998       <td><em>Percentages:</em>
   999       <td>N/A
  1000     <tr>
  1001       <td><em>Media:</em>
  1002       <td>visual
  1003     <tr>
  1004       <td><em>Computed&nbsp;value:</em>
  1005       <td>specified value
  1006     <tr>
  1007       <td><em>Animatable:</em>
  1008       <td>no
  1009 </table>
  1011 <p>The 'column-rule-style' property sets the style of the rule between columns of an element. The &lt;border-style&gt; values are defined in [[!CSS21]] and the values are interpreted as in the <a href="http://www.w3.org/TR/CSS2/tables.html#collapsing-borders">the collapsing border model</a>.
  1013 <p>The 'none' value forces the computed value of <span class="property">'column-rule-width'</span> to be '0'.
  1016 <h3 id='crw'>'column-rule-width'</h3>
  1018 <table class=propdef>
  1019     <tr>
  1020       <td><em>Name:</em>
  1021       <td><dfn>column-rule-width</dfn>
  1022     <tr>
  1023       <td><em>Value:</em>
  1024       <td><a href="http://www.w3.org/TR/CSS21/box.html#value-def-border-width">&lt;border-width&gt;</a>
  1025     <tr>
  1026       <td><em>Initial:</em>
  1027       <td>medium
  1028     <tr>
  1029       <td><em>Applies to:</em>
  1030       <td>multicol elements
  1031     <tr>
  1032       <td><em>Inherited:</em>
  1033       <td>no
  1034     <tr>
  1035       <td><em>Percentages:</em>
  1036       <td>N/A
  1037     <tr>
  1038       <td><em>Media:</em>
  1039       <td>visual
  1040     <tr>
  1041       <td><em>Computed&nbsp;value:</em>
  1042       <td>absolute length; '0' if the column rule style is 'none' or 'hidden'
  1043     <tr>
  1044       <td><em>Animatable:</em>
  1045       <td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-length">length</a>
  1046 </table>
  1048 <p>This property sets the width of the rule between columns. Negative values are not allowed.
  1051 <h3>'column-rule'</h3>
  1053 <table class=propdef>
  1054     <tr>
  1055       <td><em>Name:</em>
  1056       <td><dfn>column-rule</dfn>
  1057     <tr>
  1058       <td><em>Value:</em>
  1059       <td><a href='#crw'>&lt;'column-rule-width'&gt;</a> || <a href='#crs'>&lt;'column-rule-style'&gt;</a> || [ <a href='#crc'>&lt;'column-rule-color'&gt;</a> | transparent ]  
  1060     <tr>
  1061       <td><em>Initial:</em>
  1062       <td>see individual properties
  1063     <tr>
  1064       <td><em>Applies to:</em>
  1065       <td>multicol elements
  1066     <tr>
  1067       <td><em>Inherited:</em>
  1068       <td>no
  1069     <tr>
  1070       <td><em>Percentages:</em>
  1071       <td>N/A
  1072     <tr>
  1073       <td><em>Media:</em>
  1074       <td>visual
  1075     <tr>
  1076       <td><em>Computed&nbsp;value:</em>
  1077       <td>see individual properties
  1078     <tr>
  1079       <td><em>Animatable:</em>
  1080       <td>see individual properties
  1081 </table>
  1083 <p>This property is a shorthand for setting
  1084 'column-rule-width', 'column-rule-style', and 'column-rule-color' at
  1085 the same place in the style sheet. Omitted values are set to their
  1086 initial values.
  1088 <div class=example>
  1090 <p>In this example, the column rule and the column gap have the same
  1091 width. Therefore, they will occupy exactly the same space.
  1093 <pre>
  1094 body { 
  1095   column-gap: 1em;
  1096   column-rule-width: 1em;
  1097   column-rule-style: solid;
  1098   column-rule-color: black;
  1100 </pre>
  1101 </div>
  1104 <div class=example>
  1105 <p>If a tall image is moved to a column on the next page to find room
  1106 for it, its natural column may be left empty. If so, the column is is
  1107 still considered to have content for the purpose of deciding if the
  1108 column rule should be drawn.
  1109 </div>
  1113 <h2>Column breaks</h2>
  1115 <p>When content is laid out in multiple columns, the user agent must
  1116 determine where column breaks are placed. The problem of breaking
  1117 content into columns is similar to breaking content into pages, which
  1118 is described in CSS 2.1, section 13.3.3 [[!CSS21]].
  1120 <p>Three new properties are introduced to allow column breaks to be
  1121 described in the same properties as page breaks: 'break-before',
  1122 'break-after', and 'break-inside'. These properties take the same
  1123 values as 'page-break-before', 'page-break-after', and
  1124 'page-break-inside'  [[!CSS21]]. In addition, some new keyword values
  1125 are added.
  1128 <h3>'break-before', 'break-after', 'break-inside'</h3>
  1130 <table class=propdef>
  1131     <tr>
  1132       <td><em>Name:</em>
  1133       <td><dfn>break-before</dfn>
  1134     <tr>
  1135       <td><em>Value:</em>
  1136       <td>auto | always | avoid | left | right | page | column | avoid-page | avoid-column
  1137     <tr>
  1138       <td><em>Initial:</em>
  1139       <td>auto
  1140     <tr>
  1141       <td><em>Applies to:</em>
  1142       <td>block-level elements
  1143     <tr>
  1144       <td><em>Inherited:</em>
  1145       <td>no
  1146     <tr>
  1147       <td><em>Percentages:</em>
  1148       <td>N/A
  1149     <tr>
  1150       <td><em>Media:</em>
  1151       <td>paged
  1152     <tr>
  1153       <td><em>Computed&nbsp;value:</em>
  1154       <td>specified value
  1155     <tr>
  1156       <td><em>Animatable:</em>
  1157       <td>no
  1158 </table>
  1160 <table class=propdef>
  1161     <tr>
  1162       <td><em>Name:</em>
  1163       <td><dfn>break-after</dfn>
  1164     <tr>
  1165       <td><em>Value:</em>
  1166       <td>auto | always | avoid | left | right | page | column | avoid-page | avoid-column
  1167     <tr>
  1168       <td><em>Initial:</em>
  1169       <td>auto
  1170     <tr>
  1171       <td><em>Applies to:</em>
  1172       <td>block-level elements
  1173     <tr>
  1174       <td><em>Inherited:</em>
  1175       <td>no
  1176     <tr>
  1177       <td><em>Percentages:</em>
  1178       <td>N/A
  1179     <tr>
  1180       <td><em>Media:</em>
  1181       <td>paged
  1182     <tr>
  1183       <td><em>Computed&nbsp;value:</em>
  1184       <td>specified value
  1185     <tr>
  1186       <td><em>Animatable:</em>
  1187       <td>no
  1188 </table>
  1192 <table class=propdef>
  1193     <tr>
  1194       <td><em>Name:</em>
  1195       <td><dfn>break-inside</dfn>
  1196     <tr>
  1197       <td><em>Value:</em>
  1198       <td>auto | avoid | avoid-page | avoid-column
  1199     <tr>
  1200       <td><em>Initial:</em>
  1201       <td>auto
  1202     <tr>
  1203       <td><em>Applies to:</em>
  1204       <td>block-level elements
  1205     <tr>
  1206       <td><em>Inherited:</em>
  1207       <td>no
  1208     <tr>
  1209       <td><em>Percentages:</em>
  1210       <td>N/A
  1211     <tr>
  1212       <td><em>Media:</em>
  1213       <td>paged
  1214     <tr>
  1215       <td><em>Computed&nbsp;value:</em>
  1216       <td>specified value
  1217     <tr>
  1218       <td><em>Animatable:</em>
  1219       <td>no
  1220 </table>
  1223 <p>These properties describe page/column break behavior before/after/inside the generated box. These values are normatively defined in [[!CSS21]]:
  1225 <dl>
  1226 <dt>auto
  1227 <dd>Neither force nor forbid a page/column break before (after, inside) the generated box. 
  1228 <dt>always
  1229 <dd>Always force a page break before (after) the generated box.
  1230 <dt>avoid
  1231 <dd>Avoid a page/column break before (after, inside) the generated box. 
  1232 <dt>left
  1233 <dd>Force one or two page breaks before (after) the generated box so that the next page is formatted as a left page.
  1234 <dt>right
  1235 <dd>Force one or two page breaks before (after) the generated box so that the next page is formatted as a right page.
  1236 </dl>
  1238 <p>This specification adds the following new values:
  1240 <dl>
  1241 <dt>page
  1242   <dd>Always force a page break before (after) the generated box.
  1243 <dt>column
  1244   <dd>Always force a column break before (after) the generated box.
  1245 <dt>avoid-page
  1246   <dd>Avoid a page break before (after, inside) the generated box.
  1247 <dt>avoid-column
  1248   <dd>Avoid a column break before (after, inside) the generated box. 
  1249 </dl>
  1251 <p>When a page or column break splits a box, the box's margins,
  1252 borders, and padding have no visual effect where the split occurs.
  1253 However, the margin immediately after a forced page/column break will
  1254 be preserved. A forced page/column break is a break that does not occur
  1255 naturally.
  1257 <p class=note>In the future, new properties may describe alternate
  1258 ways to handle margins, borders and padding around page/column breaks.
  1260 <div class="example">
  1262 <p>In this example, forced column breaks appear before <code>h2</code>
  1263 elements and after <code>img</code> elements:
  1265 <pre>
  1266 .multicol { column-width: 8em }
  1267 .multicol h2 { break-before: column; margin-top: 2em }
  1268 .multicol img { break-after: column }
  1269 </pre>
  1271 <p>The top margin of <code>h2</code> elements will be preserved since the column break is forced.
  1273 </div>
  1275 <div class="example">
  1277 <p>In this example, the formatter will try avoid column breaks inside <code>p</code> elements:
  1279 <pre>
  1280 p { break-inside: avoid-column }
  1281 </pre>
  1282 </div>
  1286 <h2>Spanning columns</h2>
  1288 <p>The 'column-span' property makes it possible for an element to span
  1289 across several columns.
  1292 <h3>'column-span'</h3>
  1294 <table class=propdef>
  1295     <tr>
  1296       <td><em>Name:</em>
  1297       <td><dfn>column-span</dfn>
  1298     <tr>
  1299       <td><em>Value:</em>
  1300       <td>none | all 
  1301     <tr>
  1302       <td><em>Initial:</em>
  1303       <td>none
  1304     <tr>
  1305       <td><em>Applies to:</em>
  1306       <td>in-flow block-level elements
  1307     <tr>
  1308       <td><em>Inherited:</em>
  1309       <td>no
  1310     <tr>
  1311       <td><em>Percentages:</em>
  1312       <td>N/A
  1313     <tr>
  1314       <td><em>Media:</em>
  1315       <td>visual
  1316     <tr>
  1317       <td><em>Computed&nbsp;value:</em>
  1318       <td>specified value
  1319     <tr>
  1320       <td><em>Animatable:</em>
  1321       <td>no
  1322 </table>
  1324 <p>This property describes how many columns an element spans across. Values are:
  1326 <dl>
  1328 <dt>none
  1330 <dd>The element does not span multiple columns.
  1332 <dt>all
  1334 <dd>The element spans across all columns of the nearest multicol
  1335 ancestor in the same block formatting context. The element spans
  1336 across all columns. Content in the normal flow that appears before the
  1337 element is automatically balanced across all columns before the
  1338 element appears. The element establishes a new block formatting
  1339 context.
  1341 </dl>
  1343 <p>An element that spans more than one column is called a
  1344 <dfn>spanning element</dfn> and the box it creates is called a <dfn>spanner</dfn>.
  1346 <!--
  1347 <p>This property has no effect on elements that do not fit entirely
  1348 within the multicol element. Also, if a setting on this property pushes the
  1349 element outside a multicol element, this property will have no effect.
  1350 -->
  1352 <div class="example">
  1354 <p>In this example, an <code>h2</code> element has been added to the
  1355 sample document after the sixth sentence (i.e., after the word "jkl."). This styling applies:
  1357 <pre class="css">
  1358 h2 { column-span: all; background: silver } 
  1359 img { display: none }
  1360 </pre>
  1362 <p>By setting 'column-span' to ''all'', all content that appear before
  1363 the <code>h2</code> element is shown before the <code>h2</code>
  1364 element.
  1366 <div class=cols>
  1368 <p>Ab cde fgh i jkl. Mno<br> 
  1369 pqr stu vw xyz. A bc<br>
  1371 <br><br>
  1373 M nop qrst uv wx yz.<br>
  1374 Ab cde fgh i jkl. Mno<br> 
  1375 pqr stu vw xyz. A bc<br>
  1376 def g hij klm nopqrs<br>
  1377 tuv wxy z. Abc de fg<br>
  1378 hi jklmno. Pqrstu vw<br>
  1382 <div class="col" style="left: 175px">
  1383 <p>def g hij klm nopqrs<br> 
  1384 tuv wxy z. Abc de fg<br>
  1385 <br><br>
  1386 x yz. Abc def ghi jkl.<br>
  1387 M nop qrst uv wx yz.<br>
  1388 Ab cde fgh i jkl. Mno<br> 
  1389 pqr stu vw xyz. A bc<br>
  1390 def g hij klm nopqrs<br>
  1391 tuv wxy z. Abc de fg<br>
  1394 </div>
  1396 <div class="col" style="left: 350px">
  1397 <p>
  1398 hi jklmno. Pqrstu vw<br>
  1399 x yz. Abc def ghi jkl.<br>
  1400 <br><br>
  1401 hi jklmno. Pqrstu vw<br>
  1402 x yz. Abc def ghi jkl.<br>
  1403 M nop qrst uv wx yz.<br>
  1404 Ab cde fgh i jkl. Mno<br> 
  1405 pqr stu vw xyz.
  1407 </div>
  1410 <div class=rep style="width: 490px; height: 20px; background: silver; font-size: 1.5em; padding: 5px">An H2 element</div>
  1411 <div class=gap style="left: 150px"></div>
  1412 <div class=gap style="left: 325px"></div>
  1413 </div>
  1414 </div>
  1417 <p>A spanning element takes up more space than the element would take
  1418 up otherwise. When space is limited, it may be impossible to find room
  1419 for the spanning element. In these cases, user agents may treat the
  1420 element as if 'none' had been specified on this property.
  1422 <div class="example">
  1424 <p>In this example, the
  1425 H2 element appears later in the content, and the height of the
  1426 multicol element is constrained. Therefore, the H2 element appears in
  1427 the overflow and there is not room to make the element spanning.
  1428 As a result, the element appears as if 'column-span: none' was
  1429 specified.
  1431 <div class=cols style="height: 100px">
  1433 <div class="col" style="">
  1434 <p>
  1435 Ab cde fgh i jkl. Mno<br> 
  1436 pqr stu vw xyz. A bc<br>
  1437 def g hij klm nopqrs<br> 
  1438 tuv wxy z. Abc de fg<br>
  1439 hi jklmno. Pqrstu vw<br>
  1440 </div>
  1442 <div class="col" style="left: 175px">
  1443 <p>
  1444 x yz. Abc def ghi jkl.<br>
  1445 M nop qrst uv wx yz.<br>
  1446 Ab cde fgh i jkl. Mno<br> 
  1447 pqr stu vw xyz. A bc<br>
  1448 def g hij klm nopqrs
  1449 </div>
  1451 <div class="col" style="left: 350px">
  1452 <p>
  1453 tuv wxy z. Abc de fg<br>
  1454 hi jklmno. Pqrstu vw<br>
  1455 x yz. Abc def ghi jkl.<br>
  1456 M nop qrst uv wx yz.<br>
  1457 Ab cde fgh i jkl. Mno<br> 
  1458 </div>
  1460 <div class="col" style="left: 525px">
  1461 <p>pqr stu vw xyz. 
  1462 <div class=rep style="width: 140px; height: 40px; background: silver; font-size: 1.5em; padding: 5px; margin: 0; position: static">An H2 element</div>
  1463 A bc def g hij klm
  1464 </div>
  1467 <div class="col" style="left: 700px">
  1468 nopqrs tuv wxy z.
  1469 </div>
  1472 <div class=gap style="left: 150px"></div>
  1473 <div class=gap style="left: 325px"></div>
  1474 <div class=gap style="left: 500px"></div>
  1475 <div class=gap style="left: 675px"></div>
  1477 </div>
  1479 </div>
  1484 <div class="example">
  1486 <p>This example is similar to the previous example, except that the H2 element appears naturally in the last column. Still, there is not enough room to make the element spanning. 
  1488 <div class=cols style="height: 100px">
  1490 <div class="col" style="">
  1491 <p>
  1492 Ab cde fgh i jkl. Mno<br> 
  1493 pqr stu vw xyz. A bc<br>
  1494 def g hij klm nopqrs<br> 
  1495 tuv wxy z. Abc de fg<br>
  1496 hi jklmno. Pqrstu vw<br>
  1497 </div>
  1499 <div class="col" style="left: 175px">
  1500 <p>
  1501 x yz. Abc def ghi jkl.<br>
  1502 M nop qrst uv wx yz.<br>
  1503 Ab cde fgh i jkl. Mno<br> 
  1504 pqr stu vw xyz. A bc<br>
  1505 def g hij klm nopqrs
  1506 </div>
  1508 <div class="col" style="left: 350px">
  1509 <p>
  1510 tuv wxy z. Abc de fg<br>
  1511 hi jklmno. 
  1512 <div class=rep style="width: 140px; height: 40px; background: silver; font-size: 1.5em; padding: 5px; margin: 0; position: static">An H2 element</div>
  1513 </div>
  1515 <div class="col" style="left: 525px">
  1516 <p>A bc def g hij klm<br>
  1517 nop w rstu vw xyz.
  1518 </div>
  1521 <div class=gap style="left: 150px"></div>
  1522 <div class=gap style="left: 325px"></div>
  1523 <div class=gap style="left: 500px"></div>
  1525 </div>
  1527 </div>
  1530 <div class="example">
  1532 <p>In paged media spanning elements are honored on all pages. In this example, the first three paragraphs have column breaks after them. An spanning <code>H2</code> element appears after the fourth paragraph. This would appear on the first page:
  1534 <div class=cols style="height: 80px; border-bottom: none">
  1536 <div class="col" style="">
  1538 <p>
  1539 Ab cde fgh i jkl. Mno<br> 
  1540 pqr stu vw xyz. 
  1541 </div>
  1543 <div class="col" style="left: 175px">
  1544 <p>
  1545 Ab cde fgh i jkl. Mno<br> 
  1546 pqr stu vw xyz. A bc<br>
  1547 def g hij klm nopqrs<br>
  1548 tuv wxy z.
  1549 </div>
  1551 <div class="col" style="left: 350px">
  1552 <p>
  1553 Ab cde fgh i jkl mno.<br> 
  1554 Pq rstu vwxyz.
  1555 </div>
  1558 <div class=gap style="left: 150px"></div>
  1559 <div class=gap style="left: 325px"></div>
  1560 </div>
  1562 <p>This would appear on the second page:
  1564 <div class=cols style="height: 200px; border-top: none">
  1567 <p>Ab cde fgh i jkl. Mno<br> 
  1568 pqr stu vw xyz. A bc<br>
  1570 <br><br>
  1572 M nop qrst uv wx yz.<br>
  1573 Ab cde fgh i jkl. Mno<br> 
  1574 pqr stu vw xyz. A bc<br>
  1575 def g hij klm nopqrs<br>
  1576 tuv wxy z. Abc de fg<br>
  1577 hi jklmno. Pqrstu vw<br>
  1581 <div class="col" style="left: 175px">
  1582 <p>def g hij klm nopqrs<br> 
  1583 tuv wxy z. Abc de fg<br>
  1584 <br><br>
  1585 x yz. Abc def ghi jkl.<br>
  1586 M nop qrst uv wx yz.<br>
  1587 Ab cde fgh i jkl. Mno<br> 
  1588 pqr stu vw xyz. A bc<br>
  1589 def g hij klm nopqrs<br>
  1590 tuv wxy z. Abc de fg<br>
  1593 </div>
  1595 <div class="col" style="left: 350px">
  1596 <p>
  1597 hi jklmno. Pqrstu vw<br>
  1598 x yz. Abc def ghi jkl.<br>
  1599 <br><br>
  1600 hi jklmno. Pqrstu vw<br>
  1601 x yz. Abc def ghi jkl.<br>
  1602 M nop qrst uv wx yz.<br>
  1603 Ab cde fgh i jkl. Mno<br> 
  1604 pqr stu vw xyz.
  1606 </div>
  1609 <div class=rep style="width: 490px; height: 20px; background: silver; font-size: 1.5em; padding: 5px">An H2 element</div>
  1610 <div class=gap style="left: 150px"></div>
  1611 <div class=gap style="left: 325px"></div>
  1612 </div>
  1613 </div>
  1618 <h2>Filling columns</h2>
  1620 <p>There are two strategies for filling columns: columns can either be
  1621 balanced, or not. If columns are balanced, user agents should try to
  1622 fill all columns in a row so that the columns appear to have the same
  1623 amount of content, while also trying to minimize the overflow content.
  1624 If columns are not balanced, they are filled sequentially; some
  1625 columns may end up partially filled, or with no content at all. In any
  1626 case, user agents must honor forced page breaks and should try to
  1627 honor 'widows', 'orphans' and other properties that may affect column
  1628 lengths.
  1630 <h3 id='cf'>'column-fill'</h3>
  1632 <table class=propdef>
  1633     <tr>
  1634       <td><em>Name:</em>
  1635       <td><dfn>column-fill</dfn>
  1636     <tr>
  1637       <td><em>Value:</em>
  1638       <td>auto | balance
  1639     <tr>
  1640       <td><em>Initial:</em>
  1641       <td>balance
  1642     <tr>
  1643       <td><em>Applies to:</em>
  1644       <td>multicol elements
  1645     <tr>
  1646       <td><em>Inherited:</em>
  1647       <td>no
  1648     <tr>
  1649       <td><em>Percentages:</em>
  1650       <td>N/A
  1651     <tr>
  1652       <td><em>Media:</em>
  1653       <td>see below
  1654     <tr>
  1655       <td><em>Computed&nbsp;value:</em>
  1656       <td>specified value
  1657     <tr>
  1658       <td><em>Animatable:</em>
  1659       <td>no
  1660 </table>
  1662 <p>The values are:
  1664 <dl>
  1665 <dt>balance
  1666 <dd>Balance content equally between columns, if possible.
  1667 <dt>auto
  1668 <dd>Fills columns sequentially.
  1669 </dl>
  1671 <!--
  1672 <p>In continuous media, this property will only be consulted if the
  1673 length of columns has been constrained. Otherwise, columns will
  1674 automatically be balanced. 
  1675 -->
  1677 <p>In continuous media, this property does not have any effect in
  1678 overflow columns (see below).
  1680 <!--
  1681 <p>In paged media, this property will only have
  1682 effect on the last page the multicol element appears on.
  1683 -->
  1685 <h2>Overflow</h2>
  1687 <h3>Overflow inside multicol elements</h3>
  1689 <p>Content in the normal flow that extends into column gaps (e.g.,
  1690 long words or images) is clipped in the middle of the column gap.
  1692 <div class=example>
  1694 <p>In this example, the black image is wider than the column, and is
  1695 therefore clipped. 
  1697 <div class=cols>
  1698 <p>Lorem ipsum dolor<br>sit amet. Nam at jus.
  1699 <br><br><br><br><br><br><br>
  1700 Sed imp er di et ris.<br>Cur abi tur et sapen.
  1702 <div style="position: absolute; left: 175px; top: 0; z-index: 6;">
  1703 <p>Lorem ipsum dolor<br>sit amet. Nam at jus.<br>
  1704 Sed imp er di et ris.<br>Cur abi tur et sapen.<br>
  1705 Vivamus a metus.<br> Aenean at risus<br> pharetra ante 
  1706 luctu<br> feugiat quis enim.<br> Cum sociis natoque<br> 
  1707 penatibus et magni.</div>
  1709 <div style="position: absolute; left: 350px; top: 0; z-index: 6;">
  1710 <p>Lorem ipsum dolor<br>sit amet. Nam at jus.<br>
  1711 Sed imp er di et ris.<br>Cur abi tur et sapen.<br>
  1712 Vivamus a metus.<br> Aenean at risus<br> pharetra ante 
  1713 luctu<br> feugiat quis enim.<br> Cum sociis natoque<br> 
  1714 penatibus et magni.</div>
  1716 <div class=rep style="width: 163px"></div>
  1717 <div class=gap style="left: 150px"></div>
  1718 <div class=gap style="left: 325px"></div>
  1719 </div>
  1721 </div>
  1724 <h3>Pagination and overflow outside multicol elements</h3>
  1726 <p>Content and column rules that extend outside column boxes at
  1727 the edges of the multi-column element are clipped according to the
  1728 'overflow' property.
  1730 <p>A multicol element can have more columns than it has room for due to:
  1732 <ul>
  1734 <li>a declaration that constrains the column height (e.g., using
  1735      'height' or 'max-height'). In this case, additional column boxes
  1736      are created in the inline direction
  1738 <li>the size of the page. In this case, additional column boxes are
  1739      moved to the next page(s).
  1741 <li>explicit column breaks. In this case, additional column boxes are
  1742      created in the inline direction for continuous media, and
  1743      additional column boxes are moved to the next page(s) for paged
  1744      media. 
  1746 </ul>
  1748 <p>Columns that appear outside the multicol element in continuous media
  1749 are called <dfn>overflow columns</dfn>.
  1751 <div class="example">
  1753 <p>In this example, the height of the multi-column element has been
  1754 constrained to a maximum height. Also, the style sheet specifies that
  1755 overflowing content should be visible:
  1757 <pre class=css>
  1758 div { 
  1759   max-height: 5em;
  1760   overflow: visible;
  1762 </pre>
  1764 <p>As a result, the number of columns is increased. 
  1766 <div class=cols style="height: 100px">
  1768 <div class="col" style="">
  1770 <p>
  1771 Ab cde fgh i jkl. Mno<br> 
  1772 pqr stu vw xyz. A bc<br>
  1773 def g hij klm nopqrs<br> 
  1774 tuv wxy z. Abc de fg<br>
  1775 hi jklmno. Pqrstu vw<br>
  1776 </div>
  1778 <div class="col" style="left: 175px">
  1779 <p>
  1780 x yz. Abc def ghi jkl.<br>
  1781 M nop qrst uv wx yz.<br>
  1782 Ab cde fgh i jkl. Mno<br> 
  1783 pqr stu vw xyz. A bc<br>
  1784 def g hij klm nopqrs
  1785 </div>
  1787 <div class="col" style="left: 350px">
  1788 <p>
  1789 tuv wxy z. Abc de fg<br>
  1790 hi jklmno. Pqrstu vw<br>
  1791 x yz. Abc def ghi jkl.<br>
  1792 M nop qrst uv wx yz.<br>
  1793 Ab cde fgh i jkl. Mno<br> 
  1794 </div>
  1796 <div class="col" style="left: 525px">
  1797 <p>
  1798 pqr stu vw xyz. A bc<br>
  1799 def g hij klm nopqrs<br>
  1800 tuv wxy z. Abc de fg<br>
  1801 hi jklmno. Pqrstu vw<br>
  1802 x yz. Abc def ghi jkl.<br>
  1803 </div>
  1805 <div class=gap style="left: 150px"></div>
  1806 <div class=gap style="left: 325px"></div>
  1807 <div class=gap style="left: 500px"></div>
  1808 </div>
  1810 </div>
  1812 <div class="example">
  1814 <p>In paged media, the overflow content goes into column on subsequent pages. Given the same content as in the previous example and a page box that only has room for five lines of formatted text, this would appear on the first page:
  1816 <div class=cols style="height: 100px; border-bottom: none">
  1818 <div class="col" style="">
  1820 <p>
  1821 Ab cde fgh i jkl. Mno<br> 
  1822 pqr stu vw xyz. A bc<br>
  1823 def g hij klm nopqrs<br> 
  1824 tuv wxy z. Abc de fg<br>
  1825 hi jklmno. Pqrstu vw<br>
  1826 </div>
  1828 <div class="col" style="left: 175px">
  1829 <p>
  1830 x yz. Abc def ghi jkl.<br>
  1831 M nop qrst uv wx yz.<br>
  1832 Ab cde fgh i jkl. Mno<br> 
  1833 pqr stu vw xyz. A bc<br>
  1834 def g hij klm nopqrs
  1835 </div>
  1837 <div class="col" style="left: 350px">
  1838 <p>
  1839 tuv wxy z. Abc de fg<br>
  1840 hi jklmno. Pqrstu vw<br>
  1841 x yz. Abc def ghi jkl.<br>
  1842 M nop qrst uv wx yz.<br>
  1843 Ab cde fgh i jkl. Mno<br> 
  1844 </div>
  1847 <div class=gap style="left: 150px"></div>
  1848 <div class=gap style="left: 325px"></div>
  1849 </div>
  1851 <p>Assuming column balancing, this would appear on the second page:
  1853 <div class=cols style="height: 45px; border-top: none">
  1855 <div class="col" style="">
  1857 <p>
  1858 pqr stu vw xyz. A bc<br>
  1859 def g hij klm nopqrs<br>
  1860 </div>
  1862 <div class="col" style="left: 175px">
  1863 <p>
  1864 tuv wxy z. Abc de fg<br>
  1865 hi jklmno. Pqrstu vw<br>
  1866 </div>
  1868 <div class="col" style="left: 350px">
  1869 <p>
  1870 x yz. Abc def ghi jkl.<br>
  1871 </div>
  1874 <div class=gap style="left: 150px"></div>
  1875 <div class=gap style="left: 325px"></div>
  1876 </div>
  1879 </div>
  1882 <div class="example">
  1884 <p>In this example, explicit column breaks are generated after paragraphs:
  1886 <pre class=css>
  1887 p { 
  1888   break-after: column;
  1890 </pre>
  1892 <p>As a result, the number of columns increases and the extra columns
  1893 are added in the inline direction:
  1895 <div class=cols style="height: 100px">
  1897 <div class="col" style="">
  1899 <p>
  1900 Ab cde fgh i jkl. Mno<br> 
  1901 pqr stu vw xyz. 
  1902 </div>
  1904 <div class="col" style="left: 175px">
  1905 <p>
  1906 Ab cde fgh i jkl. Mno<br> 
  1907 pqr stu vw xyz. A bc<br>
  1908 def g hij klm nopqrs<br>
  1909 tuv wxyz. Abc defghi<br>
  1910 jklmno pqrstu vwxyz.
  1911 </div>
  1913 <div class="col" style="left: 350px">
  1914 <p>
  1915 Ab cde fgh i jkl mno.<br> 
  1916 </div>
  1918 <div class="col" style="left: 525px">
  1919 <p>
  1920 Pqr stu vw xyz. A bc<br>
  1921 def g hij klm nopqrs<br>
  1922 tuv wxy z.
  1923 </div>
  1925 <div class=gap style="left: 150px"></div>
  1926 <div class=gap style="left: 325px"></div>
  1927 <div class=gap style="left: 500px"></div>
  1928 </div>
  1930 </div>
  1933 <div class="example">
  1935 <p>In paged media, extra columns are shown on the next page. Given the
  1936 same code as the previous example, the last paragraph appears on the second page. This would appear on the first page:
  1938 <div class=cols style="height: 100px; border-bottom: none">
  1940 <div class="col" style="">
  1942 <p>
  1943 Ab cde fgh i jkl. Mno<br> 
  1944 pqr stu vw xyz. 
  1945 </div>
  1947 <div class="col" style="left: 175px">
  1948 <p>
  1949 Ab cde fgh i jkl. Mno<br> 
  1950 pqr stu vw xyz. A bc<br>
  1951 def g hij klm nopqrs<br>
  1952 tuv wxyz. Abc defghi<br>
  1953 jklmno pqrstu vwxyz.
  1954 </div>
  1956 <div class="col" style="left: 350px">
  1957 <p>
  1958 Ab cde fgh i jkl mno.<br> 
  1959 </div>
  1962 <div class=gap style="left: 150px"></div>
  1963 <div class=gap style="left: 325px"></div>
  1964 </div>
  1966 <p>This would appear on the second page:
  1968 <div class=cols style="height: 23px; border-top: none">
  1970 <div class="col" style="">
  1971 <p>
  1972 Pqr stu vw xyz. A bc
  1973 </div>
  1975 <div class="col" style="left: 175px">
  1976 <p>
  1977 def g hij klm nopqrs
  1978 </div>
  1980 <div class="col" style="left: 350px">
  1981 <p>
  1982 tuv wxy z.
  1983 </div>
  1986 <div class=gap style="left: 150px"></div>
  1987 <div class=gap style="left: 325px"></div>
  1988 </div>
  1990 Due to column balancing, the last paragraph is split across three columns.
  1992 </div>
  2000 <h2>Conformance</h2>
  2002 <p>Conforming UAs must flow the content of an element into several
  2003 columns according to this specification.
  2005 <p>The conformance requirements are expressed with a combination of
  2006     descriptive assertions and RFC 2119 terminology. The key words "MUST",
  2007     "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
  2008     "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this
  2009     document are to be interpreted as described in RFC 2119.
  2010     However, for readability, these words do not appear in all uppercase
  2011     letters in this specification. All of the text of this specification is
  2012     normative except sections explicitly marked as non-normative, examples,
  2013     and notes. [[!RFC2119]]</p>
  2016 <h3 id=cr-exit-criteria>CR exit criteria</h3>
  2018 <p>As described in the W3C process document, a <a
  2019 href="http://www.w3.org/2005/10/Process-20051014/tr.html#cfi">Candidate
  2020 Recommendation</a> (CR) is a specification that W3C recommends for use
  2021 on the Web. The next stage is <em>Recommendation</em>, when the
  2022 specification is sufficiently implemented.
  2024 <p>For this specification to be proposed as a W3C Recommendation, the
  2025 following conditions shall be met. There must be at least two
  2026 independent, interoperable implementations of each feature. Each
  2027 feature may be implemented by a different set of products, there is no
  2028 requirement that all features be implemented by a single product. For
  2029 the purposes of this criterion, we define the following terms:
  2031 <dl>
  2032   <dt>independent <dd>each implementation must be developed by a
  2033   different party and cannot share, reuse, or derive from code
  2034   used by another qualifying implementation. Sections of code that
  2035   have no bearing on the implementation of this specification are
  2036   exempt from this requirement.
  2038   <dt>interoperable <dd>passing the respective test case(s) in the
  2039   official CSS test suite, or, if the implementation is not a Web
  2040   browser, an equivalent test. Every relevant test in the test
  2041   suite should have an equivalent test created if such a user
  2042   agent (UA) is to be used to claim interoperability. In addition
  2043   if such a UA is to be used to claim interoperability, then there
  2044   must one or more additional UAs which can also pass those
  2045   equivalent tests in the same way for the purpose of
  2046   interoperability. The equivalent tests must be made publicly
  2047   available for the purposes of peer review.
  2049   <dt>implementation <dd>a user agent which:
  2051   <ol class="inline">
  2052     <li>implements the specification.
  2054     <li>is available to the general public. The implementation may
  2055     be a shipping product or other publicly available version
  2056     (i.e., beta version, preview release, or <em>nightly build</em>). 
  2057     Non-shipping product releases must have implemented the
  2058     feature(s) for a period of at least one month in order to
  2059     demonstrate stability.
  2061     <li>is not experimental (i.e., a version specifically designed
  2062     to pass the test suite and is not intended for normal usage
  2063     going forward).
  2064   </ol>
  2065 </dl>
  2067 <p>A minimum of sixth months of the CR period must have elapsed. This
  2068 is to ensure that enough time is given for any remaining major errors
  2069 to be caught.
  2071 <p>Features will be dropped if two or more interoperable
  2072 implementations are not found by the end of the CR period.
  2074 <p>Features may/will also be dropped if adequate/sufficient (by
  2075 judgment of CSS WG) tests have not been produced for those feature(s)
  2076 by the end of the CR period.
  2081 <h2 class=no-num id=acknowledgments>Acknowledgments</h2>
  2083 <p>This document is based on several older proposals and comments on
  2084 older proposals. Contributors include 
  2086 Øyvind Stenhaug, 
  2087 Sylvain Galineau, 
  2088 Giovanni Campagna, 
  2089 David Hyatt, 
  2090 David Singer, 
  2091 David Woolley, 
  2092 Elika Etemad,
  2093 Bj&ouml;rn H&ouml;hrmann, 
  2094 Joost de Valk, 
  2095 Peter-Paul Koch, 
  2096 Shelby Moore, 
  2097 Till Halbach, 
  2098 C&eacute;dric Savarese, 
  2099 Andy Clarke, 
  2100 Robert O'Callahan,
  2101 Markus Mielke, 
  2102 Alex Mogilevsky, 
  2103 Sergey Genkin, 
  2104 Michael Day, 
  2105 Melinda Grant, 
  2106 Kevin Lawver, 
  2107 Anton Prowse,
  2108 L. David Baron, 
  2109 Bert Bos, 
  2110 Dave Raggett, 
  2111 Chris Wilson, 
  2112 Robert Stevahn, 
  2113 Peter Linss, 
  2114 Chris Lilley, 
  2115 Steve Zilles,
  2116 Tantek &Ccedil;elik, 
  2117 Daniel Glazman and 
  2118 Ian Hickson.</p>
  2121 <h2 class=no-num id=references>References</h2>
  2124 <h3 class="no-num" id="normative-references">Normative references</h3>
  2125 <!--begin-normative-->
  2127 <p>[Here will be inserted the file "normative.inc"]</p>
  2128 <!--end-normative-->
  2130 <h3 class="no-num" id="other-references">Other references</h3>
  2131 <!--begin-informative-->
  2134 <p>[Here will be inserted the file "informative.inc"]</p>
  2135 <!--end-informative-->
  2138 <h2 class="no-num" id="index">Index</h2>
  2139 <!--index-->
  2142 <h2 class="no-num" id="property-index">Property index</h2>
  2143 <!-- properties -->
  2144 </body>
  2145 </html>
  2146 <!-- Keep this comment at the end of the file
  2147 Local variables:
  2148 mode: sgml
  2149 sgml-declaration:"~/SGML/HTML4.decl"
  2150 sgml-default-doctype-name:"html"
  2151 sgml-minimize-attributes:t
  2152 sgml-nofill-elements:("pre" "style" "br")
  2153 sgml-live-element-indicator:t
  2154 sgml-omittag:nil
  2155 sgml-shorttag:nil
  2156 sgml-namecase-general:t
  2157 sgml-general-insert-case:lower
  2158 sgml-always-quote-attributes:t
  2159 sgml-indent-step:nil
  2160 sgml-indent-data:t
  2161 sgml-parent-document:nil
  2162 sgml-exposed-tags:nil
  2163 sgml-local-catalogs:nil
  2164 sgml-local-ecat-files:nil
  2165 End:
  2166 -->

mercurial