Latest web development tutorials

HTML DOM Style borderRightWidth 屬性

Style 對象參考手冊 Style對象

定義和用法

borderRightWidth 屬性設置或返回元素的右邊框的寬度。

語法

設置borderRightWidth 屬性:

Object.style.borderRightWidth="thin|medium|thick|length|inherit"

返回borderRightWidth 屬性:

Object.style.borderRightWidth

描述
thin 定义细的边框。
medium 默认。定义中等的边框。
thick 定义粗的边框。
length 使用 px、cm 等单位定义边框的宽度。
inherit 右边框的宽度从父元素继承。


瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要瀏覽器都支持borderRightWidth 屬性。

注意: IE7及更早的版本不支持"inherit"值。IE8 只有規定了!DOCTYPE 才支持"inherit"。 IE9 支持"inherit"。


實例

實例

更改右邊框的寬度:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<style type="text/css">
#ex1{
    border: 1px solid #FF0000;
}
</style>
<script>
function displayResult(){
    document.getElementById("ex1").style.borderRightWidth="thick";
}
</script>
</head>
<body>

<div id="ex1">这是一些文本。</div>
<br>
<button type="button" onclick="displayResult()">修改右边框的宽度</button>

</body>
</html>

嘗試一下»


Style 對象參考手冊 Style對象