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 −
Value | Description |
---|---|
thin | This specifies a thin border. |
medium | This specifies the medium border and is the default value. |
thick | This specifies a thin border. |
length | This is used for specifying the border width in length units. |
initial | For setting this property to initial value. |
inherit | To inherit the parent property value |
Let us look at an example for the borderRightWidth Property −
Example
<!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 −