HTML DOM Style borderRightWidth Property


The HTML DOM borderRightWidth property is used for setting or getting the Right border width for an element.

Following is the syntax for −

Setting the borderRightWidth property −

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

The property values are explained as follows −

ValueDescription
thinThis specifies a thin border.
mediumThis specifies the medium border and is the default value.
thickThis specifies a thin border.
lengthThis is used for specifying the border width in length units.
initialFor setting this property to initial value.
inheritTo inherit the parent property value

Let us look at an example for the borderRightWidth Property −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
   #DIV1{
      height: 100px;
      width: 200px;
      border: 10px groove orange;
      padding: 10px;
      border-Right-width:30px;
   }
</style>
<script>
   function changeRightWidth(){
      document.getElementById("DIV1").style.borderRightWidth="1px";
      document.getElementById("Sample").innerHTML="The Right border width is now decreased";
   }
</script>
</head>
<body>
   <div id="DIV1">SOME SAMPLE TEXT</div>
   <p>Change the above div Right border width by clicking the below button</p>
   <button onclick="changeRightWidth()">Change Right Width</button>
   <p id="Sample"></p>
</body>
</html>

Output

On clicking the “Change Right Width” button −

Updated on: 23-Oct-2019

42 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements