CSS Multiple Columns


CSS Multi-column Layout

With CSS multi-column layout, you can easily create multiple columns of text, similar to how it's done in newspapers.

Daily Ping

Lorem ipsum
dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.


CSS Multi-column Properties

In this section, you'll discover various attributes related to multiple columns.

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

CSS Create Multiple Columns

The column-count property tells us how many columns an element should be split into.

In this example, we will split the text inside a <div> element into three columns.

Example

div {
  column-count: 3;
}
Try it Yourself »

CSS Specify the Gap Between Columns

The column-gap property tells us how much space there is between columns.

In the example below, there is a 40-pixel space between the columns.

Example

div {
  column-gap: 40px;
}
Try it Yourself »

CSS Column Rules

The column-rule-style property tells us how the line between columns should look like:

Example

div {
  column-rule-style: solid;
}
Try it Yourself »

The column-rule-width property tells us how wide the line between columns should be.

Example

div {
  column-rule-width: 1px;
}
Try it Yourself »

The column-rule-color property tells us what color the line between columns should be.

Example

div {
  column-rule-color: lightblue;
}
Try it Yourself »

The column-rule property is like a shortcut for adjusting all the properties related to column rules.

In this example, we adjust the width, style, and color of the column separator line:

Example

div {
  column-rule: 1px solid lightblue;
}
Try it Yourself »

Specify How Many Columns an Element Should Span

The column-span property tells us how many columns an element should cover.

The example below shows that the <h2> heading should stretch across all columns:

Example

h2 {
  column-span: all;
}
Try it Yourself »

Specify The Column Width

The column-width property tells us how wide columns should ideally be.

The example below tells us that the best width for the columns should be 100 pixels:

Example

div {
  column-width: 100px;
}
Try it Yourself »

CSS Multi-columns Properties

The table below shows a list of properties that are related to having multiple columns:

Property Description
column-count This tells how many parts something should be split into.
column-fill Describes how to occupy columns.
column-gap Describes the space between the columns.
column-rule A quick way to set all the column-rule-* properties using a single property.
column-rule-color This tells us what color the line between columns should be.
column-rule-style Describes how columns should be styled.
column-rule-width This sets how wide the line is that separates columns.
column-span Describes the number of columns an element should cover.
column-width Indicates the best width recommended for the columns.
columns A shortcut way to adjust the width and count of columns in HTML.