CSS column-width Property
Description
The column-width
CSS property is used to specify the ideal width for columns in a multi-column layout. It determines the approximate width that each column should have, and the browser then automatically calculates the number of columns that can fit within the available container width. This property is particularly useful for creating responsive and dynamic layouts for text or other content, allowing it to flow into multiple columns while adapting to different screen sizes and orientations. By setting the column-width, you can control the balance between the number of columns and the width of each column to achieve the desired visual presentation.
- Initial value
- auto
- Applies to
- Block level elements
- Inherited
- No
- Computed value
- The absolute length, zero or larger
- Animatable
- No
- JavaScript syntax
- object.style.columnWidth
Interactive Demo
Syntax
column-width: <length> | auto
Values
- <length>A floating-point number, followed by either an absolute units designator (cm, mm, in, pt, or pc) or a relative units designator (em, ex, or px), that indicates the optimal width.
- autoIs a keyword indicating that the width of the column should be determined by other CSS properties, like column-count.
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 {
column-count: 3;
column-width: 200px;
-moz-column-count: 3;
-moz-column-width: 200px;
-webkit-column-count: 3;
-webkit-column-width: 200px;
}
Browser Support
The following table will show you the current browser support for the CSS column-width
property.
Desktop | |||||
![]() |
![]() |
![]() |
![]() |
![]() |
|
12 | 50 | 50 | 11.1 | 9 |
Tablets / Mobile | |||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
50 | 50 | 11.1 | 9 | 5 | 50 |
Last updated by CSSPortal on: 1st January 2024