CSS Reference

Quick Reference

The column-fill property specifies how to either fill the columns by balancing the content or by first filling the initial column’s full height before moving to the next.

div {
    column-fill: balance;
}

Default

Default valuebalance
Inherited valuesno
Can it be animated?no

These are the allowed values.

ValueDescription
balanceFills each column with about the same amount of content, but will not allow the columns to be taller than the height; columns might be shorter than the height as the browser distributes the content evenly horizontally (default)
autoFills each column until it reaches the height, and do this until it runs out of content; this value will not necessarily fill all the columns nor fill them evenly
initialSets this property to its default value
inheritInherits this property from its parent element

Using JavaScript

The HTML element can also be styled using JavaScript and the element’s id.

document.getElementById('my_div').style.columnFill = 'balance';
<button onclick='my_function()'>Click Here</button>

<script>
function my_function() {
    document.getElementById('my_div').style.columnFill = 'balance';
}
</script>

CSS Notes:


We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.