The borderRightWidth
property sets or gets the
width of the right border.
borderRightWidth |
Yes | Yes | Yes | Yes | Yes |
Return the borderRightWidth property:
var v = object.style.borderRightWidth
Set the borderRightWidth property:
object.style.borderRightWidth=thin|medium|thick|length|initial|inherit
Value | Description |
---|---|
thin | thin border |
medium | Default value. medium border. |
thick | thick border |
length | Set border width in length units |
initial | Set to its default value. |
inherit | Inherit from parent element. |
Default Value: | medium |
---|---|
Return Value: | A string representing the right border width |
CSS Version | CSS1 |
The following code shows how to change the right border width to 10px.
<!DOCTYPE html>
<html>
<head>
<style>
#myDiv {<!--from w w w.j ava2 s. co m-->
border-style: solid;
}
</style>
</head>
<body>
<div id="myDiv">This is a div element.</div>
<button type="button" onclick="myFunction()">test</button>
<script>
function myFunction() {
document.getElementById("myDiv").style.borderRightWidth = "10px";
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to change the right border width to thin.
<!DOCTYPE html>
<html>
<head>
<style>
#myDiv {<!--from ww w . ja v a 2 s . c o m-->
border-style: solid;
}
</style>
</head>
<body>
<div id="myDiv">This is a div element.</div>
<button type="button" onclick="myFunction()">test</button>
<script>
function myFunction() {
document.getElementById("myDiv").style.borderRightWidth = "thin";
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to get the right border width.
<!DOCTYPE html>
<html>
<body>
<div id="myDiv" style="border-right:thick solid red">This is a div element.</div>
<button type="button" onclick="myFunction()">test</button>
<script>
function myFunction() {<!--from w ww. ja va 2s . c o m-->
console.log(document.getElementById("myDiv").style.borderRightWidth);
}
</script>
</body>
</html>
The code above is rendered as follows: