Open In App

HTML | DOM Style columnRuleWidth Property

The Style columnRuleWidth property in HTML DOM is used to define or determine the width of the rule between the columns.

Syntax:



object.style.columnRuleWidth
object.style.columnRuleWidth = "medium|thin|thick|length|
initial|inherit"

Property Values:

Return Value: It returns a string that represents the column-rule-width property of the element. 



Example 1: This example describes the length property value. 




<!DOCTYPE html>
<html>
     
<head>
    <title>
        HTML | DOM Style columnRuleWidth Property
    </title>
    <style>
        #GFG {
             
            /* For old Chrome and Safari browsers */
            -webkit-column-count:4;
            -webkit-column-rule: 1px green solid;
             
            /* For Firefox browser */
            -moz-column-count:4;
            -moz-column-rule: 1px green solid;
             
            -webkit-column-count:4;
            -webkit-column-rule: 1px green solid;
            text-align:justify;
        }
    </style>
</head>
 
<body>
    <div id = "GFG">
        Prepare for the Recruitment drive of product
        based companies like Microsoft, Amazon, Adobe
        etc with a free online placement preparation
        course. The course focuses on various MCQ's 
        & Coding question likely to be asked in the 
        interviews & make your upcoming placement
        season efficient and successful.
    </div>
 
    <p>
        Click on the button to change the
        column-rule width
    </p>
 
    <button onclick = "myGeeks()">
        Click Here!
    </button>
 
    <script>
        function myGeeks() {
            document.getElementById("GFG").style.columnRuleWidth
                    = "10px";
        }
    </script>
</body>
 
</html>                               

Output: 

Before Click on the button: 

After Click on the button: 

Example 2: This example describes medium property value. 




<!DOCTYPE html>
<html>
     
<head>
    <title>
        HTML | DOM Style columnRuleWidth Property
    </title>
    <style>
        #GFG {
             
            /* For old Chrome and Safari browsers */
            -webkit-column-count:4;
            -webkit-column-rule: 1px green solid;
             
            /* For Firefox browser */
            -moz-column-count:4;
            -moz-column-rule: 1px green solid;
             
            -webkit-column-count:4;
            -webkit-column-rule: 1px green solid;
            text-align:justify;
        }
    </style>
</head>
 
<body>
    <div id = "GFG">
        Prepare for the Recruitment drive of product
        based companies like Microsoft, Amazon, Adobe
        etc with a free online placement preparation
        course. The course focuses on various MCQ's 
        & Coding question likely to be asked in the 
        interviews & make your upcoming placement
        season efficient and successful.
    </div>
 
    <p>
        Click on the button to change the
        column-rule width
    </p>
 
    <button onclick = "myGeeks()">
        Click Here!
    </button>
 
    <script>
        function myGeeks() {
            document.getElementById("GFG").style.columnRuleWidth
                    = "medium";
        }
    </script>
</body>
 
</html>                   

Output: 

Before Click on the button: 

After Click on the button: 

Supported Browsers: The browser supported by DOM Style columnRuleStyle property are listed below:


Article Tags :