HTML - DOM樣式物件columnFill屬性



HTML DOM樣式物件columnFill屬性指定內容在分成多列時如何在列中排列。

語法

設定 columnFill 屬性
object.style.columnFill= "balance | auto | initial | inherit";
獲取 columnFill 屬性
object.style.columnFill;

屬性值

描述
balance 這是預設值,它平衡各列。
auto 在此情況下,列將按順序填充,長度不同。
initial 用於將此屬性設定為其預設值。
inherit 用於繼承其父元素的屬性。

返回值

它返回一個字串值,表示元素的 columnFill 屬性。

HTML DOM 樣式物件“columnFill”屬性示例

以下示例將段落元素設定為 auto 和 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>

支援的瀏覽器

屬性 Chrome Edge Firefox Safari Opera
columnFill 是 50 是 12 是 52 是 9 是 37
html_dom_style_object_reference.htm
廣告