CSS column-gap Property
More "Try it Yourself" examples below.
Definition and Usage
The column-gap
property specifies the gap between the columns.
Note: If there is a column-rule between columns, it will appear in the middle of the gap.
Default value: | normal |
---|---|
Inherited: | no |
Animatable: | yes. Read about animatable Try it |
Version: | CSS Box Alignment Module Level 3 |
JavaScript syntax: | object.style.columnGap="50px" Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
column-gap (in Multiple Columns) | 50 | 10 | 52 | 10 | 37 |
column-gap (in Grid) | 66 | 16 | 61 | 12 | 53 |
column-gap (in Flexbox) | 84 | 84 | 63 | 14.1 | 70 |
CSS Syntax
column-gap: length|normal|initial|inherit;
Property Values
Value | Description | Demo |
---|---|---|
length | A specified length that will set the gap between the columns | Demo ❯ |
normal | Default value. Specifies a normal gap between the columns. W3C suggests a value of 1em | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
More Examples
Example
Divide the text in a <div> element into three columns:
div
{
column-count: 3;
}
Try it Yourself »
Example
Specify the width, style, and color of the rule between columns:
div
{
column-rule: 4px double #ff00ff;
}
Try it Yourself »
Related Pages
CSS tutorial: CSS Multiple Columns
CSS tutorial: CSS Grid Layout
CSS reference: The row-gap property
CSS reference: The gap property
HTML DOM reference: columnGap property