HTML DOM Style borderBottomWidth 屬性
定義和用法
borderBottomWidth 屬性設置或返回元素的下邊框的寬度。
語法
設置borderBottomWidth 屬性:
Object.style.borderBottomWidth="thin|medium|thick|length|inherit"
返回borderBottomWidth 屬性:
Object.style.borderBottomWidth
值 | 描述 |
---|---|
thin | 定义细的边框。 |
medium | 默认。定义中等的边框。 |
thick | 定义粗的边框。 |
length | 使用 px、cm 等单位定义边框的宽度。 |
inherit | 下边框的宽度从父元素继承。 |
瀏覽器支持
所有主要瀏覽器都支持borderBottomWidth 屬性。
注意: IE7及更早的版本不支持"inherit"值。IE8 只有規定了!DOCTYPE 才支持"inherit"。 IE9 支持"inherit"。
實例
實例
更改下邊框的寬度:
<html>
<head>
<style type="text/css">
#ex1
{
border: 1px solid #FF0000;
}
</style>
<script>
function displayResult()
{
document.getElementById("ex1").style.borderBottomWidth="thick";
}
</script>
</head>
<body>
<div id="ex1">This is some text.</div>
<br>
<button type="button" onclick="displayResult()">Change width of bottom border</button>
</body>
</html>
<head>
<style type="text/css">
#ex1
{
border: 1px solid #FF0000;
}
</style>
<script>
function displayResult()
{
document.getElementById("ex1").style.borderBottomWidth="thick";
}
</script>
</head>
<body>
<div id="ex1">This is some text.</div>
<br>
<button type="button" onclick="displayResult()">Change width of bottom border</button>
</body>
</html>
嘗試一下»
Style對象