CSS column-count
Property
The column-count
property in CSS defines the number of columns an element should be divided into in a multi-column layout. It allows text to flow automatically into multiple columns, similar to how newspapers or magazines format content.
1. Syntax
Value | Description |
---|---|
<number> | Specifies the number of columns (e.g., 2 , 3 , 4 ). |
auto (default) | The browser determines the column count automatically. |
2. Example – Creating a Multi-Column Layout
✅ The text automatically splits into three columns.
3. Example – Responsive Columns with column-count
✅ Displays 4 columns on larger screens and 2 columns on smaller screens.
4. Example – Using column-count: auto;
✅ The browser automatically decides the best number of columns.
5. Best Practices
✔ Use column-count
for readable, magazine-like layouts.
✔ Combine with column-gap
for better spacing.
✔ Use media queries to adjust columns on different screen sizes.