Skip to main content

CSS Multi-column Layout

Splitting text into several columns, the way a newspaper does, is easy with the CSS Multi-column Layout Module.


CSS Multi-column Properties

These are the multi-column properties covered here:

  • column-count
  • column-gap
  • column-rule-style
  • column-rule-width
  • column-rule-color
  • column-rule
  • column-span
  • column-width

CSS Create Multiple Columns

The columns an element is split into are counted by the column-count property.

Example

The text of this <div> element flows into 3 columns:

Prompt
Create an HTML page with a <div> element containing a long paragraph of Lorem Ipsum text. Use CSS column-count: 3 to divide the text into 3 columns.
Output: complete HTML page

CSS Column Gap

Space between the columns comes from the column-gap property.

Example

These columns sit 40 pixels apart:

Prompt
Create an HTML page with a <div> element containing a long paragraph of Lorem Ipsum text. Use CSS column-count: 3 and column-gap: 40px to divide the text into 3 columns with a 40-pixel gap between them.
Output: complete HTML page

Column Subpages

CSS multiple columns continue on this subpage:

  • Column Rules — covers column-rule, column-span, column-width

CSS Multi-columns Properties

Here is every multi-column property with its purpose:

  • column-count — Sets the column total for an element to be split into
  • column-fill — Controls the way columns get filled
  • column-gap — Sets the gap left between columns
  • column-rule — Shorthand that sets every column-rule-* property at once
  • column-rule-color — Colors the rule drawn between columns
  • column-rule-style — Styles the rule drawn between columns
  • column-rule-width — Sets how wide the rule drawn between columns is
  • column-span — Sets the span of an element, counted in columns
  • column-width — Suggests an optimal column width to aim for
  • columns — Shorthand that sets both column-width and column-count together