/

HTML / CSS / JavaScript Tutorial

CSS Property: border-left-width

[this page | pdf | back links]

The CSS (CSS1) border-left-width property sets the width of the left border of an element. You should always specify the border-style property before this property, as an element must have a border before you can change its characteristics.

 

Valid property values (other than inherit and initial) are:

 

Value

Description

length

Any specified thickness as a CSS length

medium

(default value). Medium width

thick

Thick width

thin

Thin width

 

Default Value:

medium

JavaScript syntax:

e.g. object.style.borderLeftWidth="4px"

Inherited:

No

Animatable:

Yes

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
p {border: thin solid black; width: 200px}
p.x1 {border-left-width: thick;}
</style>
<link rel="stylesheet" type="text/css" href="Content\ExampleStyles.css">
</head>
<body>
<p>Element 1: a paragraph with a common border property (i.e. thin, solid, black)</p>
<p style="border-left-width: thick;">Element 2: a paragraph with a thick left border,
 set using an in-line style</p>
<p class="x1">Element 3: as per Element 2 but set using an in-file style</p>
<p class="examplecssborderleftwidth">Element 4: as per Element 2 but set using an
 external style sheet</p>
<p id="x2">Element 5: as per Element 2 but set using JavaScript</p>

<script>
document.getElementById("x2").style.borderLeftWidth = "thick";
</script>

</body>
</html>

FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyBorderLeftWidth() {
  var x = document.createElement("DIV"); x.style.borderLeftWidth = "thick"; return (window.getComputedStyle(x, null).borderLeftWidth == "thick");
}


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile