Modules / Styling

Styling: CSS columns

CSS columns

Flow text, or a stack of children, across newspaper-style columns. Flex and grid cannot do this, because content there never continues from one column into the next.

#17 of 39 modules by votes

  • On by default
  • Needs Bricks 2.4 or newer
  • Tested with Bricks 2.4.3
Recording: in the Bricks builder, someone sets Column count to 3 on a long paragraph, and the text flows into three columns; a solid 1 px divider then draws a hairline between them.Recorded in Bricks 2.4.3

How to use it

  1. Select an element and open Style > Layout. The Columns block sits next to Flex basis.
  2. Set Column count (1 to 12), Column width, or both. Column width is the ideal width. The browser fits as many columns as there is room for, up to the count if you set one.
  3. Set Column gap for the space between columns.
  4. For a line between columns, set Divider style (Solid, Dashed, Dotted or Double), then Divider width and Divider color. The divider shows only once you choose a style.
  5. To stop a child from splitting across two columns, select that child and set Keep together in a column to Yes (never split). Use it on a card, or on a heading with its paragraph. No turns it back off.
  6. On a child, Span all columns runs it across every column, such as a heading over the columns, and Start a new column moves it to the top of the next column (or keeps it from starting one).
  7. Fill: Balance the columns (the default) or Fill one by one, which needs a fixed height on the element.

Where it appears in Bricks

Style tab > Layout, on every element, in a Columns block next to Bricks' Flex basis. It works in global classes too, and each field takes its own value per breakpoint and in hover states.

How it works with Bricks' flex layout

Multi-column layout is ignored on a flex container, and Bricks' Section, Container and Block are flex. So Column count and Column width also set the element's display to block. Children then flow down the columns instead of stacking with a gap, and the element's flex settings no longer apply.

Set Column count to 1 at a breakpoint to go back to a single column there.

Limits

  • Keep together in a column, Span all columns and Start a new column are meant for the child of a multi-column element, not for the element itself.
  • Only Column count and Column width change the display. Setting them at a breakpoint or in a state changes it there.

Settings

Bricks > Kiln, open the module's settings:

  • Add these controls to: All elements (the default), Layout and media elements, or The elements ticked below. For this module, Layout and media elements also covers the text elements that sit in columns: Heading, Text, Basic text, Text link, Button, Icon box and List. Bricks loads every control once per element type into the builder, so fewer elements keep the builder lighter. With every Kiln style module set to layout and media elements, the builder loads about 40% less control data. Values you already set on other elements stay on the page; the builder stops showing those fields there.

Requirements

Bricks 2.4 or newer.