CSS column-fill Property
Example
Specify how to fill columns:
.newspaper1 {
-moz-column-fill: auto; /* Firefox */
column-fill: auto;
}
.newspaper2 {
-moz-column-fill:
balance; /* Firefox */
column-fill: balance;
}
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
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 |
Browser Support
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 | 10 | 52.0 13.0 -moz- |
10.0 7.0 -webkit- |
37 |
CSS Syntax
column-fill: balance|auto|initial|inherit;
Property Values
Value | Description |
---|---|
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) |
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) |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
More Examples
Example
Divide the text in a <div> element into three columns:
div
{
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
}
Try it Yourself »
Example
Specify a 40 pixels gap between the columns:
div
{
-webkit-column-gap: 40px; /* Chrome, Safari, Opera */
-moz-column-gap: 40px; /* Firefox */
column-gap: 40px;
}
Try it Yourself »
Example
Specify the width, style, and color of the rule between columns:
div
{
-webkit-column-rule: 4px double #ff00ff; /* Chrome, Safari, Opera */
-moz-column-rule: 4px
double #ff00ff; /* Firefox */
column-rule: 4px double #ff00ff;
}
Try it Yourself »
Related Pages
CSS tutorial: CSS Multiple Columns
HTML DOM reference: columnFill property