HTML - DOM Style Object columnFill Property



HTML DOM Style Object columnFill property specifies how contents will be arranged in columns when broken into various columns.

Syntax

Set the columnFill property:
object.style.columnFill= "balance | auto | initial | inherit";
Get the columnFill property:
object.style.columnFill;

Property Values

Value Description
balance It is the default value which balances the columns
auto In this columns are filled sequentially with different length.
initial It is used to set this property to it's default value.
inherit It is used to inherit the property of it's parent element.

Return Value

It returns a string value which represents column fill property of an element.

Example of HTML DOM Style Object 'columnFill' Property

The following example sets the paragraph element to auto and balance.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>
        HTML DOM Style Object columnFill Property
    </title>
    <style>
        #color {
            column-count: 4;
        }
    </style>
</head>
<body>
    <button onclick="fun()">Auto</button>
    <button onclick="funTwo()">Balance</button>
    <p id="color">
        CSS is the acronym for "Cascading Style Sheet".
        It's a style sheet language used for describing
        the presentation of a document written in a markup
        language like HTML. CSS helps the web developers to
        control the layout and other visual aspects of the
        web pages. CSS plays a crucial role in modern web
        development by providing the tools necessary to create
        visually appealing, accessible, and responsive websites.
    </p>
    <script>
        function fun() {
            document.getElementById("color")
                .style.columnFill = "auto";
        }
        function funTwo() {
            document.getElementById("color")
                .style.columnFill = "balance";
        }
    </script>
</body>
</html>

Supported Browsers

Property Chrome Edge Firefox Safari Opera
columnFill Yes 50 Yes 12 Yes 52 Yes 9 Yes 37
html_dom.htm
Advertisements