CSS Property column-gap








The column-gap property sets the gap between the columns.

When working with columns, space between each column is called gap.

If you find that the gap is too wide, or too narrow, you can adjust it with column-gap. W3C suggests a value of 1em.

For example,

article {
  -webkit-columns: 2;
     -moz-columns: 2;
          columns: 2;
  -webkit-column-gap: 20px;
     -moz-column-gap: 20px;
          column-gap: 20px;
}




Summary

Initial value
normal
Inherited
no
CSS Version
CSS3
JavaScript syntax
object.style.columnGap="50px"
Animatable
yes.

CSS Syntax

column-gap: length|normal|initial|inherit;

Property Values

length
sets the gap length between the columns
normal
Default value. Specifies a normal gap between the columns.
initial
sets to default value
inherit
Inherits this property from its parent element

Browser compatibility

Yes 10.0 Yes Yes Yes

Example

<!DOCTYPE html>
<html>
<head>
<style> 
.newspaper {<!--   w w  w.ja va  2  s  . c  om-->
    -webkit-column-count: 3; /* Chrome, Safari, Opera */
    -moz-column-count: 3; /* Firefox */
    column-count: 3;

    -webkit-column-gap: 40px; /* Chrome, Safari, Opera */
    -moz-column-gap: 40px; /* Firefox */
    column-gap: 40px;
}
</style>
</head>
<body>

<div class="newspaper">
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. Typi non habent 
claritatem insitam; est usus legentis in iis qui facit 
eorum claritatem. Investigationes demonstraverunt lectores 
legere me lius quod ii legunt saepius.
</div>

</body>
</html>

Click to view the demo