CSS column-fill Property

You are Here:

CSS column-fill Property

CSS column-fill property controls how an element's contents are balanced when broken into columns.

Example

HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> div{ border: 1px solid #267326; padding: 10px; margin-bottom: 25px; height: 75px; column-count: 2; -webkit-column-count: 2; /* Chrome, Safari, Opera */ -moz-column-count: 2; /* Firefox */ } #point{ -moz-column-fill: auto; /* Firefox */ column-fill: auto; } #point1{ -moz-column-fill: balance; /* Firefox */ column-fill: balance; } #point2{ -moz-column-fill: balance-all; /* Firefox */ column-fill: balance-all; } </style> </head> <body> <h1>CSS column-fill Property</h1> <h2>column-fill: auto</h2> <div id="point"> Joanne Rowling was born on 31st July 1965 at ... </div> <h2>column-fill: balance</h2> <div id="point1"> Joanne Rowling was born on 31st July 1965 at ... </div> <h2>column-fill: balance-all</h2> <div id="point2"> Joanne Rowling was born on 31st July 1965 at ... </div> </body> </html>

Syntax

Using CSS

element{ column-fill: balance; }

Using Javascript

object.style.columnFill="balance";

Animatable

Yes, column-fill property is animatable. CSS Animatable Properties Reference.

Default Value

Default value for CSS column-fill property is auto.

Property Value

The following table provides a list of values for CSS column-fill property.

ValueExplanation
autoSpecifies that the columns are filled sequentially. Content takes up only the room it needs.
balanceSpecifies that the content is equally divided between columns. In paged media, only the last page is balanced.
balance-allSpecifies that the content is equally divided between columns. In paged media, all pages are balanced.

Using JavaScript

In the following example, we will demonstrate how to change the CSS column-fill property of an element using JavaScript.

Example

HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> div{ border: 1px solid #267326; padding: 10px; margin-bottom: 25px; height: 75px; column-count: 2; -webkit-column-count: 2; /* Chrome, Safari, Opera */ -moz-column-count: 2; /* Firefox */ column-fill: auto; -moz-column-fill: auto; /* Firefox */ } </style> </head> <body> <h1>CSS column-fill Property</h1> <div> Joanne Rowling was born on 31st July 1965 at ... </div> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementsByTagName("div")[0]; function myFunction(){ x.style.columnFill = "balance"; x.style.WebkitColumnFill = "balance"; x.style.MozColumnFill = "balance"; } </script> </body> </html>

Reminder

Hi Developers, we almost covered 98.7% of CSS Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in CSS.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author