`border-left-width` CSS property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

The **border-left-width** CSS property sets the width of the left border of an element.

{{InteractiveExample("CSS Demo: border-left-width")}}

css interactive-example-choice
border-left-width: thick;
css interactive-example-choice
border-left-width: 2em;
css interactive-example-choice
border-left-width: 4px;
css interactive-example-choice
border-left-width: 2ex;
css interactive-example-choice
border-left-width: 0;
html interactive-example
<section class="default-example" id="default-example">
  <div class="transition-all" id="example-element">
    This is a box with a border around it.
  </div>
</section>
css interactive-example
#example-element {
  background-color: palegreen;
  color: black;
  border: 0 solid crimson;
  padding: 0.75em;
  width: 80%;
  height: 100px;
}

Syntax

css
/* Keyword values */
border-left-width: thin;
border-left-width: medium;
border-left-width: thick;

/* <length> values */
border-left-width: 10em;
border-left-width: 3vmax;
border-left-width: 6px;

/* Global keywords */
border-left-width: inherit;
border-left-width: initial;
border-left-width: revert;
border-left-width: revert-layer;
border-left-width: unset;

Values

  • {{cssxref("&lt;line-width&gt;")}}
  • : Defines the width of the border, either as an explicit non-negative {{cssxref("&lt;length&gt;")}} or the keywords: thin, medium, or thick. The default is medium.

Formal definition

{{CSSInfo}}

Formal syntax

{{csssyntax}}

Examples

Comparing border widths

HTML

html
<div>Element 1</div>
<div>Element 2</div>

CSS

css
div {
  border: 1px solid red;
  margin: 1em 0;
}

div:nth-child(1) {
  border-left-width: thick;
}
div:nth-child(2) {
  border-left-width: 2em;
}

Result

{{EmbedLiveSample('Comparing_border_widths', '100%')}}

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • The other border-width-related CSS properties: {{Cssxref("border-top-width")}}, {{Cssxref("border-right-width")}}, {{Cssxref("border-bottom-width")}}, and {{Cssxref("border-width")}}.
  • The other border-left-related CSS properties: {{Cssxref("border")}}, {{Cssxref("border-left")}}, {{Cssxref("border-left-style")}}, and {{Cssxref("border-left-color")}}.