Open In App
Related Articles

HTML DOM Style borderRightColor Property

Improve Article
Improve
Save Article
Save
Like Article
Like

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

  • It is used to return the borderRightColor property. 
object.style.borderRightColor
  • It is used to set the borderRightColor property. 
object.style.borderRightColor = "color|transparent|initial|inherit"

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

Property Values:  

  • color: It specifies the right border color of the corresponding element. Black is the default color.
  • transparent: It sets the right border color of the corresponding element to transparent. 

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

HTML




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

HTML




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

HTML




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

 

  • initial: When no value is specified for this field, it is inherited from the parent of the element. If there is no parent means this element is root then it takes the initial(or default) value.
  • inherit: This keyword applies the initial(or default) value of a property to an element. The initial value should not be confused with the value specified by the browser’s style sheet. When borderColor sets to initial, It appears as black(default) color.

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

  • Google Chrome: Supported
  • Internet Explorer: Supported
  • Mozilla Firefox: Supported
  • Safari: Supported
  • Opera: Supported 

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 14 Jun, 2023
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials