Style borderLeftWidthProperty
Style Object
Definition and Usage
The borderLeftWidth property sets or returns the width of the left border of an element.
Syntax
Set the borderLeftWidth property:
Object.style.borderLeftWidth="thin|medium|thick|length|inherit"
Return the borderLeftWidth property:
Object.style.borderLeftWidth
| Value | Description |
|---|---|
| thin | Defines a thin border. |
| medium | Default. Defines a medium border. |
| thick | Defines a thick border. |
| length | Defines the width of the border using units such as px, cm, etc. |
| inherit | The width of the left border is inherited from the parent element. |
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the borderLeftWidth property.
Note:IE7 and earlier versions do not support the "inherit" value. IE8 supports "inherit" only if a !DOCTYPE is specified. IE9 supports "inherit".
Example
Example
Change the width of the left border:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example(example.com)</title>
<style type="text/css">
#ex1{
border: 1px solid #FF0000;
}
</style>
<script>
function displayResult(){
document.getElementById("ex1").style.borderLeftWidth="thick";
}
</script>
</head>
<body>
<div id="ex1">This is some text.</div>
<br>
<button type="button" onclick="displayResult()">Change the width of the left border</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Example(example.com)</title>
<style type="text/css">
#ex1{
border: 1px solid #FF0000;
}
</style>
<script>
function displayResult(){
document.getElementById("ex1").style.borderLeftWidth="thick";
}
</script>
</head>
<body>
<div id="ex1">This is some text.</div>
<br>
<button type="button" onclick="displayResult()">Change the width of the left border</button>
</body>
</html>
Try it Yourself »
Style Object Other Extensions