Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

border-left-width — left border thickness

The border-left-width property sets the thickness of the physical left border. It accepts a nonnegative length or a keyword; whether the border is visible also depends on border-left-style.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

border-left-width: <length [0,∞]> | thin | medium | thick;
/* Level 4 additionally defines hairline; implementation support requires verification. */

border-left-width sets the thickness of the physical left border, not its color or style. It is a longhand property: border-width sets thicknesses for all four sides, whereas border-left sets the left side's thickness, style, and color.

Core values are a nonnegative length, such as 8px, and thin, medium, or thick. Percentages and negative values are invalid; 0 is valid. The current specification drafts assign those keywords 1px, 3px, and 5px, respectively. Level 4 additionally defines hairline, a thin line whose thickness depends on the browser and device; do not assume support without checking it.

The initial value is medium, and the property is not inherited. However, the initial border-left-style is none. When the style is none or hidden, the used thickness is 0, even if a positive length is declared. To display an ordinary border, set a style such as border-left-style: solid.

The example reads the resolved thickness through getComputedStyle() before and after changing the style to none. The expected lines are 8px and 0px; the final element has no visible left border. Running the example in an isolated Chromium 157.0.8103.51 environment confirmed both output lines.

Examples

<!doctype html>
<meta charset="utf-8">
<style>
  #box {
    border-left-style: solid;
    border-left-color: black;
    border-left-width: 8px;
    padding: 8px;
  }
</style>
<div id="box">CSS</div>
<pre id="result"></pre>
<script>
  const box = document.getElementById('box');
  const widths = [getComputedStyle(box).borderLeftWidth];
  box.style.borderLeftStyle = 'none';
  widths.push(getComputedStyle(box).borderLeftWidth);
  document.getElementById('result').textContent = widths.join('\n');
</script>

Result

8px
0px

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources