Latest web development tutorials

HTML DOM Style borderTopWidth property

Style Object Reference Style Objects

Definition and Usage

borderTopWidth property sets or returns the element on the width of the border.

grammar

Setting borderTopWidth properties:

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

Back borderTopWidth properties:

Object.style.borderTopWidth

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support borderTopWidth property.

Note: IE7 and earlier versions do not support the "inherit" value.IE8 only provides! DOCTYPE supported "inherit". IE9 support "inherit".


Examples

Examples

Change the border width:

<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Style type = "text / css">
# Ex1 {
border: 1px solid # FF0000;
}
</ Style>
<Script>
function displayResult () {
document.getElementById ( "ex1") style.borderTopWidth = "thick".;
}
</ Script>
</ Head>
<Body>

<Div id = "ex1"> This is some text. </ Div>
<br>
<Button type = "button" onclick = "displayResult ()"> Modify the border width </ button>

</ Body>
</ Html>

try it"


Style Object Reference Style Objects