HTML - DOM Style Object columnRuleColor Property



HTML DOM Style Object columnRuleColor property used to set or get the rule color betweeen columns.

Syntax

Set the columnRuleColor property:
object.style.columnRuleColor= "color | initial | inherit";
Get the columnRuleColor property:
object.style.columnRuleColor;

Property Values

Value Description
color It specifies the rule color. It's default value is current element's color.
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 rule color property of an element.

Example of HTML DOM Style Object 'columnRuleColor' Property

The folowing example sets the rule color from black to green.

<!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>

Supported Browsers

Property Chrome Edge Firefox Safari Opera
columnRuleColor Yes 50 Yes 12 Yes 52 Yes 9 Yes 11.1
html_dom.htm
Advertisements