Style borderLeftProperty

Style 对象参考手册Style Object

Definition and Usage

The borderLeft property sets or returns the three individual left border properties in shorthand form.

Through this property, you can set/return:

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

Syntax

Setting the borderLeft property:

Object.style.borderLeft="width style color"

Returning the borderLeft property:

Object.style.borderLeft

Tip:The borderLeft property has no default value.

Parameter Description
width Sets the width of the left border.
style Sets the style of the left border.
color Sets the color of the left border.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the borderLeft property.


Example

Example

Change the width, style, and color of the left border:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example(example.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()">Change left border</button>

</body>
</html>

Try it Yourself »


Style 对象参考手册Style Object Other Extensions