Latest web development tutorials

HTML DOM Style borderLeft property

Style Object Reference Style Objects

Definition and Usage

borderLeft shorthand property to set or return the left border of three independent properties.

With this property, you can set / return:

  • border-left-width
  • border-left-style
  • border-left-color

grammar

Setting borderLeft properties:

Object.style.borderLeft="width style color"

Back borderLeft properties:

Object.style.borderLeft

Tip: borderLeft property has no default value.

参数 描述
width 设置左边框的宽度。
style 设置左边框的样式。
color 设置左边框的颜色。


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support borderLeft property.


Examples

Examples

Change the left border width, style, and color:

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

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

</ Body>
</ Html>

try it"


Style Object Reference Style Objects