HTML - DOM Style 物件 columnRuleColor 屬性



HTML DOM Style 物件 **columnRuleColor** 屬性用於設定或獲取列之間的規則顏色。

語法

設定 columnRuleColor 屬性
object.style.columnRuleColor= "color | initial | inherit";
獲取 columnRuleColor 屬性
object.style.columnRuleColor;

屬性值

描述
color 指定規則顏色。其預設值為當前元素的顏色。
initial 用於將此屬性設定為其預設值。
inherit 用於繼承其父元素的屬性。

返回值

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

HTML DOM Style 物件 'columnRuleColor' 屬性示例

以下示例將規則顏色從黑色更改為綠色。

<!DOCTYPE html>
<html lang="en">
<head>
    <title>
        HTML DOM Style Object columnRuleColor Property
    </title>
    <style>
        #rule {
            column-count: 3;
            column-rule: 2px solid;
        }
    </style>
</head>
<body>
    <p>Click to change the rule color.</p>
    <button onclick="fun()">Change</button>
    <p id="rule">
        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("rule")
                .style.columnRuleColor = "#04af2f";
        }
    </script>
</body>
</html>

支援的瀏覽器

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