Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

border-image-width — border image thickness

border-image-width controls the thickness of border image bands, not the space reserved for borders in layout. It accepts lengths, percentages, border-width multipliers, or auto.

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

Syntax

border-image-width: [ <length-percentage [0,∞]> | <number [0,∞]> | auto ]{1,4};

border-image-width defines inward distances from the edges of the border image area, which defaults to the border box. It does not change layout; reserved border space depends on border-width and border-style. border-image-slice cuts the source image, whereas this property sets the resulting bands' thickness.

The initial value is 1; the property is not inherited. A unitless number multiplies that side's computed border-width. A length sets thickness directly. Percentages use the area's height for top/bottom and width for left/right. auto uses the corresponding slice's natural dimension, falling back to computed border-width when unavailable.

Supply 1–4 values: one for all sides; two for top/bottom and left/right; three for top, left/right, and bottom; four for top, right, bottom, left. Negative values are invalid. If opposite bands overlap, all thicknesses are proportionally reduced.

In the example, 2 1 produces 20px top/bottom bands and 10px side bands, but the border box stays 220px × 100px. Thicker bands paint inward without reserving extra space.

Examples

<!doctype html>
<meta charset="utf-8">
<title>border-image-width</title>
<style>
  .frame {
    box-sizing: content-box;
    width: 200px;
    height: 80px;
    padding: 0;
    border: 10px solid black;
    border-image-source: linear-gradient(#0066cc, #0066cc);
    border-image-slice: 1;
    border-image-width: 2 1;
    border-image-repeat: stretch;
  }
</style>
<div class="frame"></div>

Result

Expected: a blue frame with 20px top and bottom image bands and 10px left and right image bands. The border box remains 220px × 100px.

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