Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

columns — multi-column layout shorthand

The columns property sets the preferred width and number of columns through which content flows. The Level 2 draft adds a height after a slash; distinguish that extension from the basic Level 1 form.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

columns: [ <'column-width'> || <'column-count'> ] [ / <'column-height'> ]?;

columns is a multi-column layout shorthand. Content flows through successive columns rather than forming independent cells as in a grid. The basic form sets column-width and column-count; an omitted component receives its initial value, auto.

Supply a width, a count, or both in either order: columns: 200px 2. The width is preferred, not guaranteed. When a width and a numeric count are specified, the count sets a maximum, so less available space can produce fewer columns. A numeric count must be a positive integer, but auto is also valid for column-count and can be specified explicitly, as in columns: 200px auto. The width accepts neither percentages nor negative values.

The Level 2 draft extends the shorthand with optional / <'column-height'>, for example columns: 200px 2 / 300px. It also resets column-wrap to its initial value; omitted column-height returns to auto. This is a draft extension, not confirmation of Chromium 152 support. The example uses the Level 1 form; extension support needs separate verification.

Set spacing with column-gap and a dividing line with column-rule: neither is a component of columns. In the example, a forced break separates two paragraphs into two columns, making the result easier to check locally.

Examples

<!doctype html>
<meta charset="utf-8">
<title>columns</title>
<style>
  .story {
    width: 420px;
    columns: 200px 2;
    column-gap: 20px;
    font: 16px/24px monospace;
  }
  .story p { margin: 0; }
  .story p + p { break-before: column; }
</style>
<div class="story">
  <p>Alpha<br>Beta</p>
  <p>Gamma<br>Delta</p>
</div>

Result

Alpha    Gamma
Beta     Delta

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources