column-fill

CSS column-fill Property

The column-fill property defines whether the columns are filled balanced or not.

The column-fill property is one of the CSS3 properties.

If a height is added to a multi-column element, it will be possible to control how the columns are filled with content. The content can be balanced or filled sequentially. Thus, it has two values: balance and auto. “Balance” is the default value. Content is equally divided between columns. If columns are specified by the “auto” value, the content takes up the room it needs.

Firefox automatically balances the content in a height-constrained multi-column layout while other browsers always fill columns sequentially when given a height constraint.

类目类目
Initial Valuebalance
Applies toMulticol elements.
InheritedNo.
AnimatableNo.
VersionCSS3
DOM Syntaxobject.style.columnFill = “balance”;

Syntax

Syntax

column-fill: auto | balance | balance-all |  initial | inherit;

Example of the column-fill property with the “balance” value:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      .balance {
        column-count: 4;
        column-rule: 1px solid black;
        column-fill: balance;
      }
    </style>
  </head>
  <body>
    <h1>Column-fill property example</h1>
    <p class="balance">
      This is a bunch of text split into multiple columns. The CSS column-fill property is used to spread the contents evenly across all the columns.
    </p>
  </body>
</html>

Result

Example of the column-fill property with the “auto” value:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      .auto {
        column-count: 3;
        column-rule: 1px solid black;
        -webkit-column-fill: auto;
        -moz-column-fill: auto;
        column-fill: auto;
      }
    </style>
  </head>
  <body>
    <h1>Column-fill property example</h1>
    <p class="auto">
      This is a bunch of text split into multiple columns. The CSS column-fill property is used to spread the contents evenly across all the columns. This is a bunch of text split into multiple columns. The CSS column-fill property is used to spread the contents evenly across all the columns.
    </p>
  </body>
</html>

Values

Values

ValueDescription
autoSequentially fills the columns.
balanceEqually divides the content between columns. In paged media, only the last page is balanced.
balance-allEqually divides the content between columns. In paged media, all pages are balanced.
initialSets the property to its default value.
inheritInherits the property from its parent element.


请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部