Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

border-block-end-width: size the border after the block

Set the thickness of one flow-relative edge, independently of its color and line style.

Version: CSS Modules

Syntax

border-block-end-width: <line-width>; /* nonnegative length | thin | medium | thick */

border-block-end-width sets the width of the border at the end of the block axis. With horizontal-tb it affects the bottom; with vertical-rl it affects the left; with vertical-lr it affects the right. Changing direction from ltr to rtl does not swap block-start and block-end. These edges describe the progression of blocks, not the beginning and end of a text line.

Use a nonnegative length or thin, medium or thick. The keyword widths are chosen by the browser; do not treat medium as a universally fixed pixel count. Percentages and negative lengths are invalid. Width alone does not create a visible border: its style must be something other than none or hidden. This property does not set that style, the color, padding or margin, and it is not inherited by default.

The example starts with a 100px by 40px content box, zero padding and all other border widths zero. A 6px solid block-end border makes its outer size 100×46 in horizontal-tb. Switching to vertical-rl gives 106×40 with a 6px left edge. Switching direction to rtl preserves that result. Setting the end style to none changes the computed width to 0px and returns the outer size to 100×40.

Logical and physical border declarations can target the same edge. Their cascade still matters; mixing border-bottom-width with this property can be confusing when the writing mode changes. Prefer a consistent logical model for components that support more than one writing mode. The measurements use content-box; with border-box, the same border instead consumes space inside the specified outer size.

Examples

const box=document.createElement('div');
box.style.cssText='width:100px;height:40px;padding:0;border:0 solid;box-sizing:content-box;border-block-end-width:6px';
document.body.append(box);
const read=()=>{const s=getComputedStyle(box),r=box.getBoundingClientRect();return [s.borderTopWidth,s.borderRightWidth,s.borderBottomWidth,s.borderLeftWidth,r.width,r.height].join(',')};
const horizontal=read();box.style.writingMode='vertical-rl';const vertical=read();
box.style.direction='rtl';const rtl=read();box.style.borderBlockEndStyle='none';const absent=read();
console.log('horizontal='+horizontal+'; vertical='+vertical+'; rtl='+rtl+'; none='+absent+'; negative='+CSS.supports('border-block-end-width','-1px')+'; percent='+CSS.supports('border-block-end-width','10%'));

Result

horizontal=0px,0px,6px,0px,100,46; vertical=0px,0px,0px,6px,106,40; rtl=0px,0px,0px,6px,106,40; none=0px,0px,0px,0px,100,40; negative=false; percent=false

Measured in Chromium 157.0.8103.51 using computed physical widths and bounding rectangles. No font or image resources are required.

Sources