CSS column-width Property

If this site has been useful, we’d love your support! Running this site takes time and resources, and every small contribution helps us keep creating valuable content. Consider buying us a coffee to keep things going strong!

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

The rusty swing set creaked a lonely lullaby in the twilight, shadows lengthening like grasping fingers across the dew-kissed grass. A lone dandelion seed, adrift on the breeze, whispered secrets of faraway fields, of dandelion suns and galaxies spun from fluff. Somewhere, beyond the veil of dusk, a coyote laughed, echoing through the stillness like a forgotten memory.

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
Edge Chrome Firefox Opera Safari
12505011.19
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
505011.19550

Last updated by CSSPortal on: 1st January 2024