CSS columns Property

Specify the minimum width for each css column, and the maximum number of columns:

div {
-webkit-columns: 100px 3; /* Chrome, Safari, Opera */
-moz-columns: 100px 3; /* Firefox */
columns: 100px 3;
}

Try it Yourself »

More “Try it Yourself” examples below.


Definition and Usage

The columns property is a shorthand property for the column-width and column-count properties.

The column-width part will define the minimum width for each column, while the column-count part will define the maximum number of columns. By using this property, the multi-column layout will automatically break down into a single column at narrow browser widths, without the need of media queries or other rules.

Default value: auto auto
Inherited: no
Animatable: yes, see individual propertiesRead about animatable – Try it
Version: CSS3
JavaScript syntax: object.style.columns=”100px 3″ Try it
CSS Syntax
columns: auto|column-width column-count|initial|inherit;
Property Values
Value Description
auto Default value. Sets both the column-width and column-count to “auto”
column-width Defines the minimum width for each column
column-count Defines the maximum number of columns
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

More 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 »

 

Post Author: Zahid Farid