UGURUS offers elite coaching and mentorship for agency owners looking to grow. Start with the free Agency Accelerator today.
If you need an exact numbers of columns when designing a multi-column layout, use column-count
.
.lead {
column-count: 3;
}
Given the number of columns, the browser will evenly distribute the content in exactly that number of columns.
This property can also be used in the shorthand for columns
and can be used in tandem with column-width
. When both properties are declared column-count
is the maximum number of columns.
Values
column-count
can be auto
or an integer.
Use auto
if you are also using column-width
. Think of it as a way of telling the browser, to let column-width
take the lead.
The integer, also known as the number of columns, must be greater than or equal to 0.
Unlike column-width
this property will hold the number of columns regardless of the browser width. This means that if you pulled up a 5-columned layout on your mobile phone, you will have a very squished 5-columned layout to navigate. column-count
works best alongside column-width
.
Related Properties
Additional Resources
Browser Support
Multi-column layout support:
Chrome | Safari | Firefox | Opera | IE | Android | iOS |
---|---|---|---|---|---|---|
Any | 3+ | 1.5+ | 11.1+ | 10+ | 81 | 3.2+ |
Don’t forget your prefixes if you aren’t using a tool that helps with that already.
are you sure about this browser support? I saw on another site and it was much different.
Yeah, pretty sure. We’re pulling from caniuse:
https://caniuse.com/#feat=mdn-css_properties_column-count
Didn’t work for me, maybe because I use Normalize.css? My code:
1
2
3
div.columns {
column-count: 3;
column-width: 33.3%;
column-gap: 1rem;
}
p {border:1px blue solid;}
That seems to be working! Here’s a demo with your code: https://codepen.io/geoffgraham/pen/gOeGOWK