Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
CSS3 Multi-Column column-gap Property
The CSS column-gap property is used to specify the gap (spacing) between columns in a multi-column layout. This property helps control the visual separation between columns, making text more readable and organized.
Syntax
selector {
column-gap: value;
}
Possible Values
| Value | Description |
|---|---|
normal |
Default value (usually 1em) |
length |
Defines the gap using px, em, rem, etc. |
% |
Percentage of the container width |
Example
The following example demonstrates how to use the column-gap property to create a 40px gap between columns −
<!DOCTYPE html>
<html>
<head>
<style>
.multi {
column-count: 4;
column-gap: 40px;
column-rule-style: solid;
text-align: justify;
padding: 20px;
line-height: 1.6;
}
</style>
</head>
<body>
<div class="multi">
Tutorials Point originated from the idea that there exists a class of readers who respond
better to online content and prefer to learn new skills at their own pace from the comforts
of their drawing rooms. The journey commenced with a single tutorial on HTML in 2006 and
elated by the response it generated, we worked our way to adding fresh tutorials to our
repository which now proudly flaunts a wealth of tutorials and allied articles on topics
ranging from programming languages to web designing to academics and much more.
</div>
</body>
</html>
Text content is displayed across 4 columns with a 40px gap between each column. Solid vertical lines separate the columns, creating a newspaper-like layout with clear spacing for better readability.
Conclusion
The column-gap property is essential for controlling spacing in multi-column layouts. It improves readability by providing adequate separation between columns, preventing text from appearing cramped or difficult to read.
Advertisements
