Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

border-right-width — right border thickness

The border-right-width property sets the thickness of the physical right border. It accepts a nonnegative length or thin, medium, or thick; a visible line also requires an appropriate border-right-style.

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

Syntax

border-right-width: <length [0,∞]> | thin | medium | thick;

border-right-width sets the thickness of an element’s physical right border, not its color or style. Its initial value is medium; the property is not inherited.

Use a nonnegative length such as 8px, or the keyword thin, medium, or thick. Percentages and negative values are invalid. The value 0 means zero thickness.

When border-right-style is none or hidden, the used width is 0 despite the declared width. The initial style is none, so declaring a width alone does not show a border. The border, border-right, and border-width shorthands also set this property and can override it according to the cascade.

Examples

<!doctype html>
<meta charset="utf-8">
<title>border-right-width</title>
<style>
  #box {
    border: 0 solid black;
    border-right-width: 8px;
    width: 120px;
    height: 40px;
  }
</style>
<div id="box"></div>
<pre id="result"></pre>
<script>
  const box = document.getElementById('box');
  const result = document.getElementById('result');
  const visible = getComputedStyle(box).borderRightWidth;
  box.style.borderRightStyle = 'none';
  const hidden = getComputedStyle(box).borderRightWidth;
  box.style.borderRightStyle = 'solid';
  result.textContent = `${visible}\n${hidden}`;
</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