CSS columns Property
Description
The columns
CSS property is used to control the layout and formatting of multi-column text content within an element. It allows web developers to specify the number of columns, their width, and the gap between them. This property is particularly useful for creating newspaper-style layouts or improving the readability of long blocks of text by breaking them into multiple columns. By adjusting the column-related properties, such as "column-count" for the number of columns, "column-width" for their width, and "column-gap" for the space between columns, designers can achieve a more visually appealing and responsive text presentation on web pages. Individual properties are: column-width and column-count.
- Initial value
- See individual properties
- Applies to
- Block level elements
- Inherited
- No
- Computed value
- See individual properties
- Animatable
- No
- JavaScript syntax
- object.style.columns
Interactive Demo
Syntax
columns: <column-width> || <column-count>
Values
- <column-width>See column-width CSS property for values.
- <column-count>See column-count CSS property for values.
Example
<div class="book">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
.book {
columns: 150px 3;
-moz-columns: 150px 3;
-webkit-columns: 150px 3;
}
Browser Support
The following table will show you the current browser support for the CSS columns
property.
Desktop | |||||
12 | 50 | 52 | 11.1 | 9 |
Tablets / Mobile | |||||
50 | 52 | 11.1 | 9 | 5 | 50 |
Last updated by CSSPortal on: 1st January 2024