Change the width of the right border of a <div> element to 10px:
document.getElementById("myDiv").style.borderRightWidth = "10px";
<!DOCTYPE html> <html> <head> <style> #myDiv {/*from w ww. ja v a 2s . c om*/ border-style: solid; } </style> </head> <body> <div id="myDiv">This is a div element.</div> <br> <button type="button" onclick="myFunction()">Change width of the right border</button> <script> function myFunction() { document.getElementById("myDiv").style.borderRightWidth = "10px"; } </script> </body> </html>
The borderRightWidth property sets or gets the width of the right border of an element.
Property Values
Value | Description |
---|---|
thin | a thin border |
medium | a medium border. default |
thick | a thick border |
length | The width of the border in length units |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
The borderRightWidth property returns a String representing the width of an element's right border.