CSS column-span Property

The column-span property specifies whether the element spans across one column or all columns. This property has two values: none and all. "None" is the default value of color-span property. It spans the element across one column. "All" value defines that the element should span across all columns.

The column-span property can span wide images. But it does not allow to span an image across a number of columns. It allows to choose whether the image should be spanned across all columns or not to be spanned at all.

An element can be spanned across columns only if it is a block-level element.

Initial Value none
Applies to in-flow block-level elements
Inherited No.
Animatable No.
Version CSS3
DOM Syntax object.style.columnSpan = "all";

Syntax

column-span: none | all | initial | inherit;

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style> 
      div {
      -webkit-column-count: 4; /* Chrome, Safari, Opera */
      -moz-column-count: 4; /* Firefox */
      column-count: 4;
      }
      h2 {
      -webkit-column-span: none; /* Chrome, Safari, Opera */
      column-span: none;
      }
    </style>
  </head>
  <body>
    <div>
      <h2>Lorem Ipsum is simply dummy text</h2>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </div>
  </body>
</html>

In the following example the heading spans across all four columns:

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style> 
      div {
      -webkit-column-count: 4; /* Chrome, Safari, Opera */
      -moz-column-count: 4; /* Firefox */
      column-count: 4;
      }
      h2 {
      -webkit-column-span: all; /* Chrome, Safari, Opera */
      column-span: all;
      }
    </style>
  </head>
  <body>
    <div>
      <h2>Lorem Ipsum is simply dummy text</h2>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </div>
  </body>
</html>

Values

Value Description
none this is default value. The element does not span across all columns. It spans across one column.
all the element spans across all columns.
initial sets the property to its default value.
inherit inherits the property from its parent element.

Browser support

50.0
-webkit-
10+ 12.0
-webkit-
65.0+ 3.0
-webkit-
11.1
+ 15.0 -webkit-

Practice Your Knowledge

Which one is the default value of color-span property.




Related articles