Column-height - CSS Property

column-height

Summary of characteristics of the column-height property

Quick description
Sets the height of the columns in the case of a multi-column layout. This height can be less than the height of the container, resulting in a kind of table.
Status
Compatibility issues
Predefined values
auto
Percentages
Not applicable.
Initial value
auto
Inherited by default
No.
Computed value: during an animation, the column-height property gradually changes from one value to another.
Single: single value (no order).
W3C Module
CSS Multi-column Layout Module
Document status: WD (Working Draft)

Syntax diagram of column-height.

column-height - Syntax DiagramSyntax diagram of the column-height CSS property, which defines the height of the columns, even if it fragments the content. auto auto length lengthcolumn-height:;column-height:;
Syntax diagram of the column-height property.
The links in the diagram provide more details about the values.
Download the diagram in SVG.

In the diagram, the bold terms are the predefined words of CSS, the other terms are described below:

Description of the column-height property.

column-height is still an experimental property. Firefox   and Opera  , for example, don't recognize it.

column-height sets the height of the columns. If the content is bigger, a new set of columns is started below. This way, you get a table where the content automatically spreads across the cells.
The horizontal space between the cells is defined by column-gap, while the vertical space is defined by row-gap.

doesn't work on all browsers.

Here is an example of a text formatted in 2 columns. These have a set height of 70 pixels, but the content clearly exceeds these dimensions. You can see that the columns indeed have a height of 70 pixels, but the content continues in two additional columns located below.

Here's the order in which the cells fill up:

1
2
3
4
5
6
...

Values for column-height.

  • column-height: auto;

    The height of the columns is calculated automatically, mainly from the height property of the container.

    This text is formatted in two columns. The column-height property has been set to auto, so the height of the columns is determined automatically. Most of the time it is determined by the value of height.
    column-height:auto;
  • column-height: 400px; d

    d is a positive or zero value, followed by one of CSS dimension units. The height of the columns is set to the specified value.

    This text is formatted into two columns. The column-height property has been set to 65px, so the height of the columns is fixed at that value. If the content is large enough, another set of columns is created to hold it, and so on.
    column-height:65px;
  • column-height: initial; (auto) column-height: inherit; column-height: revert; column-height: revert-layer; column-height: revert-rule; column-height: unset;

    Common values ​​are presented on these pages: initial, inherit, revert, revert-layer, revert-rule, unset.

Animation of the column-height property.

The column-height property animates, of course, and gradually. In the example below, it seems like there is a sudden jump from one value to another, but that's because the number of lines per column is an integer.
The result of animating column-height is a bit surprising but can be useful in some cases.

If a document is made up of sections containing different kinds of information, you don’t have to lay it out with the same number of columns throughout. On the other hand, a document that contains only one type of information (like an internship report or a final thesis…) should keep the same number of columns from start to finish.

Access the column-height property via a program

With Javascript, change the value of column-height.

In JavaScript, here's how to change the value of column-height. You can see that JavaScript offers a syntax using the typical CSS notation, in kebab-case (a dash to separate words), and another syntax using camel-case notation (a capital letter to separate words).

Javascript
let el = document.getElementById('id'); el.style['column-height'] = '500px'; // or let el = document.getElementById('id'); el.style.columnHeight = '500px';

With Javascript, read the value of column-height.

The property must have been applied directly to the element itself via its style attribute, and not through a CSS selector.

Javascript
let el = document.getElementById('id'); let value = el.style['column-height']; // or let el = document.getElementById('id'); let value = el.style.columnHeight;

With Javascript, read the computed value of column-height.

The computed value is the one that comes from evaluating the relative units (except for the percentage) and taking any inherited values into account.

Javascript
let el = document.getElementById('id'); let value = window.getComputedStyle(el).getPropertyValue('column-height');

With JQuery, read or change the value of column-height.

JQuery, the well-known library, also offers syntaxes for writing or reading the value of column-height.

JQuery

// Read the value:
$('#id').prop('column-height');
// Write the value:
$('#id').prop('column-height', '500px');
$('#id').prop('{column-height': '500px'});

With JQuery, read the computed value of column-height.

JQuery
let value = $('#id').css('column-height');

Other code examples.

Other examples of Javascript and JQuery code are given on the page Javascript and CSS.

Test it yourself.

The buttons below apply the entered value to the column-height property and then display either the value as it was applied or the computed value. This second option lets you see how the value of column-height is stored (serialized). In particular, you can see that percentages are properly stored as percentages (see the chapter on the inheritance in CSS). All other units are converted to pixels.

Simulator.

column-height :
Every magazine or newspaper seeks, to stand out, an original and dynamic column layout. In addition to this sales goal, there’s a practical objective: the reader should be able to tell at a glance where they are. So, each section of a magazine usually has its own unique layout: editorials are in wide columns, brief news in narrow columns, feature articles in medium columns... Some pages have a single column, while others have up to five.

Browsers compatibility with column-height.

The column-height property is still not well recognized by browsers. Firefox  , for example, doesn't handle it.

Column 1
Support by browsers for the column-height property, which sets the height of the columns, even if it splits the text.
1
column-height
property
Estimated overall support.
65%

Browsers on computers :

Mobile browsers :

Outdated or marginal browsers :

Internet Explorer

UC Browser pour Androïd

Opéra Mobile

QQ Browser

Baidu Browser

Safari

Safari sur IOS

Opéra

Chrome

Edge

Firefox

Chrome pour Androïd

Samsung Internet

Androïd Brower

Firefox pour Androïd

KaiOS Browser

Opéra mini

See also...

The CSS specifications published by the W3C are organized into modules. The column-height property is part of the CSS Multi-column Layout Module.
The following definitions are also described in this same module.

Properties:

column-count
Sets the number of columns, in a multi-column layout.
column-fill
Manages the distribution of content across columns.
Column-height
Sets the height of the columns in the case of a multi-column layout. This height can be less than the height of the container, resulting in a kind of table.
column-rule
Shorthand property that defines all parameters of the separator trait between columns.
column-rule-color
Defines the color of the column-separating rules in the context of a multi-column layout, a grid container, or a flex container.
column-rule-style
Choose the type of line for separating columns, in the context of a multi-column layout, a flex container, or a grid container.
column-rule-width
Defines the thickness of the separating line between columns, in the context of a multi-column layout, a flex container, or a grid container.
column-span
Langue française
Manages overlapping content across multiple columns.
column-width
Sets the width of the columns.
columns
Defines the characteristics of a multi-column layout.