Javascript Reference - HTML DOM Style borderRightColor Property








The borderRightColor property sets or gets the color of the right border of an element.

Browser Support

borderRightColor Yes Yes Yes Yes Yes

Syntax

Return the borderRightColor property:

var v = object.style.borderRightColor 

Set the borderRightColor property:

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

Property Values

Value Description
color Specifies the color for the right border. Default color is black
transparent Set color for the right border to transparent
initial Sets to default value.
inherit Inherits from parent element.




Technical Details

Default Value: black
Return Value: A string representing the right border color
CSS Version CSS1

Example

The following code shows how to use change the color of the right border.


<!DOCTYPE html>
<html>
<head>
<style>
#myDiv {<!--from   w ww .j a v a  2s .c  o  m-->
    border: thick solid blue;
}
</style>
</head>
<body>
<div id="myDiv">This is a div.</div>
<button type="button" onclick="myFunction()">test</button>
<script>
function myFunction() {
    document.getElementById("myDiv").style.borderRightColor = "black";
}
</script>
</body>
</html>

The code above is rendered as follows:





Example 2

The following code shows how to use get the right border color.


<!DOCTYPE html>
<html>
<body>
<div id="myDiv" style="border-right:thick solid green">This is a div.</div>
<button type="button" onclick="myFunction()">test</button>
<script>
function myFunction() {<!--from  w w w . jav a  2 s .  c  om-->
    console.log(document.getElementById("myDiv").style.borderRightColor);
}
</script>

</body>
</html>

The code above is rendered as follows: