Open Playground
CSS AdvancedLesson #164

Multiple Column Rules

This page covers CSS column rules, span, and width properties.

This page covers CSS column rules, span, and width properties.


CSS Column Rule

The CSS column-rule-style property specifies the style of the vertical rule between columns:

Example

Example Code

css
Try it Yourself
div
{

  column-rule-style: solid;

}

The CSS column-rule-width property specifies the width of the vertical rule between columns:

Example

Example Code

css
Try it Yourself
div
{

  column-rule-width: 1px;

}

The CSS column-rule-color property specifies the color of the vertical rule between columns:

Example

Example Code

css
Try it Yourself
div
{

  column-rule-color: lightblue;

}

The CSS column-rule property is a shorthand property for setting all the column-rule-* properties above.

Example

Example Code

css
Try it Yourself
div
{

  column-rule: 1px solid lightblue;

}

CSS Column Span

The CSS column-span property specifies how many columns an element (typically a heading) should span across.

Example

Example Code

css
Try it Yourself
h2 {

  column-span: all;
  text-align: center;

}

CSS Column Width

The CSS column-width property specifies a suggested, optimal width for each column.

Here, the browser will determine the number of columns based on this width and the available space.

Example

Example Code

css
Try it Yourself
div {

  column-width: 100px;

}

CSS Multi-columns Properties

The following table lists all the multi-columns properties:

PropertyDescription
column-countSpecifies the number of columns an element should be divided into
column-fillSpecifies how to fill columns
column-gapSpecifies the gap between the columns
column-ruleA shorthand property for setting all the column-rule-* properties
column-rule-colorSpecifies the color of the rule between columns
column-rule-styleSpecifies the style of the rule between columns
column-rule-widthSpecifies the width of the rule between columns
column-spanSpecifies how many columns an element should span across
column-widthSpecifies a suggested, optimal width for the columns
columnsA shorthand property for setting column-width and column-count

Interactive Code Examples

CSS Example 1

css
Try it Yourself
Interactive runnable CSS example from EA Academy.
Live Output Preview:

CSS Example 2

css
Try it Yourself
Interactive runnable CSS example from EA Academy.
Live Output Preview:

CSS Example 3

css
Try it Yourself
Interactive runnable CSS example from EA Academy.
Live Output Preview:

CSS Example 4

css
Try it Yourself
Interactive runnable CSS example from EA Academy.
Live Output Preview:

CSS Example 5

css
Try it Yourself
Interactive runnable CSS example from EA Academy.
Live Output Preview:

CSS Example 6

css
Try it Yourself
Interactive runnable CSS example from EA Academy.
Live Output Preview: