Open In App

HTML DOM Style borderRightColor Property

The borderRightColor property allows us to set/get the color to the right border of an element. 
Syntax: 

object.style.borderRightColor
object.style.borderRightColor = "color|transparent|initial|inherit"

Return Value: The borderRightColor property returns the color of the right border of an element. 



Property Values:  

Example 1: In this example, we will see the use of DOM style borderRightColor property






<!DOCTYPE html>
<html>
<head>
    <style>
        #GFG_Div {
            width: 200px;
            margin-left: 210px;
            border: thick solid green;
        }
    </style>
</head>
   
<body>
    <p> Click to change the right border color of element.</p>
    <button type="button" onclick="myGeeks()">
        Click to change
    </button>
    <br>
    <br>
    <div id="GFG_Div">GeeksforGeeks</div>
    <script>
        function myGeeks() {
            document.getElementById("GFG_Div")
                .style.borderRightColor = "red";
        }
    </script>
</body>
</html>

Output:

 

Example 2: In this example, we will see the use of DOM style borderRightColor property




<!DOCTYPE html>
<html>
<head>
    <style>
        #GFG_Div {
            width: 200px;
            border: thick solid green;
        }
    </style>
</head>
   
<body>
    <p> Click to change the right border color of element.</p>
    <button type="button" onclick="myGeeks()">
        Click to change
    </button>
    <br>
    <br>
    <div id="GFG_Div">GeeksforGeeks</div>
    <script>
        function myGeeks() {
            document.getElementById("GFG_Div")
                .style.borderRightColor = "yellow";
        }
    </script>
</body>
</html>

Output: 

 

Example: In this example, we will use the transparent property.




<!DOCTYPE html>
<html>
<head>
    <style>
        #GFG_Div {
            width: 200px;
            border: thick solid green;
        }
    </style>
</head>
   
<body>
    <p> Click to change the right border color of element.</p>
    <button type="button" onclick="myGeeks()">
        Click to change
    </button>
    <br>
    <br>
    <div id="GFG_Div">GeeksforGeeks</div>
    <script>
        function myGeeks() {
            document.getElementById("GFG_Div")
                .style.borderRightColor = "transparent";
        }
    </script>
</body>
</html>

Output: 

 

Browser Support: The browser supported by DOM Style borderRightColor property is listed below:  


Article Tags :