Javascript DOM CSS Style borderRightColor Property

Introduction

Change the color of the right border of a <div> element to red:

document.getElementById("myDiv").style.borderRightColor = "red";

View in separate window

<!DOCTYPE html>
<html>
<head>
<style>
#myDiv {//from  w w  w. j a  va 2s .c  o m
  border: thick solid blue;
}
</style>
</head>
<body>

<div id="myDiv">This is a div.</div>
<br>
<button type="button" onclick="myFunction()">Change color of the right border</button>

<script>
function myFunction() {
  document.getElementById("myDiv").style.borderRightColor = "red";
}
</script>

</body>
</html>

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

Property Values

Value Description
color Set the color of the right border. Default color is black
transparent The color of the right border is transparent
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

The borderRightColor property returns a String representing the color of an element's right border.




PreviousNext

Related