Curriculum
Course: CSS Advanced
Login

Curriculum

CSS Advanced

CSS Rounded Corners

0/1

CSS Border Images

0/1

CSS Color Keywords

0/1

CSS Text Effects

0/1

CSS 2D Transforms

0/1

CSS 3D Transforms

0/1

CSS Transitions

0/1

CSS Animations

0/1

CSS Tooltip

0/1

CSS Style Images

0/1

CSS Image Reflection

0/1

CSS Masking

0/1

CSS Buttons

0/1

CSS Multiple Columns

0/1

CSS User Interface

0/1

CSS Box Sizing

0/1

CSS Media Queries

0/1
Text lesson

CSS Multiple Columns

CSS Multi-column Layout

The CSS multi-column layout simplifies the creation of newspaper-like multiple columns of text.

Image

CSS Multi-column Properties

In this chapter, you’ll explore the various multi-column properties, including:

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

Browser Support

The numbers in the table indicate the initial browser version that offers complete support for the property.

Image

CSS Create Multiple Columns

The column-count property determines the number of columns that an element should be segmented into.

In the following example, the text within the <div> element will be divided into 3 columns:

Example 

div {
  column-count: 3;
}

CSS Specify the Gap Between Columns

The column-gap property defines the space between columns.

In the following example, a gap of 40 pixels is set between the columns:

Example 

div {
  column-gap: 40px;
}

CSS Column Rules

The column-rule-style property dictates the style of the rule positioned between columns.

Example 

div {
  column-rule-style: solid;
}

The column-rule-width property determines the thickness of the rule positioned between columns.

Example 

div {
  column-rule-width: 1px;
}

The column-rule-color property determines the color of the rule positioned between columns.

Example 

div {
  column-rule-color: lightblue;
}

The column-rule property serves as a shorthand for configuring all the column-rule-* properties mentioned earlier.

In the following example, the width, style, and color of the rule between columns are set:

Example 

div {
  column-rule: 1px solid lightblue;
}

Specify How Many Columns an Element Should Span

The column-span property determines the number of columns an element should encompass.

In the following example, it specifies that the <h2> element should span across all columns:

Example 

h2 {
  column-span: all;
}

Specify The Column Width

The column-width property indicates an ideal width recommended for the columns.

In the following example, it specifies that the suggested optimal width for the columns should be 100 pixels:

Example 

div {
  column-width: 100px;
}