CSS border-block-end-width Property
The border-block-end-width property sets the thickness of an element's logical block-end border.
Unlike border-bottom-width, which always targets the physical bottom border, border-block-end-width follows the element's writing mode. It changes the width of one logical border without changing its style or color.
border-block-end-width Syntax
selector {
border-block-end-width: 4px;
}
The property accepts a nonnegative CSS length, one of three border-width keywords, or a CSS-wide keyword.
.thin-border {
border-block-end-width: thin;
}
.medium-border {
border-block-end-width: medium;
}
.thick-border {
border-block-end-width: thick;
}
.pixel-border {
border-block-end-width: 5px;
}
.rem-border {
border-block-end-width: 0.25rem;
}
.no-width {
border-block-end-width: 0;
}
CSS-wide keywords are also supported:
.inherited {
border-block-end-width: inherit;
}
.reset {
border-block-end-width: initial;
}
.unset {
border-block-end-width: unset;
}
.reverted {
border-block-end-width: revert;
}
.layer-reverted {
border-block-end-width: revert-layer;
}
Only one width value is accepted. To set both logical block border widths, use border-block-width.
Property Values
| Value | Description |
|---|---|
thin |
A thin border using a browser-defined thickness. |
medium |
A medium border using a browser-defined thickness. This is the initial value. |
thick |
A thick border using a browser-defined thickness. |
<length> |
A nonnegative CSS length, such as 2px, 0.25rem, or 0.2em. |
0 |
Sets the border thickness to zero. |
inherit |
Uses the parent's computed block-end border width. |
initial |
Resets the property to medium. |
unset |
Resets the property to its initial value because it is not inherited. |
revert |
Reverts the property according to CSS cascade origin rules. |
revert-layer |
Reverts the property according to CSS cascade layer rules. |
The initial value is medium, and the property is not inherited. Its animation type is a length.
Negative lengths and percentages are invalid. A border width can also be calculated using supported CSS math functions, provided the resulting value is valid.
How It Works
The border-block-end-width property controls the thickness of one logical border. Its physical location is determined by the element's writing mode.
Setting a Visible Border
.panel {
border-block-end-width: 5px;
border-block-end-style: solid;
border-block-end-color: #1769aa;
}
This creates a 5-pixel solid blue border on the logical block-end side.
Changing an Existing Border Width
.panel {
border-block-end: 2px solid #1769aa;
border-block-end-width: 6px;
}
The second declaration increases the border thickness to 6 pixels without changing its style or color.
Changing Only One Block Side
.panel {
border-block: 2px solid #1769aa;
border-block-end-width: 6px;
}
The block-start border remains 2 pixels wide, while the block-end border becomes 6 pixels wide.
The Initial Width
.panel {
border-block-end-style: solid;
border-block-end-color: #1769aa;
}
Because no width is specified, the border uses the initial width of medium.
If the border style remains none, however, the used width is zero regardless of the specified width.
Writing Modes and Border Mapping
The border-block-end-width property follows the logical block-end side instead of a fixed physical edge.
| Writing Mode | Physical Border Affected |
|---|---|
horizontal-tb |
Bottom |
vertical-rl |
Left |
vertical-lr |
Right |
sideways-rl |
Left |
sideways-lr |
Right |
Horizontal Writing Mode
.horizontal {
writing-mode: horizontal-tb;
border-block-end: solid #1769aa;
border-block-end-width: 5px;
}
The bottom border is 5 pixels thick.
Vertical Right-to-Left Writing Mode
.vertical-right {
writing-mode: vertical-rl;
border-block-end: solid #1769aa;
border-block-end-width: 5px;
}
The left border is 5 pixels thick.
Vertical Left-to-Right Writing Mode
.vertical-left {
writing-mode: vertical-lr;
border-block-end: solid #1769aa;
border-block-end-width: 5px;
}
The right border is 5 pixels thick.
Text Direction
.rtl-panel {
direction: rtl;
writing-mode: horizontal-tb;
border-block-end: solid #1769aa;
border-block-end-width: 5px;
}
Changing direction to rtl does not move the block-end border in horizontal writing mode. It remains at the bottom.
Border Width Keywords
CSS provides three predefined border-width keywords: thin, medium, and thick.
thin
.thin-example {
border-block-end: thin solid #1769aa;
}
Creates a thin border using a browser-defined width.
medium
.medium-example {
border-block-end: medium solid #1769aa;
}
Creates a medium border. This is the initial border-width value.
thick
.thick-example {
border-block-end: thick solid #1769aa;
}
Creates a thick border using a browser-defined width.
Comparing the Keywords
.panel-thin {
border-block-end-width: thin;
}
.panel-medium {
border-block-end-width: medium;
}
.panel-thick {
border-block-end-width: thick;
}
The browser determines the exact pixel values. The keywords provide relative thickness categories rather than fixed measurements.
Use explicit lengths when a precise border thickness is required.
Length Values
The property accepts nonnegative CSS length values, including absolute and relative units.
Pixel Values
.pixel-border {
border-block-end: 4px solid #1769aa;
}
Pixels provide a convenient way to specify a consistent border thickness.
em Values
.em-border {
font-size: 20px;
border-block-end: 0.2em solid #1769aa;
}
The specified width is 4 pixels because 0.2em is calculated from the element's 20-pixel font size.
rem Values
.rem-border {
border-block-end: 0.25rem solid #1769aa;
}
The width is relative to the root element's font size. With a 16-pixel root font size, 0.25rem equals 4 pixels.
Using calc()
.calculated-border {
border-block-end-style: solid;
border-block-end-color: #1769aa;
border-block-end-width: calc(2px + 0.1rem);
}
The calc() function combines compatible CSS length values.
Using clamp()
.responsive-border {
border-block-end: solid #1769aa;
border-block-end-width: clamp(2px, 0.3vw, 6px);
}
The clamp() function limits the preferred border width between a minimum of 2 pixels and a maximum of 6 pixels.
Invalid Values
.invalid-negative {
border-block-end-width: -3px;
}
.invalid-percentage {
border-block-end-width: 10%;
}
Negative lengths and percentage values are not valid for this property. Browsers ignore these invalid declarations.
Border Visibility
A specified border width does not guarantee that the border will be visible. The border also needs a visible style and a color that can be seen against its background.
Width Without Style
.invisible {
border-block-end-width: 5px;
border-block-end-color: red;
}
The border is not displayed if its style remains none.
Adding a Visible Style
.visible {
border-block-end-width: 5px;
border-block-end-style: solid;
border-block-end-color: red;
}
The border is now visible because its style is solid.
Zero Width
.zero-width {
border-block-end-width: 0;
border-block-end-style: solid;
border-block-end-color: red;
}
A zero-width border occupies no thickness and is not visible.
Transparent Border
.transparent {
border-block-end-width: 5px;
border-block-end-style: solid;
border-block-end-color: transparent;
}
The border occupies space but is not visibly painted.
none and hidden
.none-style {
border-block-end: 5px none red;
}
.hidden-style {
border-block-end: 5px hidden red;
}
Both styles produce a used border width of zero. The hidden style also has special precedence when resolving collapsed table border conflicts.
Related Border Properties
Logical border properties provide separate controls for width, style, and color on each logical side.
| Property | Purpose |
|---|---|
border-block-end |
Sets the width, style, and color of the block-end border. |
border-block-end-width |
Sets only the block-end border width. |
border-block-end-style |
Sets only the block-end border style. |
border-block-end-color |
Sets only the block-end border color. |
border-block-start-width |
Sets the width of the opposite logical block border. |
border-block-width |
Sets the widths of both logical block borders. |
border-inline-width |
Sets the widths of both logical inline borders. |
Different Widths on Both Block Sides
.panel {
border-block: solid #1769aa;
border-block-start-width: 2px;
border-block-end-width: 6px;
}
The block-start border is 2 pixels wide, while the block-end border is 6 pixels wide.
Using border-block-width
.panel {
border-block: solid #1769aa;
border-block-width: 2px 6px;
}
The first value sets the block-start width, and the second sets the block-end width.
Logical vs. Physical Widths
.logical {
border-block-end-width: 5px;
}
.physical {
border-bottom-width: 5px;
}
In horizontal writing mode, both properties target the bottom border. In vertical writing, the logical property follows the block-end side, while the physical property always targets the bottom.
Shorthand and Longhand Interactions
Border shorthands can reset the logical block-end border width. The CSS cascade determines which declaration takes effect.
Overriding border-block-end
.panel {
border-block-end: 2px solid #1769aa;
border-block-end-width: 6px;
}
The later longhand increases the border width to 6 pixels.
Shorthand Reset
.panel {
border-block-end-width: 6px;
border-block-end: 2px solid #1769aa;
}
The later shorthand replaces the 6-pixel width with 2 pixels.
Overriding border-block-width
.panel {
border-block: 3px solid #1769aa;
border-block-width: 3px;
border-block-end-width: 7px;
}
The block-start border remains 3 pixels wide, while the block-end border becomes 7 pixels wide.
The border Shorthand
.panel {
border-block-end-width: 7px;
border: 2px solid gray;
}
The later border shorthand sets all four physical border widths to 2 pixels, overriding the earlier logical width.
Cascade Priority
These examples assume equal origin, importance, specificity, and cascade layer priority. Higher-priority declarations can override later declarations.
For predictable results, establish general border styles first and apply specific logical border widths afterward.
Borders and the Box Model
The used block-end border width contributes to the element's dimensions according to its box-sizing value.
content-box
.content-box-panel {
box-sizing: content-box;
block-size: 150px;
padding-block: 20px;
border-block-end: 5px solid #1769aa;
}
The declared 150-pixel block size describes the content box. The block-axis padding adds 40 pixels, and the block-end border adds 5 pixels. With no block-start border, the border-box block size is 195 pixels.
border-box
.border-box-panel {
box-sizing: border-box;
block-size: 150px;
padding-block: 20px;
border-block-end: 5px solid #1769aa;
}
The declared 150-pixel block size includes the content, block-axis padding, and borders.
Avoiding Hover Layout Changes
.interactive-panel {
border-block-end: 4px solid transparent;
}
.interactive-panel:hover {
border-block-end-color: #1769aa;
}
The transparent border reserves space before hover. Changing only its color avoids changing the border thickness.
Animating Border Width
.animated-panel {
border-block-end: 2px solid #1769aa;
transition: border-block-end-width 200ms ease;
}
.animated-panel:hover {
border-block-end-width: 6px;
}
@media (prefers-reduced-motion: reduce) {
.animated-panel {
transition: none;
}
}
The border width transitions between 2 and 6 pixels. Unlike a color-only transition, this may change the element's dimensions or the space available to its content.
Practical Uses
The property is useful for adjusting the thickness of logical dividers, headings, and component accents.
Heading Divider
.section-heading {
border-block-end: solid #1769aa;
border-block-end-width: 4px;
padding-block-end: 12px;
}
The heading receives a prominent divider that follows the logical block-end side.
Subtle Content Separator
.content-section {
border-block-end: solid #d0d7de;
border-block-end-width: 1px;
padding-block-end: 20px;
margin-block-end: 20px;
}
A thin border separates content sections without creating a heavy visual divider.
Emphasized Summary
.summary-panel {
border-block-end: solid #1769aa;
border-block-end-width: 6px;
padding-block-end: 16px;
}
A thicker border provides stronger visual emphasis.
Custom Property
.themed-panel {
--divider-width: 4px;
border-block-end: solid #1769aa;
border-block-end-width: var(--divider-width);
}
A custom property makes it easier to maintain consistent divider widths across related components.
border-block-end-width Example
The following example compares three border widths in horizontal writing mode and shows how a 7-pixel block-end border maps to vertical writing modes.
<div class="border-block-end-width-demo">
<div class="demo-box thin">2px Border</div>
<div class="demo-box medium">5px Border</div>
<div class="demo-box thick">8px Border</div>
<div class="demo-box vertical-right">vertical-rl</div>
<div class="demo-box vertical-left">vertical-lr</div>
</div>
.border-block-end-width-demo {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: 16px;
}
.border-block-end-width-demo .demo-box {
box-sizing: border-box;
inline-size: 160px;
block-size: 100px;
padding: 15px;
border-block-end-style: solid;
border-block-end-color: #1769aa;
background-color: #e8f2fb;
color: #173b5e;
font-weight: bold;
text-align: center;
}
.border-block-end-width-demo .thin {
border-block-end-width: 2px;
}
.border-block-end-width-demo .medium {
border-block-end-width: 5px;
}
.border-block-end-width-demo .thick {
border-block-end-width: 8px;
}
.border-block-end-width-demo .vertical-right {
writing-mode: vertical-rl;
border-block-end-width: 7px;
}
.border-block-end-width-demo .vertical-left {
writing-mode: vertical-lr;
border-block-end-width: 7px;
}
The first three boxes demonstrate how the border thickness changes from 2 to 8 pixels while remaining on the bottom edge.
In vertical-rl, the 7-pixel block-end border appears on the left. In vertical-lr, it appears on the right.
The example uses the same property for every box without requiring separate physical border-width declarations.
Important Considerations
Keep the following points in mind when using border-block-end-width:
- Logical border width: The property sets the thickness of the block-end border.
- Initial value: The default value is
medium. - Inheritance: The property is not inherited.
- Writing mode: The affected physical side depends on
writing-mode. - Horizontal writing: The property normally controls the bottom border width.
- Vertical writing: It controls the left border in
vertical-rland the right border invertical-lr. - Width keywords:
thin,medium, andthickuse browser-defined thicknesses. - Length values: Nonnegative lengths such as
px,em, andremare supported. - Invalid values: Negative lengths and percentages are not accepted.
- Zero width: A width of
0removes the border's thickness. - Border style: A style of
noneorhiddenproduces a used width of zero. - Border color: This property does not change the border color.
- Single side: Only the logical block-end border is affected.
- Both block sides: Use
border-block-widthto set both logical block border widths. - Shorthand: Use
border-block-endto set width, style, and color together. - Physical borders: Logical and physical border widths may target the same edge depending on writing mode.
- Shorthand resets: Later border shorthands can override the logical border width.
- Box model: The used border width contributes to the element's dimensions.
- Animation: Border width can animate as a length, but changing it may affect layout.
- Accessibility: Borders used to communicate important states should remain visible and should not be the only indicator.
Use border-block-end-width when a logical block-end border needs a different thickness without changing its style or color.
Browser Support
The border-block-end-width property is widely supported in modern versions of Chrome, Edge, Firefox, Safari, and other major browsers.
The property does not require vendor prefixes. Support for newer CSS math functions used in width values may vary independently.
Standard Declaration
.panel {
border-block-end-style: solid;
border-block-end-color: #1769aa;
border-block-end-width: 5px;
}
Physical Border Fallback
.panel {
border-bottom: 5px solid #1769aa;
}
@supports (border-block-end-width: 5px) {
.panel {
border-bottom: 0;
border-block-end: 5px solid #1769aa;
}
}
This fallback assumes horizontal writing mode. Browsers supporting logical borders use the block-end border, while older browsers retain the physical bottom border.
For vertical writing modes, physical fallbacks must be adapted to the corresponding left or right side.
Visit Can I Use? to review current browser compatibility.
Specifications
The border-block-end-width property is defined in the CSS Logical Properties and Values Module Level 1 specification.
CSS Logical Properties and Values Module Level 1
General border-width behavior is defined in the CSS Backgrounds and Borders Module Level 3 specification.
