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 value | balance |
Inherited values | no |
Can it be animated? | no |
These are the allowed values.
Value | Description |
---|---|
balance | Fills 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) |
auto | Fills 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 |
initial | Sets this property to its default value |
inherit | Inherits 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:
- The “inherit”, “initial” and “unset” keywords can be used with any CSS property to set its value
- In CSS there are many ways to express a color value in a property
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.