Specify how to fill columns:
.newspaper1 {
column-fill: auto;
}
.newspaper2 {
column-fill: balance;
}
Try it Yourself »
More "Try it Yourself" examples below.
The column-fill
property specifies how to fill columns, balanced or not.
Tip: If you add a height to a multi-column element, you can control how the content fills the columns. The content can be balanced or filled sequentially.
Default value: | balance |
---|---|
Inherited: | no |
Animatable: | no. Read about animatable |
Version: | CSS3 |
JavaScript syntax: | object.style.columnFill="auto" Try it |
The numbers in the table specify the first browser version that fully supports the property.
Numbers followed by -moz- specify the first version that worked with a prefix.
Property | |||||
---|---|---|---|---|---|
column-fill | 50.0 | 10.0 | 52.0 13.0 -moz- |
10.0 7.0 -webkit- |
37.0 |
column-fill: balance|auto|initial|inherit;
Value | Description | Demo |
---|---|---|
balance | Default value. Fills each column with about the same amount of content, but will not allow the columns to be taller than the height (so, columns might be shorter than the height as the browser distributes the content evenly horizontally) | Demo ❯ |
auto | Fills each column until it reaches the height, and do this until it runs out of content (so, this value will not necessarily fill all the columns nor fill them evenly) | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Divide the text in a <div> element into three columns:
div {
column-count: 3;
}
Try it Yourself »
Specify the width, style, and color of the rule between columns:
div {
column-rule: 4px double #ff00ff;
}
Try it Yourself »
CSS tutorial: CSS Multiple Columns
HTML DOM reference: columnFill property
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!